From 69968fbf4d9da871e82ca8d8c752614ef6d3aa22 Mon Sep 17 00:00:00 2001 From: bmc-msft <41130664+bmc-msft@users.noreply.github.com> Date: Wed, 27 Apr 2022 17:17:03 -0400 Subject: [PATCH] regenerate services from azure-rest-api-specs (#732) --- services/CHANGELOG.md | 8 +- .../autorust/codegen/examples/gen_mgmt.rs | 9 + services/autorust/codegen/examples/gen_svc.rs | 11 +- services/autorust/codegen/src/cargo_toml.rs | 2 +- .../autorust/codegen/src/codegen_models.rs | 3 +- services/mgmt/activedirectory/Cargo.toml | 2 +- services/mgmt/addons/Cargo.toml | 2 +- .../mgmt/adhybridhealthservice/Cargo.toml | 2 +- services/mgmt/adp/Cargo.toml | 2 +- services/mgmt/advisor/Cargo.toml | 2 +- services/mgmt/agrifood/Cargo.toml | 2 +- services/mgmt/alertsmanagement/Cargo.toml | 2 +- services/mgmt/analysisservices/Cargo.toml | 2 +- services/mgmt/apimanagement/Cargo.toml | 5 +- services/mgmt/apimanagement/README.md | 1 + services/mgmt/apimanagement/src/lib.rs | 4 + .../src/package_2020_12/models.rs | 2 +- .../src/package_2021_08/models.rs | 2 +- .../src/package_preview_2020_06/models.rs | 2 +- .../src/package_preview_2021_01/models.rs | 2 +- .../src/package_preview_2021_04/models.rs | 2 +- .../src/package_preview_2021_12}/mod.rs | 0 .../src/package_preview_2021_12/models.rs | 7687 +++ .../src/package_preview_2021_12/operations.rs | 37896 +++++++++++ services/mgmt/app/Cargo.toml | 2 +- services/mgmt/app/README.md | 2 +- .../mgmt/app/src/package_2022_03/models.rs | 20 + .../app/src/package_2022_03/operations.rs | 91 + services/mgmt/appconfiguration/Cargo.toml | 2 +- services/mgmt/applicationinsights/Cargo.toml | 2 +- services/mgmt/appplatform/Cargo.toml | 2 +- services/mgmt/arcdata/Cargo.toml | 2 +- .../src/package_preview_2022_03/models.rs | 62 +- .../src/package_preview_2022_03/operations.rs | 10 +- services/mgmt/attestation/Cargo.toml | 2 +- services/mgmt/authorization/Cargo.toml | 2 +- services/mgmt/automanage/Cargo.toml | 2 +- services/mgmt/automation/Cargo.toml | 2 +- .../src/package_2020_01_13_preview/models.rs | 4 + .../src/package_2021_06_22/models.rs | 4 + .../src/package_2022_01_31/models.rs | 4 + .../mgmt/baremetalinfrastructure/Cargo.toml | 2 +- services/mgmt/batch/Cargo.toml | 2 +- services/mgmt/billing/Cargo.toml | 2 +- services/mgmt/blockchain/Cargo.toml | 2 +- services/mgmt/blueprint/Cargo.toml | 2 +- services/mgmt/botservice/Cargo.toml | 2 +- services/mgmt/cdn/Cargo.toml | 2 +- services/mgmt/changeanalysis/Cargo.toml | 2 +- services/mgmt/chaos/Cargo.toml | 2 +- .../src/package_2021_09_15_preview/models.rs | 6 + services/mgmt/cloudshell/Cargo.toml | 2 +- services/mgmt/cognitiveservices/Cargo.toml | 2 +- services/mgmt/commerce/Cargo.toml | 2 +- services/mgmt/communication/Cargo.toml | 2 +- services/mgmt/compute/Cargo.toml | 2 +- services/mgmt/confidentialledger/Cargo.toml | 2 +- services/mgmt/confluent/Cargo.toml | 2 +- services/mgmt/connectedvmware/Cargo.toml | 2 +- services/mgmt/consumption/Cargo.toml | 2 +- .../consumption/src/package_2019_10/models.rs | 7 - .../consumption/src/package_2021_10/models.rs | 3 - .../src/package_2021_10/operations.rs | 31 +- services/mgmt/containerinstance/Cargo.toml | 2 +- services/mgmt/containerregistry/Cargo.toml | 2 +- services/mgmt/containerservice/Cargo.toml | 8 +- services/mgmt/containerservice/README.md | 4 +- services/mgmt/containerservice/src/lib.rs | 8 + .../src/package_2022_03/mod.rs | 2 + .../src/package_2022_03/models.rs | 2804 + .../src/package_2022_03/operations.rs | 4274 ++ .../src/package_preview_2022_03/mod.rs | 2 + .../src/package_preview_2022_03/models.rs | 3008 + .../src/package_preview_2022_03/operations.rs | 4959 ++ services/mgmt/cosmosdb/Cargo.toml | 7 +- services/mgmt/cosmosdb/README.md | 3 +- services/mgmt/cosmosdb/src/lib.rs | 4 + .../src/package_preview_2022_02/mod.rs | 2 + .../src/package_preview_2022_02/models.rs | 5938 ++ .../src/package_preview_2022_02/operations.rs | 20706 ++++++ services/mgmt/costmanagement/Cargo.toml | 5 +- services/mgmt/costmanagement/README.md | 1 + services/mgmt/costmanagement/src/lib.rs | 4 + .../src/package_2021_10/models.rs | 28 +- .../src/package_preview_2022_04/mod.rs | 2 + .../src/package_preview_2022_04/models.rs | 1842 + .../src/package_preview_2022_04/operations.rs | 3661 ++ services/mgmt/cpim/Cargo.toml | 2 +- services/mgmt/customerinsights/Cargo.toml | 2 +- services/mgmt/customerlockbox/Cargo.toml | 2 +- services/mgmt/customproviders/Cargo.toml | 2 +- services/mgmt/dashboard/Cargo.toml | 2 +- .../src/package_2021_09_01_preview/models.rs | 6 + services/mgmt/data/Cargo.toml | 2 +- services/mgmt/databox/Cargo.toml | 7 +- services/mgmt/databox/README.md | 3 +- services/mgmt/databox/src/lib.rs | 4 + .../mgmt/databox/src/package_2022_02/mod.rs | 2 + .../databox/src/package_2022_02/models.rs | 3510 + .../databox/src/package_2022_02/operations.rs | 1812 + services/mgmt/databoxedge/Cargo.toml | 5 +- services/mgmt/databoxedge/README.md | 1 + services/mgmt/databoxedge/src/lib.rs | 4 + .../src/package_2021_06_01/models.rs | 25 + .../src/package_2021_06_01_preview/models.rs | 25 + .../src/package_2022_04_01_preview/mod.rs | 2 + .../src/package_2022_04_01_preview/models.rs | 4648 ++ .../package_2022_04_01_preview/operations.rs | 7644 +++ services/mgmt/databricks/Cargo.toml | 2 +- services/mgmt/datacatalog/Cargo.toml | 2 +- services/mgmt/datadog/Cargo.toml | 2 +- services/mgmt/datafactory/Cargo.toml | 2 +- .../datafactory/src/package_2018_06/models.rs | 154 + services/mgmt/datalakeanalytics/Cargo.toml | 2 +- services/mgmt/datalakestore/Cargo.toml | 2 +- services/mgmt/dataprotection/Cargo.toml | 8 +- services/mgmt/dataprotection/README.md | 6 +- services/mgmt/dataprotection/src/lib.rs | 8 + .../dataprotection/src/package_2022_03/mod.rs | 2 + .../src/package_2022_03/models.rs | 2579 + .../src/package_2022_03/operations.rs | 5703 ++ .../src/package_preview_2022_03/mod.rs | 2 + .../src/package_preview_2022_03/models.rs | 2647 + .../src/package_preview_2022_03/operations.rs | 5795 ++ services/mgmt/datashare/Cargo.toml | 2 +- services/mgmt/deploymentmanager/Cargo.toml | 2 +- .../mgmt/desktopvirtualization/Cargo.toml | 2 +- services/mgmt/deviceupdate/Cargo.toml | 2 +- services/mgmt/devops/Cargo.toml | 2 +- services/mgmt/devspaces/Cargo.toml | 2 +- services/mgmt/devtestlabs/Cargo.toml | 2 +- services/mgmt/dfp/Cargo.toml | 2 +- services/mgmt/digitaltwins/Cargo.toml | 2 +- services/mgmt/dns/Cargo.toml | 2 +- services/mgmt/dnsresolver/Cargo.toml | 2 +- services/mgmt/domainservices/Cargo.toml | 2 +- services/mgmt/edgeorder/Cargo.toml | 2 +- services/mgmt/edgeorderpartner/Cargo.toml | 2 +- services/mgmt/education/Cargo.toml | 34 + services/mgmt/education/README.md | 13 + services/mgmt/education/src/lib.rs | 9 + .../src/package_2021_12_01_preview/mod.rs | 2 + .../src/package_2021_12_01_preview/models.rs | 630 + .../package_2021_12_01_preview/operations.rs | 2111 + services/mgmt/elastic/Cargo.toml | 2 +- services/mgmt/elasticsan/Cargo.toml | 34 + services/mgmt/elasticsan/README.md | 13 + services/mgmt/elasticsan/src/lib.rs | 9 + .../src/package_2021_11_20_preview/mod.rs | 2 + .../src/package_2021_11_20_preview/models.rs | 807 + .../package_2021_11_20_preview/operations.rs | 1898 + services/mgmt/engagementfabric/Cargo.toml | 2 +- .../mgmt/enterpriseknowledgegraph/Cargo.toml | 2 +- services/mgmt/eventgrid/Cargo.toml | 2 +- services/mgmt/eventhub/Cargo.toml | 2 +- services/mgmt/extendedlocation/Cargo.toml | 2 +- services/mgmt/fluidrelay/Cargo.toml | 2 +- services/mgmt/frontdoor/Cargo.toml | 2 +- services/mgmt/guestconfiguration/Cargo.toml | 2 +- services/mgmt/hanaon/Cargo.toml | 2 +- .../mgmt/hardwaresecuritymodules/Cargo.toml | 2 +- services/mgmt/hdinsight/Cargo.toml | 2 +- services/mgmt/healthbot/Cargo.toml | 2 +- services/mgmt/healthcareapis/Cargo.toml | 7 +- services/mgmt/healthcareapis/README.md | 3 +- services/mgmt/healthcareapis/src/lib.rs | 4 + .../src/package_preview_2022_01/mod.rs | 2 + .../src/package_preview_2022_01/models.rs | 1604 + .../src/package_preview_2022_01/operations.rs | 4666 ++ services/mgmt/hybridcompute/Cargo.toml | 7 +- services/mgmt/hybridcompute/README.md | 3 +- services/mgmt/hybridcompute/src/lib.rs | 4 + .../hybridcompute/src/package_2022_03/mod.rs | 2 + .../src/package_2022_03/models.rs | 1134 + .../src/package_2022_03/operations.rs | 2681 + services/mgmt/hybridconnectivity/Cargo.toml | 5 +- services/mgmt/hybridconnectivity/README.md | 3 +- services/mgmt/hybridconnectivity/src/lib.rs | 4 + .../src/package_2022_05_01_preview/mod.rs | 2 + .../src/package_2022_05_01_preview/models.rs | 387 + .../package_2022_05_01_preview/operations.rs | 793 + services/mgmt/hybriddatamanager/Cargo.toml | 2 +- services/mgmt/hybridkubernetes/Cargo.toml | 2 +- services/mgmt/hybridnetwork/Cargo.toml | 2 +- services/mgmt/imagebuilder/Cargo.toml | 2 +- services/mgmt/intune/Cargo.toml | 2 +- services/mgmt/iotcentral/Cargo.toml | 2 +- services/mgmt/iothub/Cargo.toml | 2 +- services/mgmt/keyvault/Cargo.toml | 2 +- .../mgmt/kubernetesconfiguration/Cargo.toml | 5 +- .../mgmt/kubernetesconfiguration/README.md | 1 + .../mgmt/kubernetesconfiguration/src/lib.rs | 4 + .../src/package_preview_2022_01_15/mod.rs | 2 + .../src/package_preview_2022_01_15/models.rs | 1271 + .../package_preview_2022_01_15/operations.rs | 2317 + services/mgmt/kusto/Cargo.toml | 2 +- services/mgmt/labservices/Cargo.toml | 2 +- services/mgmt/loadtestservice/Cargo.toml | 7 +- services/mgmt/loadtestservice/README.md | 3 +- services/mgmt/loadtestservice/src/lib.rs | 4 + .../src/package_2022_04_15_preview/mod.rs | 2 + .../src/package_2022_04_15_preview/models.rs | 421 + .../package_2022_04_15_preview/operations.rs | 738 + services/mgmt/logic/Cargo.toml | 2 +- services/mgmt/logz/Cargo.toml | 2 +- services/mgmt/machinelearning/Cargo.toml | 2 +- .../mgmt/machinelearningcompute/Cargo.toml | 2 +- .../machinelearningexperimentation/Cargo.toml | 2 +- .../mgmt/machinelearningservices/Cargo.toml | 2 +- .../src/package_2021_03_01_preview/models.rs | 86 +- services/mgmt/maintenance/Cargo.toml | 2 +- services/mgmt/managednetwork/Cargo.toml | 2 +- services/mgmt/managedservices/Cargo.toml | 2 +- services/mgmt/managementgroups/Cargo.toml | 2 +- services/mgmt/managementpartner/Cargo.toml | 2 +- services/mgmt/maps/Cargo.toml | 2 +- services/mgmt/mariadb/Cargo.toml | 2 +- .../mgmt/marketplacenotifications/Cargo.toml | 2 +- services/mgmt/marketplaceordering/Cargo.toml | 2 +- services/mgmt/mediaservices/Cargo.toml | 2 +- services/mgmt/migrate/Cargo.toml | 2 +- services/mgmt/migrateprojects/Cargo.toml | 2 +- services/mgmt/mobilenetwork/Cargo.toml | 2 +- services/mgmt/monitor/Cargo.toml | 7 +- services/mgmt/monitor/README.md | 3 +- services/mgmt/monitor/src/lib.rs | 4 + .../src/package_2022_04_01_only/mod.rs | 2 + .../src/package_2022_04_01_only/models.rs | 621 + .../src/package_2022_04_01_only/operations.rs | 1096 + services/mgmt/msi/Cargo.toml | 2 +- services/mgmt/mysql/Cargo.toml | 2 +- services/mgmt/netapp/Cargo.toml | 2 +- services/mgmt/network/Cargo.toml | 7 +- services/mgmt/network/README.md | 3 +- services/mgmt/network/src/lib.rs | 4 + .../src/package_2021_02_preview/models.rs | 41 +- .../src/package_2021_02_preview/operations.rs | 2 + .../package_2021_02_preview_only/models.rs | 41 +- .../operations.rs | 2 + .../mgmt/network/src/package_2021_08/mod.rs | 2 + .../network/src/package_2021_08/models.rs | 17721 +++++ .../network/src/package_2021_08/operations.rs | 53809 ++++++++++++++++ services/mgmt/notificationhubs/Cargo.toml | 2 +- services/mgmt/oep/Cargo.toml | 2 +- services/mgmt/operationalinsights/Cargo.toml | 2 +- .../src/package_2021_06/models.rs | 8 +- services/mgmt/operationsmanagement/Cargo.toml | 2 +- services/mgmt/orbital/Cargo.toml | 7 +- services/mgmt/orbital/README.md | 3 +- services/mgmt/orbital/src/lib.rs | 4 + .../orbital/src/package_2022_03_01/mod.rs | 2 + .../orbital/src/package_2022_03_01/models.rs | 1028 + .../src/package_2022_03_01/operations.rs | 2145 + services/mgmt/peering/Cargo.toml | 2 +- services/mgmt/policyinsights/Cargo.toml | 2 +- services/mgmt/portal/Cargo.toml | 2 +- services/mgmt/postgresql/Cargo.toml | 2 +- services/mgmt/postgresqlhsc/Cargo.toml | 2 +- services/mgmt/powerbidedicated/Cargo.toml | 2 +- services/mgmt/powerbiembedded/Cargo.toml | 2 +- services/mgmt/powerbiprivatelinks/Cargo.toml | 2 +- services/mgmt/powerplatform/Cargo.toml | 2 +- services/mgmt/privatedns/Cargo.toml | 2 +- services/mgmt/providerhub/Cargo.toml | 2 +- services/mgmt/purview/Cargo.toml | 2 +- services/mgmt/quantum/Cargo.toml | 7 +- services/mgmt/quantum/README.md | 5 +- services/mgmt/quantum/src/lib.rs | 4 + .../src/package_2022_01_10_preview/mod.rs | 2 + .../src/package_2022_01_10_preview/models.rs | 622 + .../package_2022_01_10_preview/operations.rs | 928 + services/mgmt/quota/Cargo.toml | 2 +- .../mgmt/recommendationsservice/Cargo.toml | 2 +- services/mgmt/recoveryservices/Cargo.toml | 8 +- services/mgmt/recoveryservices/README.md | 4 +- services/mgmt/recoveryservices/src/lib.rs | 8 + .../src/package_2022_02/mod.rs | 2 + .../src/package_2022_02/models.rs | 1188 + .../src/package_2022_02/operations.rs | 1903 + .../src/package_preview_2022_01/mod.rs | 2 + .../src/package_preview_2022_01/models.rs | 1291 + .../src/package_preview_2022_01/operations.rs | 1996 + .../mgmt/recoveryservicesbackup/Cargo.toml | 5 +- .../mgmt/recoveryservicesbackup/README.md | 1 + .../mgmt/recoveryservicesbackup/src/lib.rs | 4 + .../src/package_2022_02/mod.rs | 2 + .../src/package_2022_02/models.rs | 7544 +++ .../src/package_2022_02/operations.rs | 7832 +++ .../recoveryservicessiterecovery/Cargo.toml | 7 +- .../recoveryservicessiterecovery/README.md | 3 +- .../recoveryservicessiterecovery/src/lib.rs | 4 + .../src/package_2022_02/mod.rs | 2 + .../src/package_2022_02/models.rs | 14555 +++++ .../src/package_2022_02/operations.rs | 13113 ++++ services/mgmt/redhatopenshift/Cargo.toml | 7 +- services/mgmt/redhatopenshift/README.md | 5 +- services/mgmt/redhatopenshift/src/lib.rs | 4 + .../src/package_2022_04_01/mod.rs | 2 + .../src/package_2022_04_01/models.rs | 482 + .../src/package_2022_04_01/operations.rs | 934 + services/mgmt/redis/Cargo.toml | 2 +- services/mgmt/redisenterprise/Cargo.toml | 2 +- services/mgmt/relay/Cargo.toml | 7 +- services/mgmt/relay/README.md | 3 +- services/mgmt/relay/src/lib.rs | 4 + .../mgmt/relay/src/package_2021_11_01/mod.rs | 2 + .../relay/src/package_2021_11_01/models.rs | 857 + .../src/package_2021_11_01/operations.rs | 4150 ++ services/mgmt/reservations/Cargo.toml | 2 +- .../src/package_2017_11/models.rs | 1 + .../src/package_2021_07_01/models.rs | 5 + .../src/package_2022_03/models.rs | 6 + services/mgmt/resourceconnector/Cargo.toml | 2 +- services/mgmt/resourcegraph/Cargo.toml | 2 +- services/mgmt/resourcehealth/Cargo.toml | 2 +- services/mgmt/resourcehealth/README.md | 2 +- .../src/package_2018_07_01/operations.rs | 163 + services/mgmt/resourcemover/Cargo.toml | 2 +- services/mgmt/resources/Cargo.toml | 10 +- services/mgmt/resources/README.md | 6 +- services/mgmt/resources/src/lib.rs | 16 +- .../package_changes_2022_03_01_preview/mod.rs | 2 + .../models.rs | 0 .../operations.rs | 57 +- .../src/package_changes_2022_05/mod.rs | 2 + .../src/package_changes_2022_05/models.rs | 205 + .../src/package_changes_2022_05/operations.rs | 313 + .../src/package_templatespecs_2022_02/mod.rs | 2 + .../package_templatespecs_2022_02/models.rs | 303 + .../operations.rs | 1544 + services/mgmt/saas/Cargo.toml | 2 +- services/mgmt/scheduler/Cargo.toml | 2 +- services/mgmt/scvmm/Cargo.toml | 34 + services/mgmt/scvmm/README.md | 13 + services/mgmt/scvmm/src/lib.rs | 9 + .../src/package_2020_06_05_preview/mod.rs | 2 + .../src/package_2020_06_05_preview/models.rs | 1482 + .../package_2020_06_05_preview/operations.rs | 4770 ++ services/mgmt/search/Cargo.toml | 2 +- services/mgmt/security/Cargo.toml | 2 +- .../src/package_2018_06_only/models.rs | 6 +- .../security/src/package_2022_03/models.rs | 6 +- .../src/package_composite_v1/models.rs | 6 +- .../src/package_composite_v2/models.rs | 12 +- .../src/package_composite_v3/models.rs | 12 +- .../mgmt/securityandcompliance/Cargo.toml | 2 +- services/mgmt/securityinsights/Cargo.toml | 2 +- .../src/package_2020_01/models.rs | 10 + services/mgmt/serialconsole/Cargo.toml | 2 +- services/mgmt/servicebus/Cargo.toml | 2 +- services/mgmt/servicefabricmesh/Cargo.toml | 2 +- services/mgmt/servicelinker/Cargo.toml | 7 +- services/mgmt/servicelinker/README.md | 5 +- services/mgmt/servicelinker/src/lib.rs | 4 + .../src/package_2022_05_01/mod.rs | 2 + .../src/package_2022_05_01/models.rs | 756 + .../src/package_2022_05_01/operations.rs | 807 + services/mgmt/signalr/Cargo.toml | 2 +- services/mgmt/softwareplan/Cargo.toml | 2 +- services/mgmt/solutions/Cargo.toml | 2 +- services/mgmt/sql/Cargo.toml | 2 +- services/mgmt/sql/README.md | 2 +- .../sql/src/package_composite_v5/models.rs | 122 +- .../src/package_composite_v5/operations.rs | 2485 +- services/mgmt/sqlvirtualmachine/Cargo.toml | 2 +- services/mgmt/stack/Cargo.toml | 2 +- services/mgmt/storage/Cargo.toml | 2 +- services/mgmt/storagecache/Cargo.toml | 2 +- services/mgmt/storageimportexport/Cargo.toml | 2 +- services/mgmt/storagepool/Cargo.toml | 2 +- services/mgmt/storagesync/Cargo.toml | 2 +- services/mgmt/storsimple1200series/Cargo.toml | 2 +- services/mgmt/storsimple8000series/Cargo.toml | 2 +- services/mgmt/streamanalytics/Cargo.toml | 2 +- services/mgmt/subscription/Cargo.toml | 2 +- services/mgmt/support/Cargo.toml | 2 +- services/mgmt/synapse/Cargo.toml | 2 +- services/mgmt/testbase/Cargo.toml | 2 +- services/mgmt/timeseriesinsights/Cargo.toml | 2 +- services/mgmt/trafficmanager/Cargo.toml | 2 +- services/mgmt/vi/Cargo.toml | 2 +- services/mgmt/videoanalyzer/Cargo.toml | 2 +- services/mgmt/visualstudio/Cargo.toml | 2 +- services/mgmt/vmware/Cargo.toml | 2 +- services/mgmt/vmwarecloudsimple/Cargo.toml | 2 +- services/mgmt/web/Cargo.toml | 2 +- services/mgmt/webpubsub/Cargo.toml | 2 +- services/mgmt/windowsesu/Cargo.toml | 2 +- services/mgmt/windowsiot/Cargo.toml | 2 +- services/mgmt/workloadmonitor/Cargo.toml | 2 +- services/svc/appconfiguration/Cargo.toml | 2 +- services/svc/applicationinsights/Cargo.toml | 2 +- services/svc/attestation/Cargo.toml | 2 +- services/svc/batch/Cargo.toml | 2 +- services/svc/blobstorage/Cargo.toml | 2 +- services/svc/confidentialledger/Cargo.toml | 2 +- services/svc/containerregistry/Cargo.toml | 2 +- services/svc/cosmosdb/Cargo.toml | 2 +- services/svc/datalakeanalytics/Cargo.toml | 2 +- .../svc/deviceprovisioningservices/Cargo.toml | 2 +- services/svc/deviceupdate/Cargo.toml | 2 +- services/svc/digitaltwins/Cargo.toml | 2 +- services/svc/eventgrid/Cargo.toml | 2 +- .../eventgrid/src/package_2018_01/models.rs | 41 +- .../src/package_2018_01/operations.rs | 50 +- services/svc/filestorage/Cargo.toml | 2 +- services/svc/graphrbac/Cargo.toml | 2 +- services/svc/imds/Cargo.toml | 2 +- services/svc/iotcentral/Cargo.toml | 7 +- services/svc/iotcentral/README.md | 3 +- services/svc/iotcentral/src/lib.rs | 4 + .../iotcentral/src/package_1_2_preview/mod.rs | 2 + .../src/package_1_2_preview/models.rs | 1647 + .../src/package_1_2_preview/operations.rs | 7803 +++ services/svc/keyvault/Cargo.toml | 2 +- services/svc/loadtestservice/Cargo.toml | 2 +- services/svc/marketplacecatalog/Cargo.toml | 2 +- services/svc/mixedreality/Cargo.toml | 5 +- services/svc/mixedreality/README.md | 1 + services/svc/mixedreality/src/lib.rs | 4 + .../src/package_0_3_preview_1/mod.rs | 2 + .../src/package_0_3_preview_1/models.rs | 267 + .../src/package_0_3_preview_1/operations.rs | 373 + services/svc/monitor/Cargo.toml | 2 +- services/svc/operationalinsights/Cargo.toml | 2 +- services/svc/purview/Cargo.toml | 10 +- services/svc/purview/README.md | 6 +- services/svc/purview/src/lib.rs | 16 + .../src/package_2021_05_01_preview/mod.rs | 2 + .../src/package_2021_05_01_preview/models.rs | 2006 + .../package_2021_05_01_preview/operations.rs | 7849 +++ .../src/package_2021_10_01_preview/mod.rs | 2 + .../src/package_2021_10_01_preview/models.rs | 4099 ++ .../package_2021_10_01_preview/operations.rs | 3159 + .../src/package_2022_02_01_preview/mod.rs | 2 + .../src/package_2022_02_01_preview/models.rs | 4477 ++ .../package_2022_02_01_preview/operations.rs | 3496 + .../src/package_preview_2022_03/mod.rs | 2 + .../src/package_preview_2022_03/models.rs | 2082 + .../src/package_preview_2022_03/operations.rs | 9115 +++ services/svc/quantum/Cargo.toml | 2 +- services/svc/queuestorage/Cargo.toml | 2 +- services/svc/schemaregistry/Cargo.toml | 2 +- services/svc/servicefabric/Cargo.toml | 2 +- services/svc/storagedatalake/Cargo.toml | 2 +- services/svc/synapse/Cargo.toml | 7 +- services/svc/synapse/README.md | 3 +- services/svc/synapse/src/lib.rs | 4 + .../package_artifacts_2020_12_01/models.rs | 170 + .../models.rs | 35 +- .../package_artifacts_composite_v1/models.rs | 170 + .../package_artifacts_composite_v2/models.rs | 170 + .../package_artifacts_composite_v3/models.rs | 170 + .../src/package_artifacts_composite_v4/mod.rs | 2 + .../package_artifacts_composite_v4/models.rs | 21390 ++++++ .../operations.rs | 8687 +++ services/svc/timeseriesinsights/Cargo.toml | 2 +- services/svc/webpubsub/Cargo.toml | 2 +- 458 files changed, 372477 insertions(+), 2001 deletions(-) rename services/mgmt/{resources/src/package_changes_2022_03 => apimanagement/src/package_preview_2021_12}/mod.rs (100%) create mode 100644 services/mgmt/apimanagement/src/package_preview_2021_12/models.rs create mode 100644 services/mgmt/apimanagement/src/package_preview_2021_12/operations.rs create mode 100644 services/mgmt/containerservice/src/package_2022_03/mod.rs create mode 100644 services/mgmt/containerservice/src/package_2022_03/models.rs create mode 100644 services/mgmt/containerservice/src/package_2022_03/operations.rs create mode 100644 services/mgmt/containerservice/src/package_preview_2022_03/mod.rs create mode 100644 services/mgmt/containerservice/src/package_preview_2022_03/models.rs create mode 100644 services/mgmt/containerservice/src/package_preview_2022_03/operations.rs create mode 100644 services/mgmt/cosmosdb/src/package_preview_2022_02/mod.rs create mode 100644 services/mgmt/cosmosdb/src/package_preview_2022_02/models.rs create mode 100644 services/mgmt/cosmosdb/src/package_preview_2022_02/operations.rs create mode 100644 services/mgmt/costmanagement/src/package_preview_2022_04/mod.rs create mode 100644 services/mgmt/costmanagement/src/package_preview_2022_04/models.rs create mode 100644 services/mgmt/costmanagement/src/package_preview_2022_04/operations.rs create mode 100644 services/mgmt/databox/src/package_2022_02/mod.rs create mode 100644 services/mgmt/databox/src/package_2022_02/models.rs create mode 100644 services/mgmt/databox/src/package_2022_02/operations.rs create mode 100644 services/mgmt/databoxedge/src/package_2022_04_01_preview/mod.rs create mode 100644 services/mgmt/databoxedge/src/package_2022_04_01_preview/models.rs create mode 100644 services/mgmt/databoxedge/src/package_2022_04_01_preview/operations.rs create mode 100644 services/mgmt/dataprotection/src/package_2022_03/mod.rs create mode 100644 services/mgmt/dataprotection/src/package_2022_03/models.rs create mode 100644 services/mgmt/dataprotection/src/package_2022_03/operations.rs create mode 100644 services/mgmt/dataprotection/src/package_preview_2022_03/mod.rs create mode 100644 services/mgmt/dataprotection/src/package_preview_2022_03/models.rs create mode 100644 services/mgmt/dataprotection/src/package_preview_2022_03/operations.rs create mode 100644 services/mgmt/education/Cargo.toml create mode 100644 services/mgmt/education/README.md create mode 100644 services/mgmt/education/src/lib.rs create mode 100644 services/mgmt/education/src/package_2021_12_01_preview/mod.rs create mode 100644 services/mgmt/education/src/package_2021_12_01_preview/models.rs create mode 100644 services/mgmt/education/src/package_2021_12_01_preview/operations.rs create mode 100644 services/mgmt/elasticsan/Cargo.toml create mode 100644 services/mgmt/elasticsan/README.md create mode 100644 services/mgmt/elasticsan/src/lib.rs create mode 100644 services/mgmt/elasticsan/src/package_2021_11_20_preview/mod.rs create mode 100644 services/mgmt/elasticsan/src/package_2021_11_20_preview/models.rs create mode 100644 services/mgmt/elasticsan/src/package_2021_11_20_preview/operations.rs create mode 100644 services/mgmt/healthcareapis/src/package_preview_2022_01/mod.rs create mode 100644 services/mgmt/healthcareapis/src/package_preview_2022_01/models.rs create mode 100644 services/mgmt/healthcareapis/src/package_preview_2022_01/operations.rs create mode 100644 services/mgmt/hybridcompute/src/package_2022_03/mod.rs create mode 100644 services/mgmt/hybridcompute/src/package_2022_03/models.rs create mode 100644 services/mgmt/hybridcompute/src/package_2022_03/operations.rs create mode 100644 services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/mod.rs create mode 100644 services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/models.rs create mode 100644 services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/operations.rs create mode 100644 services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/mod.rs create mode 100644 services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/models.rs create mode 100644 services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/operations.rs create mode 100644 services/mgmt/loadtestservice/src/package_2022_04_15_preview/mod.rs create mode 100644 services/mgmt/loadtestservice/src/package_2022_04_15_preview/models.rs create mode 100644 services/mgmt/loadtestservice/src/package_2022_04_15_preview/operations.rs create mode 100644 services/mgmt/monitor/src/package_2022_04_01_only/mod.rs create mode 100644 services/mgmt/monitor/src/package_2022_04_01_only/models.rs create mode 100644 services/mgmt/monitor/src/package_2022_04_01_only/operations.rs create mode 100644 services/mgmt/network/src/package_2021_08/mod.rs create mode 100644 services/mgmt/network/src/package_2021_08/models.rs create mode 100644 services/mgmt/network/src/package_2021_08/operations.rs create mode 100644 services/mgmt/orbital/src/package_2022_03_01/mod.rs create mode 100644 services/mgmt/orbital/src/package_2022_03_01/models.rs create mode 100644 services/mgmt/orbital/src/package_2022_03_01/operations.rs create mode 100644 services/mgmt/quantum/src/package_2022_01_10_preview/mod.rs create mode 100644 services/mgmt/quantum/src/package_2022_01_10_preview/models.rs create mode 100644 services/mgmt/quantum/src/package_2022_01_10_preview/operations.rs create mode 100644 services/mgmt/recoveryservices/src/package_2022_02/mod.rs create mode 100644 services/mgmt/recoveryservices/src/package_2022_02/models.rs create mode 100644 services/mgmt/recoveryservices/src/package_2022_02/operations.rs create mode 100644 services/mgmt/recoveryservices/src/package_preview_2022_01/mod.rs create mode 100644 services/mgmt/recoveryservices/src/package_preview_2022_01/models.rs create mode 100644 services/mgmt/recoveryservices/src/package_preview_2022_01/operations.rs create mode 100644 services/mgmt/recoveryservicesbackup/src/package_2022_02/mod.rs create mode 100644 services/mgmt/recoveryservicesbackup/src/package_2022_02/models.rs create mode 100644 services/mgmt/recoveryservicesbackup/src/package_2022_02/operations.rs create mode 100644 services/mgmt/recoveryservicessiterecovery/src/package_2022_02/mod.rs create mode 100644 services/mgmt/recoveryservicessiterecovery/src/package_2022_02/models.rs create mode 100644 services/mgmt/recoveryservicessiterecovery/src/package_2022_02/operations.rs create mode 100644 services/mgmt/redhatopenshift/src/package_2022_04_01/mod.rs create mode 100644 services/mgmt/redhatopenshift/src/package_2022_04_01/models.rs create mode 100644 services/mgmt/redhatopenshift/src/package_2022_04_01/operations.rs create mode 100644 services/mgmt/relay/src/package_2021_11_01/mod.rs create mode 100644 services/mgmt/relay/src/package_2021_11_01/models.rs create mode 100644 services/mgmt/relay/src/package_2021_11_01/operations.rs create mode 100644 services/mgmt/resources/src/package_changes_2022_03_01_preview/mod.rs rename services/mgmt/resources/src/{package_changes_2022_03 => package_changes_2022_03_01_preview}/models.rs (100%) rename services/mgmt/resources/src/{package_changes_2022_03 => package_changes_2022_03_01_preview}/operations.rs (96%) create mode 100644 services/mgmt/resources/src/package_changes_2022_05/mod.rs create mode 100644 services/mgmt/resources/src/package_changes_2022_05/models.rs create mode 100644 services/mgmt/resources/src/package_changes_2022_05/operations.rs create mode 100644 services/mgmt/resources/src/package_templatespecs_2022_02/mod.rs create mode 100644 services/mgmt/resources/src/package_templatespecs_2022_02/models.rs create mode 100644 services/mgmt/resources/src/package_templatespecs_2022_02/operations.rs create mode 100644 services/mgmt/scvmm/Cargo.toml create mode 100644 services/mgmt/scvmm/README.md create mode 100644 services/mgmt/scvmm/src/lib.rs create mode 100644 services/mgmt/scvmm/src/package_2020_06_05_preview/mod.rs create mode 100644 services/mgmt/scvmm/src/package_2020_06_05_preview/models.rs create mode 100644 services/mgmt/scvmm/src/package_2020_06_05_preview/operations.rs create mode 100644 services/mgmt/servicelinker/src/package_2022_05_01/mod.rs create mode 100644 services/mgmt/servicelinker/src/package_2022_05_01/models.rs create mode 100644 services/mgmt/servicelinker/src/package_2022_05_01/operations.rs create mode 100644 services/svc/iotcentral/src/package_1_2_preview/mod.rs create mode 100644 services/svc/iotcentral/src/package_1_2_preview/models.rs create mode 100644 services/svc/iotcentral/src/package_1_2_preview/operations.rs create mode 100644 services/svc/mixedreality/src/package_0_3_preview_1/mod.rs create mode 100644 services/svc/mixedreality/src/package_0_3_preview_1/models.rs create mode 100644 services/svc/mixedreality/src/package_0_3_preview_1/operations.rs create mode 100644 services/svc/purview/src/package_2021_05_01_preview/mod.rs create mode 100644 services/svc/purview/src/package_2021_05_01_preview/models.rs create mode 100644 services/svc/purview/src/package_2021_05_01_preview/operations.rs create mode 100644 services/svc/purview/src/package_2021_10_01_preview/mod.rs create mode 100644 services/svc/purview/src/package_2021_10_01_preview/models.rs create mode 100644 services/svc/purview/src/package_2021_10_01_preview/operations.rs create mode 100644 services/svc/purview/src/package_2022_02_01_preview/mod.rs create mode 100644 services/svc/purview/src/package_2022_02_01_preview/models.rs create mode 100644 services/svc/purview/src/package_2022_02_01_preview/operations.rs create mode 100644 services/svc/purview/src/package_preview_2022_03/mod.rs create mode 100644 services/svc/purview/src/package_preview_2022_03/models.rs create mode 100644 services/svc/purview/src/package_preview_2022_03/operations.rs create mode 100644 services/svc/synapse/src/package_artifacts_composite_v4/mod.rs create mode 100644 services/svc/synapse/src/package_artifacts_composite_v4/models.rs create mode 100644 services/svc/synapse/src/package_artifacts_composite_v4/operations.rs diff --git a/services/CHANGELOG.md b/services/CHANGELOG.md index 64c387ebaf..64f62dc9f5 100644 --- a/services/CHANGELOG.md +++ b/services/CHANGELOG.md @@ -1,10 +1,16 @@ +# 0.3 (2022-04) + +- [#732](https://github.com/Azure/azure-sdk-for-rust/pull/732) generated from azure-rest-api-specs [commit from 2022-04-27](https://github.com/Azure/azure-rest-api-specs/commit/46ffdc4fe0f9a413ba29ed859b5ff4174ce1c7ec) +- [#718](https://github.com/Azure/azure-sdk-for-rust/pull/718) include `path` and `x_ms_path` endpoints +- [#706](https://github.com/Azure/azure-sdk-for-rust/pull/706) update `azure_core` to 0.2 + # 0.2 (2022-03) - [#672](https://github.com/Azure/azure-sdk-for-rust/pull/672) generated from azure-rest-api-specs [commit from 2022-04-01](https://github.com/Azure/azure-rest-api-specs/commit/48d85585897aa6ed448ca689b094e60377a25cb7) - [#675](https://github.com/Azure/azure-sdk-for-rust/pull/675) use Basic Information tag for default version - [#634](https://github.com/Azure/azure-sdk-for-rust/issues/634) limit docs.rs to 5 API tags - [#632](https://github.com/Azure/azure-sdk-for-rust/issues/632) add links & README.md for services -- Renamed `no-default-version` feature to `no-default-tag` & expanded tag documentation +- [#711](https://github.com/Azure/azure-sdk-for-rust/pull/711) Renamed `no-default-version` feature to `no-default-tag` & expanded tag documentation # 0.1 (2022-01) diff --git a/services/autorust/codegen/examples/gen_mgmt.rs b/services/autorust/codegen/examples/gen_mgmt.rs index 105f797dfc..411c13ebad 100644 --- a/services/autorust/codegen/examples/gen_mgmt.rs +++ b/services/autorust/codegen/examples/gen_mgmt.rs @@ -57,6 +57,7 @@ const SKIP_SERVICE_TAGS: &[(&str, &str)] = &[ ("marketplace", "package-composite-v2"), // mixing versions ("monitor", "package-2021-09"), // AzureResource defined in 2021-09-01/actionGroups_API.json is different ("monitor", "package-2021-07"), // also AzureResource difference + ("monitor", "package-2022-04"), // also AzureResource difference ("recoveryservicesbackup", "package-2020-07"), // duplicate fn get_operation_status ("recoveryservicesbackup", "package-2020-10"), // duplicate fn get_operation_status ("recoveryservicessiterecovery", "package-2016-08"), // duplicate package-2016-08 https://github.com/Azure/azure-rest-api-specs/pull/11287 @@ -188,6 +189,9 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2021-05-01/databox.json", "transferAllDetails", "include"), ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2021-12-01/databox.json", "transferFilterDetails", "include"), ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2021-12-01/databox.json", "transferAllDetails", "include"), + ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2022-03-01/databox.json", "transferAllDetails", "include"), + ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2022-02-01/databox.json", "transferFilterDetails", "include"), + ("../../../azure-rest-api-specs/specification/databox/resource-manager/Microsoft.DataBox/stable/2022-02-01/databox.json", "transferAllDetails", "include"), // dataprotection ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-01-01/dataprotection.json", "InnerError", "embeddedInnerError"), ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2021-07-01/dataprotection.json", "InnerError", "embeddedInnerError"), @@ -197,6 +201,7 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2021-12-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-01-01/dataprotection.json", "InnerError", "embeddedInnerError"), ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-02-01-preview/dataprotection.json", "InnerError", "embeddedInnerError"), + ("../../../azure-rest-api-specs/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-03-31-preview/dataprotection.json", "InnerError", "embeddedInnerError"), // hardwaresecuritymodels ("../../../azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2018-10-31-preview/dedicatedhsm.json", "Error", "innererror"), ("../../../azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/dedicatedhsm.json", "Error", "innererror"), @@ -290,6 +295,10 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2016-03-30/network.json", "PublicIPAddress", "properties"), ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2016-03-30/network.json", "IPConfigurationPropertiesFormat", "publicIPAddress"), ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2016-03-30/network.json", "IPConfiguration", "properties"), + ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2021-08-01/networkInterface.json", "IPConfiguration", "properties"), + ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2021-08-01/networkInterface.json", "IPConfigurationPropertiesFormat", "publicIPAddress"), + ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2021-08-01/publicIpAddress.json", "PublicIPAddress" , "properties"), + ("../../../azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/stable/2021-08-01/publicIpAddress.json", "PublicIPAddressPropertiesFormat", "ipConfiguration"), // operationalinsights ("../../../azure-rest-api-specs/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/preview/2019-09-01-preview/QueryPackQueries_API.json", "ErrorInfo", "innererror"), ("../../../azure-rest-api-specs/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/preview/2019-09-01-preview/QueryPacks_API.json", "ErrorInfo", "innererror"), diff --git a/services/autorust/codegen/examples/gen_svc.rs b/services/autorust/codegen/examples/gen_svc.rs index 0d5c6fb518..c9fcd7e1aa 100644 --- a/services/autorust/codegen/examples/gen_svc.rs +++ b/services/autorust/codegen/examples/gen_svc.rs @@ -21,7 +21,6 @@ const SKIP_SERVICES: &[&str] = &[ const SKIP_SERVICE_TAGS: &[(&str, &str)] = &[ ("agrifood", "package-2021-03-31-preview"), // duplicate params https://github.com/Azure/azure-sdk-for-rust/issues/501 - ("purview", "package-2021-05-01-preview"), // need to box types ("maps", "package-preview-2.0"), // global responses https://github.com/Azure/azure-sdk-for-rust/issues/502 ("maps", "package-1.0-preview"), // global responses https://github.com/Azure/azure-sdk-for-rust/issues/502 ("servicefabric", "6.2"), // invalid model TimeBasedBackupScheduleDescription @@ -165,6 +164,16 @@ const BOX_PROPERTIES: &[(&str, &str, &str)] = &[ "InnerError", "innererror" ), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "NumberFormat", "currencyInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "NumberFormat", "instance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "NumberFormat", "integerInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "NumberFormat", "numberInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "NumberFormat", "percentInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "TimeZone", "default"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "DateFormat", "dateInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "DateFormat", "instance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "DateFormat", "dateTimeInstance"), + ("../../../azure-rest-api-specs/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2022-03-01-preview/purviewcatalog.json", "DateFormat", "timeInstance"), ]; fn main() -> Result<()> { diff --git a/services/autorust/codegen/src/cargo_toml.rs b/services/autorust/codegen/src/cargo_toml.rs index 6aeeb27e7b..d6eebeb2b5 100644 --- a/services/autorust/codegen/src/cargo_toml.rs +++ b/services/autorust/codegen/src/cargo_toml.rs @@ -32,7 +32,7 @@ pub fn create(crate_name: &str, tags: &[&Tag], default_tag: &Tag, path: &Utf8Pat r#"# generated by AutoRust [package] name = "{}" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/autorust/codegen/src/codegen_models.rs b/services/autorust/codegen/src/codegen_models.rs index 1260502f5f..9e6ba57171 100644 --- a/services/autorust/codegen/src/codegen_models.rs +++ b/services/autorust/codegen/src/codegen_models.rs @@ -480,7 +480,7 @@ fn create_struct(cg: &CodeGen, schema: &SchemaGen, struct_name: &str) -> Result< } = create_struct_field_code(cg, &ns, &property.schema, property_name, lowercase_workaround)?; mod_code.extend(field_code); // uncomment the next two lines to help identify entries that need boxed - // let prop_nm_str = format!("{} , {} , {}", prop_nm.file_path.display(), prop_nm.schema_name, property_name); + // let prop_nm_str = format!("{} , {} , {}", prop_nm.file_path, prop_nm.schema_name, property_name); // props.extend(quote! { #[doc = #prop_nm_str ]}); if cg.should_force_obj(prop_nm) { @@ -513,6 +513,7 @@ fn create_struct(cg: &CodeGen, schema: &SchemaGen, struct_name: &str) -> Result< } else { quote! {} }; + // see if a field should be wrapped in a Box let should_box = cg.should_box_property(prop_nm); if should_box { diff --git a/services/mgmt/activedirectory/Cargo.toml b/services/mgmt/activedirectory/Cargo.toml index 0937da71a7..ba9b710e33 100644 --- a/services/mgmt/activedirectory/Cargo.toml +++ b/services/mgmt/activedirectory/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_activedirectory" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/addons/Cargo.toml b/services/mgmt/addons/Cargo.toml index bac869df7a..fc0b00acb3 100644 --- a/services/mgmt/addons/Cargo.toml +++ b/services/mgmt/addons/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_addons" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/adhybridhealthservice/Cargo.toml b/services/mgmt/adhybridhealthservice/Cargo.toml index 969cf76921..40d6d9f247 100644 --- a/services/mgmt/adhybridhealthservice/Cargo.toml +++ b/services/mgmt/adhybridhealthservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_adhybridhealthservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/adp/Cargo.toml b/services/mgmt/adp/Cargo.toml index f3c84d733e..ad427e4d7a 100644 --- a/services/mgmt/adp/Cargo.toml +++ b/services/mgmt/adp/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_adp" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/advisor/Cargo.toml b/services/mgmt/advisor/Cargo.toml index 4e22800f09..971e29cd4a 100644 --- a/services/mgmt/advisor/Cargo.toml +++ b/services/mgmt/advisor/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_advisor" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/agrifood/Cargo.toml b/services/mgmt/agrifood/Cargo.toml index 8924a95b00..860204d404 100644 --- a/services/mgmt/agrifood/Cargo.toml +++ b/services/mgmt/agrifood/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_agrifood" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/alertsmanagement/Cargo.toml b/services/mgmt/alertsmanagement/Cargo.toml index 80ef2c6df2..30fe2fca4e 100644 --- a/services/mgmt/alertsmanagement/Cargo.toml +++ b/services/mgmt/alertsmanagement/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_alertsmanagement" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/analysisservices/Cargo.toml b/services/mgmt/analysisservices/Cargo.toml index 4235816bc9..ab8b837b58 100644 --- a/services/mgmt/analysisservices/Cargo.toml +++ b/services/mgmt/analysisservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_analysisservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/apimanagement/Cargo.toml b/services/mgmt/apimanagement/Cargo.toml index 58770d6c03..1372036494 100644 --- a/services/mgmt/apimanagement/Cargo.toml +++ b/services/mgmt/apimanagement/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_apimanagement" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2021-04", "package-preview-2021-01", "package-2020-12", "package-preview-2020-06"] +features = ["no-default-tag", "package-preview-2021-12", "package-preview-2021-04", "package-preview-2021-01", "package-2020-12"] [features] default = ["package-2021-08", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-preview-2021-12" = [] "package-2021-08" = [] "package-preview-2021-04" = [] "package-preview-2021-01" = [] diff --git a/services/mgmt/apimanagement/README.md b/services/mgmt/apimanagement/README.md index f99822d758..bc30b8f4ba 100644 --- a/services/mgmt/apimanagement/README.md +++ b/services/mgmt/apimanagement/README.md @@ -10,6 +10,7 @@ The default tag is `package-2021-08`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-preview-2021-12` has 355 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-preview-2021-12` to enable. The operations will be in the `package_preview_2021_12` module. - `package-2021-08` has 344 operations from 1 API versions: `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module. - `package-preview-2021-04` has 344 operations from 1 API versions: `2021-04-01-preview`. Use crate feature `package-preview-2021-04` to enable. The operations will be in the `package_preview_2021_04` module. - `package-preview-2021-01` has 331 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-preview-2021-01` to enable. The operations will be in the `package_preview_2021_01` module. diff --git a/services/mgmt/apimanagement/src/lib.rs b/services/mgmt/apimanagement/src/lib.rs index f34ea29dbb..3d7af0dd58 100644 --- a/services/mgmt/apimanagement/src/lib.rs +++ b/services/mgmt/apimanagement/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-preview-2021-12")] +pub mod package_preview_2021_12; +#[cfg(all(feature = "package-preview-2021-12", not(feature = "no-default-tag")))] +pub use package_preview_2021_12::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-08")] pub mod package_2021_08; #[cfg(all(feature = "package-2021-08", not(feature = "no-default-tag")))] diff --git a/services/mgmt/apimanagement/src/package_2020_12/models.rs b/services/mgmt/apimanagement/src/package_2020_12/models.rs index 605894bc42..3edaa8a9d8 100644 --- a/services/mgmt/apimanagement/src/package_2020_12/models.rs +++ b/services/mgmt/apimanagement/src/package_2020_12/models.rs @@ -3563,7 +3563,7 @@ pub struct KeyVaultContractCreateProperties { #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires Api Management service to be configured with aka.ms/apimmsi"] #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] pub secret_identifier: Option, - #[doc = "SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret."] + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] pub identity_client_id: Option, } diff --git a/services/mgmt/apimanagement/src/package_2021_08/models.rs b/services/mgmt/apimanagement/src/package_2021_08/models.rs index 4e96dd5478..db8ddb6560 100644 --- a/services/mgmt/apimanagement/src/package_2021_08/models.rs +++ b/services/mgmt/apimanagement/src/package_2021_08/models.rs @@ -4095,7 +4095,7 @@ pub struct KeyVaultContractCreateProperties { #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi"] #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] pub secret_identifier: Option, - #[doc = "SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret."] + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] pub identity_client_id: Option, } diff --git a/services/mgmt/apimanagement/src/package_preview_2020_06/models.rs b/services/mgmt/apimanagement/src/package_preview_2020_06/models.rs index 8fb0fa9443..5ced9e8fec 100644 --- a/services/mgmt/apimanagement/src/package_preview_2020_06/models.rs +++ b/services/mgmt/apimanagement/src/package_preview_2020_06/models.rs @@ -3560,7 +3560,7 @@ pub struct KeyVaultContractCreateProperties { #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires Api Management service to be configured with aka.ms/apimmsi"] #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] pub secret_identifier: Option, - #[doc = "SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret."] + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] pub identity_client_id: Option, } diff --git a/services/mgmt/apimanagement/src/package_preview_2021_01/models.rs b/services/mgmt/apimanagement/src/package_preview_2021_01/models.rs index bd6318b459..20ab087f00 100644 --- a/services/mgmt/apimanagement/src/package_preview_2021_01/models.rs +++ b/services/mgmt/apimanagement/src/package_preview_2021_01/models.rs @@ -3642,7 +3642,7 @@ pub struct KeyVaultContractCreateProperties { #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi"] #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] pub secret_identifier: Option, - #[doc = "SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret."] + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] pub identity_client_id: Option, } diff --git a/services/mgmt/apimanagement/src/package_preview_2021_04/models.rs b/services/mgmt/apimanagement/src/package_preview_2021_04/models.rs index 1ae6075350..eba5db78ca 100644 --- a/services/mgmt/apimanagement/src/package_preview_2021_04/models.rs +++ b/services/mgmt/apimanagement/src/package_preview_2021_04/models.rs @@ -4086,7 +4086,7 @@ pub struct KeyVaultContractCreateProperties { #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi"] #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] pub secret_identifier: Option, - #[doc = "SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret."] + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] pub identity_client_id: Option, } diff --git a/services/mgmt/resources/src/package_changes_2022_03/mod.rs b/services/mgmt/apimanagement/src/package_preview_2021_12/mod.rs similarity index 100% rename from services/mgmt/resources/src/package_changes_2022_03/mod.rs rename to services/mgmt/apimanagement/src/package_preview_2021_12/mod.rs diff --git a/services/mgmt/apimanagement/src/package_preview_2021_12/models.rs b/services/mgmt/apimanagement/src/package_preview_2021_12/models.rs new file mode 100644 index 0000000000..8111a01875 --- /dev/null +++ b/services/mgmt/apimanagement/src/package_preview_2021_12/models.rs @@ -0,0 +1,7687 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Paged AccessInformation list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AccessInformationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant Settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Tenant access information contract of the API Management service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AccessInformationContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information contract of the API Management service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationContractProperties { + #[doc = "Access Information type ('access' or 'gitAccess')"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Principal (User) Identifier."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Determines whether direct access is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl AccessInformationContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information update parameters of the API Management service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationCreateParameterProperties { + #[doc = "Principal (User) Identifier."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "Determines whether direct access is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl AccessInformationCreateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information update parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationCreateParameters { + #[doc = "Tenant access information update parameters of the API Management service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AccessInformationCreateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information contract of the API Management service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationSecretsContract { + #[doc = "Access Information type ('access' or 'gitAccess')"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Principal (User) Identifier."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "Determines whether direct access is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl AccessInformationSecretsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information update parameters of the API Management service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationUpdateParameterProperties { + #[doc = "Determines whether direct access is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl AccessInformationUpdateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information update parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessInformationUpdateParameters { + #[doc = "Tenant access information update parameters of the API Management service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AccessInformationUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of an additional API Management resource location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdditionalLocation { + #[doc = "The location name of the additional region among Azure Data center regions."] + pub location: String, + #[doc = "API Management service resource SKU properties."] + pub sku: ApiManagementServiceSkuProperties, + #[doc = "A list of availability zones denoting where the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard, Premium and Isolated SKU."] + #[serde(rename = "publicIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_addresses: Vec, + #[doc = "Private Static Load Balanced IP addresses of the API Management service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard, Premium and Isolated SKU."] + #[serde(rename = "privateIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub private_ip_addresses: Vec, + #[doc = "Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the location. Supported only for Premium SKU being deployed in Virtual Network."] + #[serde(rename = "publicIpAddressId", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_id: Option, + #[doc = "Configuration of a virtual network to which API Management service is deployed."] + #[serde(rename = "virtualNetworkConfiguration", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_configuration: Option, + #[doc = "Gateway URL of the API Management service in the Region."] + #[serde(rename = "gatewayRegionalUrl", default, skip_serializing_if = "Option::is_none")] + pub gateway_regional_url: Option, + #[doc = "Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location."] + #[serde(rename = "disableGateway", default, skip_serializing_if = "Option::is_none")] + pub disable_gateway: Option, + #[doc = "Compute Platform Version running the service."] + #[serde(rename = "platformVersion", default, skip_serializing_if = "Option::is_none")] + pub platform_version: Option, +} +impl AdditionalLocation { + pub fn new(location: String, sku: ApiManagementServiceSkuProperties) -> Self { + Self { + location, + sku, + zones: Vec::new(), + public_ip_addresses: Vec::new(), + private_ip_addresses: Vec::new(), + public_ip_address_id: None, + virtual_network_configuration: None, + gateway_regional_url: None, + disable_gateway: None, + platform_version: None, + } + } +} +pub mod additional_location { + use super::*; + #[doc = "Compute Platform Version running the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PlatformVersion { + #[serde(rename = "undetermined")] + Undetermined, + #[serde(rename = "stv1")] + Stv1, + #[serde(rename = "stv2")] + Stv2, + #[serde(rename = "mtv1")] + Mtv1, + } +} +#[doc = "Paged API list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API contact information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiContactInformation { + #[doc = "The identifying name of the contact person/organization"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The URL pointing to the contact information. MUST be in the format of a URL"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The email address of the contact person/organization. MUST be in the format of an email address"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, +} +impl ApiContactInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "API Entity Properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Entity Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiContractProperties { + #[serde(flatten)] + pub api_entity_base_contract: ApiEntityBaseContract, + #[doc = "API identifier of the source API."] + #[serde(rename = "sourceApiId", default, skip_serializing_if = "Option::is_none")] + pub source_api_id: Option, + #[doc = "API name. Must be 1 to 300 characters long."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API."] + pub path: String, + #[doc = "Describes on which protocols the operations in this API can be invoked."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, + #[doc = "An API Version Set contains the common configuration for a set of API Versions relating "] + #[serde(rename = "apiVersionSet", default, skip_serializing_if = "Option::is_none")] + pub api_version_set: Option, +} +impl ApiContractProperties { + pub fn new(path: String) -> Self { + Self { + api_entity_base_contract: ApiEntityBaseContract::default(), + source_api_id: None, + display_name: None, + service_url: None, + path, + protocols: Vec::new(), + api_version_set: None, + } + } +} +#[doc = "API update contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiContractUpdateProperties { + #[serde(flatten)] + pub api_entity_base_contract: ApiEntityBaseContract, + #[doc = "API name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Absolute URL of the backend service implementing this API."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Describes on which protocols the operations in this API can be invoked."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, +} +impl ApiContractUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Create or Update Parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiCreateOrUpdateParameter { + #[doc = "API Create or Update Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiCreateOrUpdateParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Create or Update Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiCreateOrUpdateProperties { + #[serde(flatten)] + pub api_contract_properties: ApiContractProperties, + #[doc = "Content value when Importing an API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Format of the Content in which the API is getting imported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "Criteria to limit import of WSDL to a subset of the document."] + #[serde(rename = "wsdlSelector", default, skip_serializing_if = "Option::is_none")] + pub wsdl_selector: Option, + #[doc = "Type of API to create. \n * `http` creates a REST API \n * `soap` creates a SOAP pass-through API \n * `websocket` creates websocket API \n * `graphql` creates GraphQL API."] + #[serde(rename = "apiType", default, skip_serializing_if = "Option::is_none")] + pub api_type: Option, +} +impl ApiCreateOrUpdateProperties { + pub fn new(api_contract_properties: ApiContractProperties) -> Self { + Self { + api_contract_properties, + value: None, + format: None, + wsdl_selector: None, + api_type: None, + } + } +} +pub mod api_create_or_update_properties { + use super::*; + #[doc = "Format of the Content in which the API is getting imported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Format { + #[serde(rename = "wadl-xml")] + WadlXml, + #[serde(rename = "wadl-link-json")] + WadlLinkJson, + #[serde(rename = "swagger-json")] + SwaggerJson, + #[serde(rename = "swagger-link-json")] + SwaggerLinkJson, + #[serde(rename = "wsdl")] + Wsdl, + #[serde(rename = "wsdl-link")] + WsdlLink, + #[serde(rename = "openapi")] + Openapi, + #[serde(rename = "openapi+json")] + OpenapiJson, + #[serde(rename = "openapi-link")] + OpenapiLink, + #[serde(rename = "openapi+json-link")] + OpenapiJsonLink, + #[serde(rename = "graphql-link")] + GraphqlLink, + } + #[doc = "Criteria to limit import of WSDL to a subset of the document."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct WsdlSelector { + #[doc = "Name of service to import from WSDL"] + #[serde(rename = "wsdlServiceName", default, skip_serializing_if = "Option::is_none")] + pub wsdl_service_name: Option, + #[doc = "Name of endpoint(port) to import from WSDL"] + #[serde(rename = "wsdlEndpointName", default, skip_serializing_if = "Option::is_none")] + pub wsdl_endpoint_name: Option, + } + impl WsdlSelector { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Type of API to create. \n * `http` creates a REST API \n * `soap` creates a SOAP pass-through API \n * `websocket` creates websocket API \n * `graphql` creates GraphQL API."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ApiType { + #[serde(rename = "http")] + Http, + #[serde(rename = "soap")] + Soap, + #[serde(rename = "websocket")] + Websocket, + #[serde(rename = "graphql")] + Graphql, + } +} +#[doc = "API base contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiEntityBaseContract { + #[doc = "Description of the API. May include HTML formatting tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "API Authentication Settings."] + #[serde(rename = "authenticationSettings", default, skip_serializing_if = "Option::is_none")] + pub authentication_settings: Option, + #[doc = "Subscription key parameter names details."] + #[serde(rename = "subscriptionKeyParameterNames", default, skip_serializing_if = "Option::is_none")] + pub subscription_key_parameter_names: Option, + #[doc = "Type of API."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Describes the revision of the API. If no value is provided, default revision 1 is created"] + #[serde(rename = "apiRevision", default, skip_serializing_if = "Option::is_none")] + pub api_revision: Option, + #[doc = "Indicates the version identifier of the API if the API is versioned"] + #[serde(rename = "apiVersion", default, skip_serializing_if = "Option::is_none")] + pub api_version: Option, + #[doc = "Indicates if API revision is current api revision."] + #[serde(rename = "isCurrent", default, skip_serializing_if = "Option::is_none")] + pub is_current: Option, + #[doc = "Indicates if API revision is accessible via the gateway."] + #[serde(rename = "isOnline", default, skip_serializing_if = "Option::is_none")] + pub is_online: Option, + #[doc = "Description of the API Revision."] + #[serde(rename = "apiRevisionDescription", default, skip_serializing_if = "Option::is_none")] + pub api_revision_description: Option, + #[doc = "Description of the API Version."] + #[serde(rename = "apiVersionDescription", default, skip_serializing_if = "Option::is_none")] + pub api_version_description: Option, + #[doc = "A resource identifier for the related ApiVersionSet."] + #[serde(rename = "apiVersionSetId", default, skip_serializing_if = "Option::is_none")] + pub api_version_set_id: Option, + #[doc = "Specifies whether an API or Product subscription is required for accessing the API."] + #[serde(rename = "subscriptionRequired", default, skip_serializing_if = "Option::is_none")] + pub subscription_required: Option, + #[doc = " A URL to the Terms of Service for the API. MUST be in the format of a URL."] + #[serde(rename = "termsOfServiceUrl", default, skip_serializing_if = "Option::is_none")] + pub terms_of_service_url: Option, + #[doc = "API contact information"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contact: Option, + #[doc = "API license information"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub license: Option, +} +impl ApiEntityBaseContract { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_entity_base_contract { + use super::*; + #[doc = "Type of API."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "http")] + Http, + #[serde(rename = "soap")] + Soap, + #[serde(rename = "websocket")] + Websocket, + #[serde(rename = "graphql")] + Graphql, + } +} +#[doc = "API Export result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiExportResult { + #[doc = "ResourceId of the API which was exported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The object defining the schema of the exported API Detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl ApiExportResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_export_result { + use super::*; + #[doc = "Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Format { + #[serde(rename = "swagger-link-json")] + SwaggerLinkJson, + #[serde(rename = "wadl-link-json")] + WadlLinkJson, + #[serde(rename = "wsdl-link+xml")] + WsdlLinkXml, + #[serde(rename = "openapi-link")] + OpenapiLink, + } + #[doc = "The object defining the schema of the exported API Detail"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Value { + #[doc = "Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub link: Option, + } + impl Value { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "API license information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiLicenseInformation { + #[doc = "The license name used for the API"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A URL to the license used for the API. MUST be in the format of a URL"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, +} +impl ApiLicenseInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameter supplied to the Apply Network configuration operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceApplyNetworkConfigurationParameters { + #[doc = "Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl ApiManagementServiceApplyNetworkConfigurationParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Backup/Restore of an API Management service operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceBackupRestoreParameters { + #[doc = "The name of the Azure storage account (used to place/retrieve the backup)."] + #[serde(rename = "storageAccount")] + pub storage_account: String, + #[doc = "The name of the blob container (used to place/retrieve the backup)."] + #[serde(rename = "containerName")] + pub container_name: String, + #[doc = "The name of the backup file to create/retrieve."] + #[serde(rename = "backupName")] + pub backup_name: String, + #[doc = "The type of access to be used for the storage account."] + #[serde(rename = "accessType", default, skip_serializing_if = "Option::is_none")] + pub access_type: Option, + #[doc = "Storage account access key. Required only if `accessType` is set to `AccessKey`."] + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[doc = "The Client ID of user assigned managed identity. Required only if `accessType` is set to `UserAssignedManagedIdentity`."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl ApiManagementServiceBackupRestoreParameters { + pub fn new(storage_account: String, container_name: String, backup_name: String) -> Self { + Self { + storage_account, + container_name, + backup_name, + access_type: None, + access_key: None, + client_id: None, + } + } +} +pub mod api_management_service_backup_restore_parameters { + use super::*; + #[doc = "The type of access to be used for the storage account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessType { + AccessKey, + SystemAssignedManagedIdentity, + UserAssignedManagedIdentity, + } + impl Default for AccessType { + fn default() -> Self { + Self::AccessKey + } + } +} +#[doc = "Base Properties of an API Management service resource description."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceBaseProperties { + #[doc = "Email address from which the notification will be sent."] + #[serde(rename = "notificationSenderEmail", default, skip_serializing_if = "Option::is_none")] + pub notification_sender_email: Option, + #[doc = "The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The provisioning state of the API Management service, which is targeted by the long running operation started on the service."] + #[serde(rename = "targetProvisioningState", default, skip_serializing_if = "Option::is_none")] + pub target_provisioning_state: Option, + #[doc = "Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard."] + #[serde(rename = "createdAtUtc", default, skip_serializing_if = "Option::is_none")] + pub created_at_utc: Option, + #[doc = "Gateway URL of the API Management service."] + #[serde(rename = "gatewayUrl", default, skip_serializing_if = "Option::is_none")] + pub gateway_url: Option, + #[doc = "Gateway URL of the API Management service in the Default Region."] + #[serde(rename = "gatewayRegionalUrl", default, skip_serializing_if = "Option::is_none")] + pub gateway_regional_url: Option, + #[doc = "Publisher portal endpoint Url of the API Management service."] + #[serde(rename = "portalUrl", default, skip_serializing_if = "Option::is_none")] + pub portal_url: Option, + #[doc = "Management API endpoint URL of the API Management service."] + #[serde(rename = "managementApiUrl", default, skip_serializing_if = "Option::is_none")] + pub management_api_url: Option, + #[doc = "SCM endpoint URL of the API Management service."] + #[serde(rename = "scmUrl", default, skip_serializing_if = "Option::is_none")] + pub scm_url: Option, + #[doc = "DEveloper Portal endpoint URL of the API Management service."] + #[serde(rename = "developerPortalUrl", default, skip_serializing_if = "Option::is_none")] + pub developer_portal_url: Option, + #[doc = "Custom hostname configuration of the API Management service."] + #[serde(rename = "hostnameConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub hostname_configurations: Vec, + #[doc = "Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU."] + #[serde(rename = "publicIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_addresses: Vec, + #[doc = "Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU."] + #[serde(rename = "privateIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub private_ip_addresses: Vec, + #[doc = "Public Standard SKU IP V4 based IP address to be associated with Virtual Network deployed service in the region. Supported only for Developer and Premium SKU being deployed in Virtual Network."] + #[serde(rename = "publicIpAddressId", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_id: Option, + #[doc = "Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Configuration of a virtual network to which API Management service is deployed."] + #[serde(rename = "virtualNetworkConfiguration", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_configuration: Option, + #[doc = "Additional datacenter locations of the API Management service."] + #[serde(rename = "additionalLocations", default, skip_serializing_if = "Vec::is_empty")] + pub additional_locations: Vec, + #[doc = "Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384"] + #[serde(rename = "customProperties", default, skip_serializing_if = "Option::is_none")] + pub custom_properties: Option, + #[doc = "List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub certificates: Vec, + #[doc = "Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway."] + #[serde(rename = "enableClientCertificate", default, skip_serializing_if = "Option::is_none")] + pub enable_client_certificate: Option, + #[doc = "Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region."] + #[serde(rename = "disableGateway", default, skip_serializing_if = "Option::is_none")] + pub disable_gateway: Option, + #[doc = "The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only."] + #[serde(rename = "virtualNetworkType", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_type: Option, + #[doc = "Control Plane Apis version constraint for the API Management service."] + #[serde(rename = "apiVersionConstraint", default, skip_serializing_if = "Option::is_none")] + pub api_version_constraint: Option, + #[doc = "Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub restore: Option, + #[doc = "List of Private Endpoint Connections of this service."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Compute Platform Version running the service in this location."] + #[serde(rename = "platformVersion", default, skip_serializing_if = "Option::is_none")] + pub platform_version: Option, +} +impl ApiManagementServiceBaseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_management_service_base_properties { + use super::*; + #[doc = "Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } + #[doc = "The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VirtualNetworkType { + None, + External, + Internal, + } + impl Default for VirtualNetworkType { + fn default() -> Self { + Self::None + } + } + #[doc = "Compute Platform Version running the service in this location."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PlatformVersion { + #[serde(rename = "undetermined")] + Undetermined, + #[serde(rename = "stv1")] + Stv1, + #[serde(rename = "stv2")] + Stv2, + #[serde(rename = "mtv1")] + Mtv1, + } +} +#[doc = "Parameters supplied to the CheckNameAvailability operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceCheckNameAvailabilityParameters { + #[doc = "The name to check for availability."] + pub name: String, +} +impl ApiManagementServiceCheckNameAvailabilityParameters { + pub fn new(name: String) -> Self { + Self { name } + } +} +#[doc = "Response of the GetDomainOwnershipIdentifier operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceGetDomainOwnershipIdentifierResult { + #[doc = "The domain ownership identifier value."] + #[serde(rename = "domainOwnershipIdentifier", default, skip_serializing_if = "Option::is_none")] + pub domain_ownership_identifier: Option, +} +impl ApiManagementServiceGetDomainOwnershipIdentifierResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response of the GetSsoToken operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceGetSsoTokenResult { + #[doc = "Redirect URL to the Publisher Portal containing the SSO token."] + #[serde(rename = "redirectUri", default, skip_serializing_if = "Option::is_none")] + pub redirect_uri: Option, +} +impl ApiManagementServiceGetSsoTokenResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity properties of the Api Management service resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceIdentity { + #[doc = "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service."] + #[serde(rename = "type")] + pub type_: api_management_service_identity::Type, + #[doc = "The principal id of the identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client tenant id of the identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The list of user identities associated with the resource. The user identity \r\ndictionary key references will be ARM resource ids in the form: \r\n'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/\r\n providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ApiManagementServiceIdentity { + pub fn new(type_: api_management_service_identity::Type) -> Self { + Self { + type_, + principal_id: None, + tenant_id: None, + user_assigned_identities: None, + } + } +} +pub mod api_management_service_identity { + use super::*; + #[doc = "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[doc = "The response of the List API Management services operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceListResult { + #[doc = "Result of the List API Management services operation."] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if Value contains incomplete list of API Management services."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiManagementServiceListResult { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Response of the CheckNameAvailability operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceNameAvailabilityResult { + #[doc = "True if the name is available and can be used to create a new API Management service; otherwise false."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl ApiManagementServiceNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_management_service_name_availability_result { + use super::*; + #[doc = "Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Valid, + Invalid, + AlreadyExists, + } +} +#[doc = "Properties of an API Management service resource description."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceProperties { + #[serde(flatten)] + pub api_management_service_base_properties: ApiManagementServiceBaseProperties, + #[doc = "Publisher email."] + #[serde(rename = "publisherEmail")] + pub publisher_email: String, + #[doc = "Publisher name."] + #[serde(rename = "publisherName")] + pub publisher_name: String, +} +impl ApiManagementServiceProperties { + pub fn new(publisher_email: String, publisher_name: String) -> Self { + Self { + api_management_service_base_properties: ApiManagementServiceBaseProperties::default(), + publisher_email, + publisher_name, + } + } +} +#[doc = "A single API Management service resource in List or Get response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceResource { + #[serde(flatten)] + pub apim_resource: ApimResource, + #[doc = "Properties of an API Management service resource description."] + pub properties: ApiManagementServiceProperties, + #[doc = "API Management service resource SKU properties."] + pub sku: ApiManagementServiceSkuProperties, + #[doc = "Identity properties of the Api Management service resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Resource location."] + pub location: String, + #[doc = "ETag of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting where the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl ApiManagementServiceResource { + pub fn new(properties: ApiManagementServiceProperties, sku: ApiManagementServiceSkuProperties, location: String) -> Self { + Self { + apim_resource: ApimResource::default(), + properties, + sku, + identity: None, + system_data: None, + location, + etag: None, + zones: Vec::new(), + } + } +} +#[doc = "API Management service resource SKU properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementServiceSkuProperties { + #[doc = "Name of the Sku."] + pub name: api_management_service_sku_properties::Name, + #[doc = "Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0."] + pub capacity: i32, +} +impl ApiManagementServiceSkuProperties { + pub fn new(name: api_management_service_sku_properties::Name, capacity: i32) -> Self { + Self { name, capacity } + } +} +pub mod api_management_service_sku_properties { + use super::*; + #[doc = "Name of the Sku."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Developer, + Standard, + Premium, + Basic, + Consumption, + Isolated, + } +} +#[doc = "Parameter supplied to Update Api Management Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceUpdateParameters { + #[serde(flatten)] + pub apim_resource: ApimResource, + #[doc = "Properties of an API Management service resource description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "API Management service resource SKU properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Identity properties of the Api Management service resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "ETag of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting where the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl ApiManagementServiceUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of an API Management service resource description."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementServiceUpdateProperties { + #[serde(flatten)] + pub api_management_service_base_properties: ApiManagementServiceBaseProperties, + #[doc = "Publisher email."] + #[serde(rename = "publisherEmail", default, skip_serializing_if = "Option::is_none")] + pub publisher_email: Option, + #[doc = "Publisher name."] + #[serde(rename = "publisherName", default, skip_serializing_if = "Option::is_none")] + pub publisher_name: Option, +} +impl ApiManagementServiceUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes an available ApiManagement SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSku { + #[doc = "The type of resource the SKU applies to."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "The name of SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Specifies the tier of virtual machines in a scale set.

Possible Values:

**Standard**

**Basic**"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The Size of the SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[doc = "The Family of this particular SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[doc = "The Kind of resources that are supported in this SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Describes scaling information of a SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "The set of locations that the SKU is available."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "A list of locations and availability zones in those locations where the SKU is available."] + #[serde(rename = "locationInfo", default, skip_serializing_if = "Vec::is_empty")] + pub location_info: Vec, + #[doc = "The api versions that support this SKU."] + #[serde(rename = "apiVersions", default, skip_serializing_if = "Vec::is_empty")] + pub api_versions: Vec, + #[doc = "Metadata for retrieving price info."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub costs: Vec, + #[doc = "A name value pair to describe the capability."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[doc = "The restrictions because of which SKU cannot be used. This is empty if there are no restrictions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub restrictions: Vec, +} +impl ApiManagementSku { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes The SKU capabilities object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuCapabilities { + #[doc = "An invariant to describe the feature."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "An invariant if the feature is measured by quantity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl ApiManagementSkuCapabilities { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes scaling information of a SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuCapacity { + #[doc = "The minimum capacity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minimum: Option, + #[doc = "The maximum capacity that can be set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[doc = "The default capacity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[doc = "The scale type applicable to the sku."] + #[serde(rename = "scaleType", default, skip_serializing_if = "Option::is_none")] + pub scale_type: Option, +} +impl ApiManagementSkuCapacity { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_management_sku_capacity { + use super::*; + #[doc = "The scale type applicable to the sku."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScaleType { + Automatic, + Manual, + None, + } +} +#[doc = "Describes metadata for retrieving price info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuCosts { + #[doc = "Used for querying price from commerce."] + #[serde(rename = "meterID", default, skip_serializing_if = "Option::is_none")] + pub meter_id: Option, + #[doc = "The multiplier is needed to extend the base metered cost."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[doc = "An invariant to show the extended unit."] + #[serde(rename = "extendedUnit", default, skip_serializing_if = "Option::is_none")] + pub extended_unit: Option, +} +impl ApiManagementSkuCosts { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuLocationInfo { + #[doc = "Location of the SKU"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "List of availability zones where the SKU is supported."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "Details of capabilities available to a SKU in specific zones."] + #[serde(rename = "zoneDetails", default, skip_serializing_if = "Vec::is_empty")] + pub zone_details: Vec, +} +impl ApiManagementSkuLocationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuRestrictionInfo { + #[doc = "Locations where the SKU is restricted"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "List of availability zones where the SKU is restricted."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl ApiManagementSkuRestrictionInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes scaling information of a SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuRestrictions { + #[doc = "The type of restrictions."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[serde(rename = "restrictionInfo", default, skip_serializing_if = "Option::is_none")] + pub restriction_info: Option, + #[doc = "The reason for restriction."] + #[serde(rename = "reasonCode", default, skip_serializing_if = "Option::is_none")] + pub reason_code: Option, +} +impl ApiManagementSkuRestrictions { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_management_sku_restrictions { + use super::*; + #[doc = "The type of restrictions."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Location, + Zone, + } + #[doc = "The reason for restriction."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReasonCode { + QuotaId, + NotAvailableForSubscription, + } +} +#[doc = "Describes The zonal capabilities of a SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiManagementSkuZoneDetails { + #[doc = "The set of zones that the SKU is available in with the specified capabilities."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub name: Vec, + #[doc = "A list of capabilities that are available for the SKU in the specified list of zones."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, +} +impl ApiManagementSkuZoneDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List Resource Skus operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiManagementSkusResult { + #[doc = "The list of skus available for the subscription."] + pub value: Vec, + #[doc = "The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiManagementSkusResult { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Paged ApiRelease list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiReleaseCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiReleaseCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ApiRelease details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiReleaseContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "API Release details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiReleaseContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Release details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiReleaseContractProperties { + #[doc = "Identifier of the API the release belongs to."] + #[serde(rename = "apiId", default, skip_serializing_if = "Option::is_none")] + pub api_id: Option, + #[doc = "The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard."] + #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")] + pub created_date_time: Option, + #[doc = "The time the API release was updated."] + #[serde(rename = "updatedDateTime", default, skip_serializing_if = "Option::is_none")] + pub updated_date_time: Option, + #[doc = "Release Notes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub notes: Option, +} +impl ApiReleaseContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged API Revision list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiRevisionCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiRevisionCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Summary of revision metadata."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiRevisionContract { + #[doc = "Identifier of the API Revision."] + #[serde(rename = "apiId", default, skip_serializing_if = "Option::is_none")] + pub api_id: Option, + #[doc = "Revision number of API."] + #[serde(rename = "apiRevision", default, skip_serializing_if = "Option::is_none")] + pub api_revision: Option, + #[doc = "The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard."] + #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")] + pub created_date_time: Option, + #[doc = "The time the API Revision were updated. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard."] + #[serde(rename = "updatedDateTime", default, skip_serializing_if = "Option::is_none")] + pub updated_date_time: Option, + #[doc = "Description of the API Revision."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Gateway URL for accessing the non-current API Revision."] + #[serde(rename = "privateUrl", default, skip_serializing_if = "Option::is_none")] + pub private_url: Option, + #[doc = "Indicates if API revision is the current api revision."] + #[serde(rename = "isOnline", default, skip_serializing_if = "Option::is_none")] + pub is_online: Option, + #[doc = "Indicates if API revision is accessible via the gateway."] + #[serde(rename = "isCurrent", default, skip_serializing_if = "Option::is_none")] + pub is_current: Option, +} +impl ApiRevisionContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Object used to create an API Revision or Version based on an existing API Revision"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiRevisionInfoContract { + #[doc = "Resource identifier of API to be used to create the revision from."] + #[serde(rename = "sourceApiId", default, skip_serializing_if = "Option::is_none")] + pub source_api_id: Option, + #[doc = "Version identifier for the new API Version."] + #[serde(rename = "apiVersionName", default, skip_serializing_if = "Option::is_none")] + pub api_version_name: Option, + #[doc = "Description of new API Revision."] + #[serde(rename = "apiRevisionDescription", default, skip_serializing_if = "Option::is_none")] + pub api_revision_description: Option, + #[doc = "An API Version Set contains the common configuration for a set of API Versions relating "] + #[serde(rename = "apiVersionSet", default, skip_serializing_if = "Option::is_none")] + pub api_version_set: Option, +} +impl ApiRevisionInfoContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API contract properties for the Tag Resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiTagResourceContractProperties { + #[serde(flatten)] + pub api_entity_base_contract: ApiEntityBaseContract, + #[doc = "API identifier in the form /apis/{apiId}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "API name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Absolute URL of the backend service implementing this API."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Describes on which protocols the operations in this API can be invoked."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, +} +impl ApiTagResourceContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API update contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiUpdateContract { + #[doc = "API update contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Control Plane Apis version constraint for the API Management service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionConstraint { + #[doc = "Limit control plane API calls to API Management service with version equal to or newer than this value."] + #[serde(rename = "minApiVersion", default, skip_serializing_if = "Option::is_none")] + pub min_api_version: Option, +} +impl ApiVersionConstraint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged API Version Set list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiVersionSetCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Version Set Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of an API Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiVersionSetContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An API Version Set contains the common configuration for a set of API Versions relating "] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetContractDetails { + #[doc = "Identifier for existing API Version Set. Omit this value to create a new Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The display Name of the API Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of API Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[serde(rename = "versioningScheme", default, skip_serializing_if = "Option::is_none")] + pub versioning_scheme: Option, + #[doc = "Name of query parameter that indicates the API Version if versioningScheme is set to `query`."] + #[serde(rename = "versionQueryName", default, skip_serializing_if = "Option::is_none")] + pub version_query_name: Option, + #[doc = "Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`."] + #[serde(rename = "versionHeaderName", default, skip_serializing_if = "Option::is_none")] + pub version_header_name: Option, +} +impl ApiVersionSetContractDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_version_set_contract_details { + use super::*; + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VersioningScheme { + Segment, + Query, + Header, + } +} +#[doc = "Properties of an API Version Set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiVersionSetContractProperties { + #[serde(flatten)] + pub api_version_set_entity_base: ApiVersionSetEntityBase, + #[doc = "Name of API Version Set"] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[serde(rename = "versioningScheme")] + pub versioning_scheme: api_version_set_contract_properties::VersioningScheme, +} +impl ApiVersionSetContractProperties { + pub fn new(display_name: String, versioning_scheme: api_version_set_contract_properties::VersioningScheme) -> Self { + Self { + api_version_set_entity_base: ApiVersionSetEntityBase::default(), + display_name, + versioning_scheme, + } + } +} +pub mod api_version_set_contract_properties { + use super::*; + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VersioningScheme { + Segment, + Query, + Header, + } +} +#[doc = "API Version set base parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetEntityBase { + #[doc = "Description of API Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Name of query parameter that indicates the API Version if versioningScheme is set to `query`."] + #[serde(rename = "versionQueryName", default, skip_serializing_if = "Option::is_none")] + pub version_query_name: Option, + #[doc = "Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`."] + #[serde(rename = "versionHeaderName", default, skip_serializing_if = "Option::is_none")] + pub version_header_name: Option, +} +impl ApiVersionSetEntityBase { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to update or create an API Version Set Contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetUpdateParameters { + #[doc = "Properties used to create or update an API Version Set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApiVersionSetUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties used to create or update an API Version Set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiVersionSetUpdateParametersProperties { + #[serde(flatten)] + pub api_version_set_entity_base: ApiVersionSetEntityBase, + #[doc = "Name of API Version Set"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[serde(rename = "versioningScheme", default, skip_serializing_if = "Option::is_none")] + pub versioning_scheme: Option, +} +impl ApiVersionSetUpdateParametersProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_version_set_update_parameters_properties { + use super::*; + #[doc = "An value that determines where the API Version identifier will be located in a HTTP request."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VersioningScheme { + Segment, + Query, + Header, + } +} +#[doc = "The Resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApimResource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type for API Management resource is set to Microsoft.ApiManagement."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ApimResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A wrapper for an ARM resource id"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArmIdWrapper { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ArmIdWrapper { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Association entity details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AssociationContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Association entity contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AssociationContract { + pub fn new() -> Self { + Self::default() + } +} +pub mod association_contract { + use super::*; + #[doc = "Association entity contract properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "Provisioning state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + #[serde(rename = "created")] + Created, + } + } +} +#[doc = "API Authentication Settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthenticationSettingsContract { + #[doc = "API OAuth2 Authentication settings details."] + #[serde(rename = "oAuth2", default, skip_serializing_if = "Option::is_none")] + pub o_auth2: Option, + #[doc = "API OAuth2 Authentication settings details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub openid: Option, +} +impl AuthenticationSettingsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged OAuth2 Authorization Servers list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AuthorizationServerCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "External OAuth authorization server settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "External OAuth authorization server settings Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AuthorizationServerContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "External OAuth authorization server Update settings contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerContractBaseProperties { + #[doc = "Description of the authorization server. Can contain HTML formatting tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional."] + #[serde(rename = "authorizationMethods", default, skip_serializing_if = "Vec::is_empty")] + pub authorization_methods: Vec, + #[doc = "Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format."] + #[serde(rename = "clientAuthenticationMethod", default, skip_serializing_if = "Vec::is_empty")] + pub client_authentication_method: Vec, + #[doc = "Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {\"name\" : \"name value\", \"value\": \"a value\"}."] + #[serde(rename = "tokenBodyParameters", default, skip_serializing_if = "Vec::is_empty")] + pub token_body_parameters: Vec, + #[doc = "OAuth token endpoint. Contains absolute URI to entity being referenced."] + #[serde(rename = "tokenEndpoint", default, skip_serializing_if = "Option::is_none")] + pub token_endpoint: Option, + #[doc = "If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security."] + #[serde(rename = "supportState", default, skip_serializing_if = "Option::is_none")] + pub support_state: Option, + #[doc = "Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values."] + #[serde(rename = "defaultScope", default, skip_serializing_if = "Option::is_none")] + pub default_scope: Option, + #[doc = "Specifies the mechanism by which access token is passed to the API. "] + #[serde(rename = "bearerTokenSendingMethods", default, skip_serializing_if = "Vec::is_empty")] + pub bearer_token_sending_methods: Vec, + #[doc = "Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username."] + #[serde(rename = "resourceOwnerUsername", default, skip_serializing_if = "Option::is_none")] + pub resource_owner_username: Option, + #[doc = "Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password."] + #[serde(rename = "resourceOwnerPassword", default, skip_serializing_if = "Option::is_none")] + pub resource_owner_password: Option, +} +impl AuthorizationServerContractBaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "External OAuth authorization server settings Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthorizationServerContractProperties { + #[serde(flatten)] + pub authorization_server_contract_base_properties: AuthorizationServerContractBaseProperties, + #[doc = "User-friendly authorization server name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced."] + #[serde(rename = "clientRegistrationEndpoint")] + pub client_registration_endpoint: String, + #[doc = "OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2."] + #[serde(rename = "authorizationEndpoint")] + pub authorization_endpoint: String, + #[doc = "Form of an authorization grant, which the client uses to request the access token."] + #[serde(rename = "grantTypes")] + pub grant_types: Vec, + #[doc = "Client or app id registered with this authorization server."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl AuthorizationServerContractProperties { + pub fn new( + display_name: String, + client_registration_endpoint: String, + authorization_endpoint: String, + grant_types: Vec, + client_id: String, + ) -> Self { + Self { + authorization_server_contract_base_properties: AuthorizationServerContractBaseProperties::default(), + display_name, + client_registration_endpoint, + authorization_endpoint, + grant_types, + client_id, + client_secret: None, + } + } +} +#[doc = "OAuth Server Secrets Contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerSecretsContract { + #[doc = "oAuth Authorization Server Secrets."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username."] + #[serde(rename = "resourceOwnerUsername", default, skip_serializing_if = "Option::is_none")] + pub resource_owner_username: Option, + #[doc = "Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password."] + #[serde(rename = "resourceOwnerPassword", default, skip_serializing_if = "Option::is_none")] + pub resource_owner_password: Option, +} +impl AuthorizationServerSecretsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "External OAuth authorization server settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerUpdateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "External OAuth authorization server Update settings contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AuthorizationServerUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "External OAuth authorization server Update settings contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationServerUpdateContractProperties { + #[serde(flatten)] + pub authorization_server_contract_base_properties: AuthorizationServerContractBaseProperties, + #[doc = "User-friendly authorization server name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced."] + #[serde(rename = "clientRegistrationEndpoint", default, skip_serializing_if = "Option::is_none")] + pub client_registration_endpoint: Option, + #[doc = "OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2."] + #[serde(rename = "authorizationEndpoint", default, skip_serializing_if = "Option::is_none")] + pub authorization_endpoint: Option, + #[doc = "Form of an authorization grant, which the client uses to request the access token."] + #[serde(rename = "grantTypes", default, skip_serializing_if = "Vec::is_empty")] + pub grant_types: Vec, + #[doc = "Client or app id registered with this authorization server."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl AuthorizationServerUpdateContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authorization header information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackendAuthorizationHeaderCredentials { + #[doc = "Authentication Scheme name."] + pub scheme: String, + #[doc = "Authentication Parameter value."] + pub parameter: String, +} +impl BackendAuthorizationHeaderCredentials { + pub fn new(scheme: String, parameter: String) -> Self { + Self { scheme, parameter } + } +} +#[doc = "Backend entity base Parameter set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendBaseParameters { + #[doc = "Backend Title."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Backend Description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Properties specific to the Backend Type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Details of the Credentials used to connect to Backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[doc = "Details of the Backend WebProxy Server to use in the Request to Backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub proxy: Option, + #[doc = "Properties controlling TLS Certificate Validation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tls: Option, +} +impl BackendBaseParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Backend list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendCollection { + #[doc = "Backend values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BackendCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backend details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters supplied to the Create Backend operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackendContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Create Backend operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackendContractProperties { + #[serde(flatten)] + pub backend_base_parameters: BackendBaseParameters, + #[doc = "Runtime Url of the Backend."] + pub url: String, + #[doc = "Backend communication protocol."] + pub protocol: backend_contract_properties::Protocol, +} +impl BackendContractProperties { + pub fn new(url: String, protocol: backend_contract_properties::Protocol) -> Self { + Self { + backend_base_parameters: BackendBaseParameters::default(), + url, + protocol, + } + } +} +pub mod backend_contract_properties { + use super::*; + #[doc = "Backend communication protocol."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "http")] + Http, + #[serde(rename = "soap")] + Soap, + } +} +#[doc = "Details of the Credentials used to connect to Backend."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendCredentialsContract { + #[doc = "List of Client Certificate Ids."] + #[serde(rename = "certificateIds", default, skip_serializing_if = "Vec::is_empty")] + pub certificate_ids: Vec, + #[doc = "List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub certificate: Vec, + #[doc = "Query Parameter description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Header Parameter description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub header: Option, + #[doc = "Authorization header information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authorization: Option, +} +impl BackendCredentialsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties specific to the Backend Type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendProperties { + #[doc = "Properties of the Service Fabric Type Backend."] + #[serde(rename = "serviceFabricCluster", default, skip_serializing_if = "Option::is_none")] + pub service_fabric_cluster: Option, +} +impl BackendProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of the Backend WebProxy Server to use in the Request to Backend."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackendProxyContract { + #[doc = "WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings."] + pub url: String, + #[doc = "Username to connect to the WebProxy server"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "Password to connect to the WebProxy Server"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl BackendProxyContract { + pub fn new(url: String) -> Self { + Self { + url, + username: None, + password: None, + } + } +} +#[doc = "Reconnect request parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendReconnectContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties to control reconnect requests."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackendReconnectContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties to control reconnect requests."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendReconnectProperties { + #[doc = "Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub after: Option, +} +impl BackendReconnectProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Service Fabric Type Backend."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackendServiceFabricClusterProperties { + #[doc = "The client certificate id for the management endpoint."] + #[serde(rename = "clientCertificateId", default, skip_serializing_if = "Option::is_none")] + pub client_certificate_id: Option, + #[doc = "The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided"] + #[serde(rename = "clientCertificatethumbprint", default, skip_serializing_if = "Option::is_none")] + pub client_certificatethumbprint: Option, + #[doc = "Maximum number of retries while attempting resolve the partition."] + #[serde(rename = "maxPartitionResolutionRetries", default, skip_serializing_if = "Option::is_none")] + pub max_partition_resolution_retries: Option, + #[doc = "The cluster management endpoint."] + #[serde(rename = "managementEndpoints")] + pub management_endpoints: Vec, + #[doc = "Thumbprints of certificates cluster management service uses for tls communication"] + #[serde(rename = "serverCertificateThumbprints", default, skip_serializing_if = "Vec::is_empty")] + pub server_certificate_thumbprints: Vec, + #[doc = "Server X509 Certificate Names Collection"] + #[serde(rename = "serverX509Names", default, skip_serializing_if = "Vec::is_empty")] + pub server_x509_names: Vec, +} +impl BackendServiceFabricClusterProperties { + pub fn new(management_endpoints: Vec) -> Self { + Self { + client_certificate_id: None, + client_certificatethumbprint: None, + max_partition_resolution_retries: None, + management_endpoints, + server_certificate_thumbprints: Vec::new(), + server_x509_names: Vec::new(), + } + } +} +#[doc = "Properties controlling TLS Certificate Validation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendTlsProperties { + #[doc = "Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host."] + #[serde(rename = "validateCertificateChain", default, skip_serializing_if = "Option::is_none")] + pub validate_certificate_chain: Option, + #[doc = "Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host."] + #[serde(rename = "validateCertificateName", default, skip_serializing_if = "Option::is_none")] + pub validate_certificate_name: Option, +} +impl BackendTlsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Backend operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendUpdateParameterProperties { + #[serde(flatten)] + pub backend_base_parameters: BackendBaseParameters, + #[doc = "Runtime Url of the Backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "Backend communication protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, +} +impl BackendUpdateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod backend_update_parameter_properties { + use super::*; + #[doc = "Backend communication protocol."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "http")] + Http, + #[serde(rename = "soap")] + Soap, + } +} +#[doc = "Backend update parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendUpdateParameters { + #[doc = "Parameters supplied to the Update Backend operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackendUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Form of an authorization grant, which the client uses to request the access token."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BearerTokenSendingMethodsContract { + #[serde(rename = "authorizationHeader")] + AuthorizationHeader, + #[serde(rename = "query")] + Query, +} +#[doc = "Body logging settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BodyDiagnosticSettings { + #[doc = "Number of request body bytes to log."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bytes: Option, +} +impl BodyDiagnosticSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Caches list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CacheCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl CacheCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cache details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CacheContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Cache contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CacheContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Cache contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CacheContractProperties { + #[doc = "Cache description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Runtime connection string to cache"] + #[serde(rename = "connectionString")] + pub connection_string: String, + #[doc = "Location identifier to use cache from (should be either 'default' or valid Azure region identifier)"] + #[serde(rename = "useFromLocation")] + pub use_from_location: String, + #[doc = "Original uri of entity in external system cache points to"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl CacheContractProperties { + pub fn new(connection_string: String, use_from_location: String) -> Self { + Self { + description: None, + connection_string, + use_from_location, + resource_id: None, + } + } +} +#[doc = "Cache update details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CacheUpdateParameters { + #[doc = "Parameters supplied to the Update Cache operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CacheUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Cache operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CacheUpdateProperties { + #[doc = "Cache description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Runtime connection string to cache"] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Location identifier to use cache from (should be either 'default' or valid Azure region identifier)"] + #[serde(rename = "useFromLocation", default, skip_serializing_if = "Option::is_none")] + pub use_from_location: Option, + #[doc = "Original uri of entity in external system cache points to"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl CacheUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Certificates list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl CertificateCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Certificate configuration which consist of non-trusted intermediates and root certificates."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateConfiguration { + #[doc = "Base64 Encoded certificate."] + #[serde(rename = "encodedCertificate", default, skip_serializing_if = "Option::is_none")] + pub encoded_certificate: Option, + #[doc = "Certificate Password."] + #[serde(rename = "certificatePassword", default, skip_serializing_if = "Option::is_none")] + pub certificate_password: Option, + #[doc = "The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations."] + #[serde(rename = "storeName")] + pub store_name: certificate_configuration::StoreName, + #[doc = "SSL certificate information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, +} +impl CertificateConfiguration { + pub fn new(store_name: certificate_configuration::StoreName) -> Self { + Self { + encoded_certificate: None, + certificate_password: None, + store_name, + certificate: None, + } + } +} +pub mod certificate_configuration { + use super::*; + #[doc = "The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StoreName { + CertificateAuthority, + Root, + } +} +#[doc = "Certificate details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Certificate contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CertificateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Certificate contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateContractProperties { + #[doc = "Subject attribute of the certificate."] + pub subject: String, + #[doc = "Thumbprint of the certificate."] + pub thumbprint: String, + #[doc = "Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "expirationDate")] + pub expiration_date: String, + #[doc = "KeyVault contract details."] + #[serde(rename = "keyVault", default, skip_serializing_if = "Option::is_none")] + pub key_vault: Option, +} +impl CertificateContractProperties { + pub fn new(subject: String, thumbprint: String, expiration_date: String) -> Self { + Self { + subject, + thumbprint, + expiration_date, + key_vault: None, + } + } +} +#[doc = "Certificate create or update details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateCreateOrUpdateParameters { + #[doc = "Parameters supplied to the CreateOrUpdate certificate operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CertificateCreateOrUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the CreateOrUpdate certificate operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateCreateOrUpdateProperties { + #[doc = "Base 64 encoded certificate using the application/x-pkcs12 representation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "Password for the Certificate"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Create keyVault contract details."] + #[serde(rename = "keyVault", default, skip_serializing_if = "Option::is_none")] + pub key_vault: Option, +} +impl CertificateCreateOrUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SSL certificate information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateInformation { + #[doc = "Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard."] + pub expiry: String, + #[doc = "Thumbprint of the certificate."] + pub thumbprint: String, + #[doc = "Subject of the certificate."] + pub subject: String, +} +impl CertificateInformation { + pub fn new(expiry: String, thumbprint: String, subject: String) -> Self { + Self { + expiry, + thumbprint, + subject, + } + } +} +#[doc = "Client or app secret used in IdentityProviders, Aad, OpenID or OAuth."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientSecretContract { + #[doc = "Client or app secret used in IdentityProviders, Aad, OpenID or OAuth."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl ClientSecretContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A request to perform the connectivity check operation on a API Management service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectivityCheckRequest { + #[doc = "Definitions about the connectivity check origin."] + pub source: connectivity_check_request::Source, + #[doc = "The connectivity check operation destination."] + pub destination: connectivity_check_request::Destination, + #[doc = "The IP version to be used. Only IPv4 is supported for now."] + #[serde(rename = "preferredIPVersion", default, skip_serializing_if = "Option::is_none")] + pub preferred_ip_version: Option, + #[doc = "The request's protocol. Specific protocol configuration can be available based on this selection. The specified destination address must be coherent with this value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Protocol-specific configuration."] + #[serde(rename = "protocolConfiguration", default, skip_serializing_if = "Option::is_none")] + pub protocol_configuration: Option, +} +impl ConnectivityCheckRequest { + pub fn new(source: connectivity_check_request::Source, destination: connectivity_check_request::Destination) -> Self { + Self { + source, + destination, + preferred_ip_version: None, + protocol: None, + protocol_configuration: None, + } + } +} +pub mod connectivity_check_request { + use super::*; + #[doc = "Definitions about the connectivity check origin."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Source { + #[doc = "The API Management service region from where to start the connectivity check operation."] + pub region: String, + #[doc = "The particular VMSS instance from which to fire the request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Option, + } + impl Source { + pub fn new(region: String) -> Self { + Self { region, instance: None } + } + } + #[doc = "The connectivity check operation destination."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Destination { + #[doc = "Destination address. Can either be an IP address or a FQDN."] + pub address: String, + #[doc = "Destination port."] + pub port: i64, + } + impl Destination { + pub fn new(address: String, port: i64) -> Self { + Self { address, port } + } + } + #[doc = "The IP version to be used. Only IPv4 is supported for now."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PreferredIpVersion { + IPv4, + } + #[doc = "The request's protocol. Specific protocol configuration can be available based on this selection. The specified destination address must be coherent with this value."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "HTTP")] + Http, + #[serde(rename = "HTTPS")] + Https, + } + #[doc = "Protocol-specific configuration."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ProtocolConfiguration { + #[doc = "Configuration for HTTP or HTTPS requests."] + #[serde(rename = "HTTPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub http_configuration: Option, + } + impl ProtocolConfiguration { + pub fn new() -> Self { + Self::default() + } + } + pub mod protocol_configuration { + use super::*; + #[doc = "Configuration for HTTP or HTTPS requests."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct HttpConfiguration { + #[doc = "The HTTP method to be used."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "List of HTTP status codes considered valid for the request response."] + #[serde(rename = "validStatusCodes", default, skip_serializing_if = "Vec::is_empty")] + pub valid_status_codes: Vec, + #[doc = "List of headers to be included in the request."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + } + impl HttpConfiguration { + pub fn new() -> Self { + Self::default() + } + } + pub mod http_configuration { + use super::*; + #[doc = "The HTTP method to be used."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Method { + #[serde(rename = "GET")] + Get, + #[serde(rename = "POST")] + Post, + } + } + } +} +#[doc = "Information on the connectivity status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityCheckResponse { + #[doc = "List of hops between the source and the destination."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hops: Vec, + #[doc = "The connection status."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Average latency in milliseconds."] + #[serde(rename = "avgLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub avg_latency_in_ms: Option, + #[doc = "Minimum latency in milliseconds."] + #[serde(rename = "minLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub min_latency_in_ms: Option, + #[doc = "Maximum latency in milliseconds."] + #[serde(rename = "maxLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub max_latency_in_ms: Option, + #[doc = "Total number of probes sent."] + #[serde(rename = "probesSent", default, skip_serializing_if = "Option::is_none")] + pub probes_sent: Option, + #[doc = "Number of failed probes."] + #[serde(rename = "probesFailed", default, skip_serializing_if = "Option::is_none")] + pub probes_failed: Option, +} +impl ConnectivityCheckResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod connectivity_check_response { + use super::*; + #[doc = "The connection status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionStatus { + Unknown, + Connected, + Disconnected, + Degraded, + } +} +#[doc = "Information about a hop between the source and the destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityHop { + #[doc = "The type of the hop."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The ID of the hop."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The IP address of the hop."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "The ID of the resource corresponding to this hop."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "List of next hop identifiers."] + #[serde(rename = "nextHopIds", default, skip_serializing_if = "Vec::is_empty")] + pub next_hop_ids: Vec, + #[doc = "List of issues."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub issues: Vec, +} +impl ConnectivityHop { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about an issue encountered in the process of checking for connectivity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityIssue { + #[doc = "The origin of the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The severity of the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "The type of issue."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Provides additional context on the issue."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub context: Vec, +} +impl ConnectivityIssue { + pub fn new() -> Self { + Self::default() + } +} +pub mod connectivity_issue { + use super::*; + #[doc = "The origin of the issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + Local, + Inbound, + Outbound, + } + #[doc = "The severity of the issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + Error, + Warning, + } + #[doc = "The type of issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Unknown, + AgentStopped, + GuestFirewall, + DnsResolution, + SocketBind, + NetworkSecurityRule, + UserDefinedRoute, + PortThrottled, + Platform, + } +} +#[doc = "Details about connectivity to a resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectivityStatusContract { + #[doc = "The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon."] + pub name: String, + #[doc = "Resource Connectivity Status Type identifier."] + pub status: connectivity_status_contract::Status, + #[doc = "Error details of the connectivity to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "The date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "lastUpdated")] + pub last_updated: String, + #[doc = "The date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "lastStatusChange")] + pub last_status_change: String, + #[doc = "Resource Type."] + #[serde(rename = "resourceType")] + pub resource_type: String, + #[doc = "Whether this is optional."] + #[serde(rename = "isOptional")] + pub is_optional: bool, +} +impl ConnectivityStatusContract { + pub fn new( + name: String, + status: connectivity_status_contract::Status, + last_updated: String, + last_status_change: String, + resource_type: String, + is_optional: bool, + ) -> Self { + Self { + name, + status, + error: None, + last_updated, + last_status_change, + resource_type, + is_optional, + } + } +} +pub mod connectivity_status_contract { + use super::*; + #[doc = "Resource Connectivity Status Type identifier."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "initializing")] + Initializing, + #[serde(rename = "success")] + Success, + #[serde(rename = "failure")] + Failure, + } +} +#[doc = "Paged list of content items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentItemCollection { + #[doc = "Collection of content items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ContentItemCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Content type contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentItemContract { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ContentItemContract { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentItemContractProperties {} +impl ContentItemContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged list of content types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentTypeCollection { + #[doc = "Collection of content types."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ContentTypeCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Content type contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentTypeContract { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ContentTypeContract { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContentTypeContractProperties { + #[doc = "Content type identifier"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Content type name. Must be 1 to 250 characters long."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Content type description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Content type schema."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "Content type version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl ContentTypeContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataMasking { + #[doc = "Masking settings for Url query parameters"] + #[serde(rename = "queryParams", default, skip_serializing_if = "Vec::is_empty")] + pub query_params: Vec, + #[doc = "Masking settings for headers"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, +} +impl DataMasking { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataMaskingEntity { + #[doc = "The name of an entity to mask (e.g. a name of a header or a query parameter)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Data masking mode."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, +} +impl DataMaskingEntity { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_masking_entity { + use super::*; + #[doc = "Data masking mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + Mask, + Hide, + } +} +#[doc = "Deleted API Management Service information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeletedServiceContract { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "API Management Service Master Location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl DeletedServiceContract { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeletedServiceContractProperties { + #[doc = "Fully-qualified API Management Service Resource ID"] + #[serde(rename = "serviceId", default, skip_serializing_if = "Option::is_none")] + pub service_id: Option, + #[doc = "UTC Date and Time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard."] + #[serde(rename = "scheduledPurgeDate", default, skip_serializing_if = "Option::is_none")] + pub scheduled_purge_date: Option, + #[doc = "UTC Timestamp when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard."] + #[serde(rename = "deletionDate", default, skip_serializing_if = "Option::is_none")] + pub deletion_date: Option, +} +impl DeletedServiceContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged deleted API Management Services List Representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeletedServicesCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeletedServicesCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Deploy Configuration operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeployConfigurationParameterProperties { + #[doc = "The name of the Git branch from which the configuration is to be deployed to the configuration database."] + pub branch: String, + #[doc = "The value enforcing deleting subscriptions to products that are deleted in this update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +impl DeployConfigurationParameterProperties { + pub fn new(branch: String) -> Self { + Self { branch, force: None } + } +} +#[doc = "Deploy Tenant Configuration Contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeployConfigurationParameters { + #[doc = "Parameters supplied to the Deploy Configuration operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DeployConfigurationParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Diagnostic list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiagnosticCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DiagnosticCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Diagnostic details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiagnosticContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Diagnostic Entity Properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DiagnosticContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Diagnostic Entity Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticContractProperties { + #[doc = "Specifies for what type of messages sampling settings should not apply."] + #[serde(rename = "alwaysLog", default, skip_serializing_if = "Option::is_none")] + pub always_log: Option, + #[doc = "Resource Id of a target logger."] + #[serde(rename = "loggerId")] + pub logger_id: String, + #[doc = "Sampling settings for Diagnostic."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sampling: Option, + #[doc = "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub frontend: Option, + #[doc = "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub backend: Option, + #[doc = "Log the ClientIP. Default is false."] + #[serde(rename = "logClientIp", default, skip_serializing_if = "Option::is_none")] + pub log_client_ip: Option, + #[doc = "Sets correlation protocol to use for Application Insights diagnostics."] + #[serde(rename = "httpCorrelationProtocol", default, skip_serializing_if = "Option::is_none")] + pub http_correlation_protocol: Option, + #[doc = "The verbosity level applied to traces emitted by trace policies."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub verbosity: Option, + #[doc = "The format of the Operation Name for Application Insights telemetries. Default is Name."] + #[serde(rename = "operationNameFormat", default, skip_serializing_if = "Option::is_none")] + pub operation_name_format: Option, +} +impl DiagnosticContractProperties { + pub fn new(logger_id: String) -> Self { + Self { + always_log: None, + logger_id, + sampling: None, + frontend: None, + backend: None, + log_client_ip: None, + http_correlation_protocol: None, + verbosity: None, + operation_name_format: None, + } + } +} +pub mod diagnostic_contract_properties { + use super::*; + #[doc = "Specifies for what type of messages sampling settings should not apply."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AlwaysLog { + #[serde(rename = "allErrors")] + AllErrors, + } + #[doc = "Sets correlation protocol to use for Application Insights diagnostics."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HttpCorrelationProtocol { + None, + Legacy, + #[serde(rename = "W3C")] + W3c, + } + #[doc = "The verbosity level applied to traces emitted by trace policies."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Verbosity { + #[serde(rename = "verbose")] + Verbose, + #[serde(rename = "information")] + Information, + #[serde(rename = "error")] + Error, + } + #[doc = "The format of the Operation Name for Application Insights telemetries. Default is Name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationNameFormat { + Name, + Url, + } +} +#[doc = "Paged email template list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EmailTemplateCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EmailTemplateCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Email Template details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EmailTemplateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Email Template Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EmailTemplateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Email Template Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EmailTemplateContractProperties { + #[doc = "Subject of the Template."] + pub subject: String, + #[doc = "Email Template Body. This should be a valid XDocument"] + pub body: String, + #[doc = "Title of the Template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Description of the Email Template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Whether the template is the default template provided by API Management or has been edited."] + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + #[doc = "Email Template Parameter values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, +} +impl EmailTemplateContractProperties { + pub fn new(subject: String, body: String) -> Self { + Self { + subject, + body, + title: None, + description: None, + is_default: None, + parameters: Vec::new(), + } + } +} +#[doc = "Email Template Parameter contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EmailTemplateParametersContractProperties { + #[doc = "Template parameter name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Template parameter title."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Template parameter description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl EmailTemplateParametersContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Email Template Update Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EmailTemplateUpdateParameterProperties { + #[doc = "Subject of the Template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[doc = "Title of the Template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Description of the Email Template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Email Template Body. This should be a valid XDocument"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[doc = "Email Template Parameter values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, +} +impl EmailTemplateUpdateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Email Template update Parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EmailTemplateUpdateParameters { + #[doc = "Email Template Update Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EmailTemplateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A domain name that a service is reached at."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDependency { + #[doc = "The domain name of the dependency."] + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[doc = "The Ports used when connecting to DomainName."] + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +impl EndpointDependency { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Current TCP connectivity information from the Api Management Service to a single endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDetail { + #[doc = "The port an endpoint is connected to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The region of the dependency."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, +} +impl EndpointDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error Field contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorFieldContract { + #[doc = "Property level error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Human-readable representation of property-level error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Property name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl ErrorFieldContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error Response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Error Body contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error Body contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponseBody { + #[doc = "Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Human-readable representation of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The list of invalid fields send in request, in case of validation error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorResponseBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Gateway certificate authority list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayCertificateAuthorityCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GatewayCertificateAuthorityCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway certificate authority details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayCertificateAuthorityContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Gateway certificate authority details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GatewayCertificateAuthorityContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway certificate authority details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayCertificateAuthorityContractProperties { + #[doc = "Determines whether certificate authority is trusted."] + #[serde(rename = "isTrusted", default, skip_serializing_if = "Option::is_none")] + pub is_trusted: Option, +} +impl GatewayCertificateAuthorityContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Gateway list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GatewayCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Gateway contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GatewayContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Gateway contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayContractProperties { + #[doc = "Resource location data properties."] + #[serde(rename = "locationData", default, skip_serializing_if = "Option::is_none")] + pub location_data: Option, + #[doc = "Gateway description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl GatewayContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Gateway hostname configuration list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayHostnameConfigurationCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GatewayHostnameConfigurationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway hostname configuration details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayHostnameConfigurationContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Gateway hostname configuration details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GatewayHostnameConfigurationContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway hostname configuration details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayHostnameConfigurationContractProperties { + #[doc = "Hostname value. Supports valid domain name, partial or full wildcard"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hostname: Option, + #[doc = "Identifier of Certificate entity that will be used for TLS connection establishment"] + #[serde(rename = "certificateId", default, skip_serializing_if = "Option::is_none")] + pub certificate_id: Option, + #[doc = "Determines whether gateway requests client certificate"] + #[serde(rename = "negotiateClientCertificate", default, skip_serializing_if = "Option::is_none")] + pub negotiate_client_certificate: Option, + #[doc = "Specifies if TLS 1.0 is supported"] + #[serde(rename = "tls10Enabled", default, skip_serializing_if = "Option::is_none")] + pub tls10_enabled: Option, + #[doc = "Specifies if TLS 1.1 is supported"] + #[serde(rename = "tls11Enabled", default, skip_serializing_if = "Option::is_none")] + pub tls11_enabled: Option, + #[doc = "Specifies if HTTP/2.0 is supported"] + #[serde(rename = "http2Enabled", default, skip_serializing_if = "Option::is_none")] + pub http2_enabled: Option, +} +impl GatewayHostnameConfigurationContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway key regeneration request contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayKeyRegenerationRequestContract { + #[doc = "The Key being regenerated."] + #[serde(rename = "keyType")] + pub key_type: gateway_key_regeneration_request_contract::KeyType, +} +impl GatewayKeyRegenerationRequestContract { + pub fn new(key_type: gateway_key_regeneration_request_contract::KeyType) -> Self { + Self { key_type } + } +} +pub mod gateway_key_regeneration_request_contract { + use super::*; + #[doc = "The Key being regenerated."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + } +} +#[doc = "Gateway authentication keys."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayKeysContract { + #[doc = "Primary gateway key."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[doc = "Secondary gateway key."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secondary: Option, +} +impl GatewayKeysContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway access token."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayTokenContract { + #[doc = "Shared Access Authentication token value for the Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl GatewayTokenContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway token request contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayTokenRequestContract { + #[doc = "The Key to be used to generate gateway token."] + #[serde(rename = "keyType")] + pub key_type: gateway_token_request_contract::KeyType, + #[doc = "The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + pub expiry: String, +} +impl GatewayTokenRequestContract { + pub fn new(key_type: gateway_token_request_contract::KeyType, expiry: String) -> Self { + Self { key_type, expiry } + } +} +pub mod gateway_token_request_contract { + use super::*; + #[doc = "The Key to be used to generate gateway token."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + } + impl Default for KeyType { + fn default() -> Self { + Self::Primary + } + } +} +#[doc = "Generate SSO Url operations response details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GenerateSsoUrlResult { + #[doc = "Redirect Url containing the SSO URL value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl GenerateSsoUrlResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response of the list schema operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GlobalSchemaCollection { + #[doc = "Global Schema Contract value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GlobalSchemaCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Global Schema Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GlobalSchemaContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Schema create or update contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GlobalSchemaContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Schema create or update contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlobalSchemaContractProperties { + #[doc = "Schema Type. Immutable."] + #[serde(rename = "schemaType")] + pub schema_type: global_schema_contract_properties::SchemaType, + #[doc = "Free-form schema entity description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Json-encoded string for non json-based schema."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Global Schema Document Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub document: Option, +} +impl GlobalSchemaContractProperties { + pub fn new(schema_type: global_schema_contract_properties::SchemaType) -> Self { + Self { + schema_type, + description: None, + value: None, + document: None, + } + } +} +pub mod global_schema_contract_properties { + use super::*; + #[doc = "Schema Type. Immutable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SchemaType { + #[serde(rename = "xml")] + Xml, + #[serde(rename = "json")] + Json, + } +} +#[doc = "Global Schema Document Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GlobalSchemaDocumentProperties {} +impl GlobalSchemaDocumentProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Group list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GroupCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GroupCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GroupContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Group contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GroupContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Group contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupContractProperties { + #[doc = "Group name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Group description. Can contain HTML formatting tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false."] + #[serde(rename = "builtIn", default, skip_serializing_if = "Option::is_none")] + pub built_in: Option, + #[doc = "Group type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null."] + #[serde(rename = "externalId", default, skip_serializing_if = "Option::is_none")] + pub external_id: Option, +} +impl GroupContractProperties { + pub fn new(display_name: String) -> Self { + Self { + display_name, + description: None, + built_in: None, + type_: None, + external_id: None, + } + } +} +pub mod group_contract_properties { + use super::*; + #[doc = "Group type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "custom")] + Custom, + #[serde(rename = "system")] + System, + #[serde(rename = "external")] + External, + } +} +#[doc = "Parameters supplied to the Create Group operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GroupCreateParameters { + #[doc = "Parameters supplied to the Create Group operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GroupCreateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Create Group operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupCreateParametersProperties { + #[doc = "Group name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Group description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Group type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null."] + #[serde(rename = "externalId", default, skip_serializing_if = "Option::is_none")] + pub external_id: Option, +} +impl GroupCreateParametersProperties { + pub fn new(display_name: String) -> Self { + Self { + display_name, + description: None, + type_: None, + external_id: None, + } + } +} +pub mod group_create_parameters_properties { + use super::*; + #[doc = "Group type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "custom")] + Custom, + #[serde(rename = "system")] + System, + #[serde(rename = "external")] + External, + } +} +#[doc = "Parameters supplied to the Update Group operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GroupUpdateParameters { + #[doc = "Parameters supplied to the Update Group operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GroupUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Group operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GroupUpdateParametersProperties { + #[doc = "Group name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Group description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Group type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null."] + #[serde(rename = "externalId", default, skip_serializing_if = "Option::is_none")] + pub external_id: Option, +} +impl GroupUpdateParametersProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod group_update_parameters_properties { + use super::*; + #[doc = "Group type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "custom")] + Custom, + #[serde(rename = "system")] + System, + #[serde(rename = "external")] + External, + } +} +#[doc = "HTTP header and it's value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpHeader { + #[doc = "Header name."] + pub name: String, + #[doc = "Header value."] + pub value: String, +} +impl HttpHeader { + pub fn new(name: String, value: String) -> Self { + Self { name, value } + } +} +#[doc = "Custom hostname configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HostnameConfiguration { + #[doc = "Hostname type."] + #[serde(rename = "type")] + pub type_: hostname_configuration::Type, + #[doc = "Hostname to configure on the Api Management service."] + #[serde(rename = "hostName")] + pub host_name: String, + #[doc = "Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with aka.ms/apimmsi. The secret should be of type *application/x-pkcs12*"] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[doc = "System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate."] + #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] + pub identity_client_id: Option, + #[doc = "Base64 Encoded certificate."] + #[serde(rename = "encodedCertificate", default, skip_serializing_if = "Option::is_none")] + pub encoded_certificate: Option, + #[doc = "Certificate Password."] + #[serde(rename = "certificatePassword", default, skip_serializing_if = "Option::is_none")] + pub certificate_password: Option, + #[doc = "Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type."] + #[serde(rename = "defaultSslBinding", default, skip_serializing_if = "Option::is_none")] + pub default_ssl_binding: Option, + #[doc = "Specify true to always negotiate client certificate on the hostname. Default Value is false."] + #[serde(rename = "negotiateClientCertificate", default, skip_serializing_if = "Option::is_none")] + pub negotiate_client_certificate: Option, + #[doc = "SSL certificate information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, + #[doc = "Certificate Source."] + #[serde(rename = "certificateSource", default, skip_serializing_if = "Option::is_none")] + pub certificate_source: Option, + #[doc = "Certificate Status."] + #[serde(rename = "certificateStatus", default, skip_serializing_if = "Option::is_none")] + pub certificate_status: Option, +} +impl HostnameConfiguration { + pub fn new(type_: hostname_configuration::Type, host_name: String) -> Self { + Self { + type_, + host_name, + key_vault_id: None, + identity_client_id: None, + encoded_certificate: None, + certificate_password: None, + default_ssl_binding: None, + negotiate_client_certificate: None, + certificate: None, + certificate_source: None, + certificate_status: None, + } + } +} +pub mod hostname_configuration { + use super::*; + #[doc = "Hostname type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Proxy, + Portal, + Management, + Scm, + DeveloperPortal, + } + #[doc = "Certificate Source."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CertificateSource { + Managed, + KeyVault, + Custom, + BuiltIn, + } + #[doc = "Certificate Status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CertificateStatus { + Completed, + Failed, + InProgress, + } +} +#[doc = "Http message diagnostic settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HttpMessageDiagnostic { + #[doc = "Array of HTTP Headers to log."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + #[doc = "Body logging settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[serde(rename = "dataMasking", default, skip_serializing_if = "Option::is_none")] + pub data_masking: Option, +} +impl HttpMessageDiagnostic { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity Provider Base Parameter Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderBaseParameters { + #[doc = "Identity Provider Type identifier."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The TenantId to use instead of Common when logging into Active Directory"] + #[serde(rename = "signinTenant", default, skip_serializing_if = "Option::is_none")] + pub signin_tenant: Option, + #[doc = "List of Allowed Tenants when configuring Azure Active Directory login."] + #[serde(rename = "allowedTenants", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_tenants: Vec, + #[doc = "OpenID Connect discovery endpoint hostname for AAD or AAD B2C."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[doc = "Signup Policy Name. Only applies to AAD B2C Identity Provider."] + #[serde(rename = "signupPolicyName", default, skip_serializing_if = "Option::is_none")] + pub signup_policy_name: Option, + #[doc = "Signin Policy Name. Only applies to AAD B2C Identity Provider."] + #[serde(rename = "signinPolicyName", default, skip_serializing_if = "Option::is_none")] + pub signin_policy_name: Option, + #[doc = "Profile Editing Policy Name. Only applies to AAD B2C Identity Provider."] + #[serde(rename = "profileEditingPolicyName", default, skip_serializing_if = "Option::is_none")] + pub profile_editing_policy_name: Option, + #[doc = "Password Reset Policy Name. Only applies to AAD B2C Identity Provider."] + #[serde(rename = "passwordResetPolicyName", default, skip_serializing_if = "Option::is_none")] + pub password_reset_policy_name: Option, + #[doc = "The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider."] + #[serde(rename = "clientLibrary", default, skip_serializing_if = "Option::is_none")] + pub client_library: Option, +} +impl IdentityProviderBaseParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod identity_provider_base_parameters { + use super::*; + #[doc = "Identity Provider Type identifier."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "facebook")] + Facebook, + #[serde(rename = "google")] + Google, + #[serde(rename = "microsoft")] + Microsoft, + #[serde(rename = "twitter")] + Twitter, + #[serde(rename = "aad")] + Aad, + #[serde(rename = "aadB2C")] + AadB2c, + } +} +#[doc = "Identity Provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IdentityProviderContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProviderContractProperties { + #[serde(flatten)] + pub identity_provider_base_parameters: IdentityProviderBaseParameters, + #[doc = "Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl IdentityProviderContractProperties { + pub fn new(client_id: String) -> Self { + Self { + identity_provider_base_parameters: IdentityProviderBaseParameters::default(), + client_id, + client_secret: None, + } + } +} +#[doc = "Identity Provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderCreateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IdentityProviderCreateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The external Identity Providers like Facebook, Google, Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management service developer portal for all users."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProviderCreateContractProperties { + #[serde(flatten)] + pub identity_provider_base_parameters: IdentityProviderBaseParameters, + #[doc = "Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "clientSecret")] + pub client_secret: String, +} +impl IdentityProviderCreateContractProperties { + pub fn new(client_id: String, client_secret: String) -> Self { + Self { + identity_provider_base_parameters: IdentityProviderBaseParameters::default(), + client_id, + client_secret, + } + } +} +#[doc = "List of all the Identity Providers configured on the service instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderList { + #[doc = "Identity Provider configuration values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IdentityProviderList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to update Identity Provider"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderUpdateParameters { + #[doc = "Parameters supplied to the Update Identity Provider operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IdentityProviderUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Identity Provider operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderUpdateProperties { + #[serde(flatten)] + pub identity_provider_base_parameters: IdentityProviderBaseParameters, + #[doc = "Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl IdentityProviderUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Issue Attachment list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueAttachmentCollection { + #[doc = "Issue Attachment values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IssueAttachmentCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue Attachment Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueAttachmentContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Issue Attachment contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IssueAttachmentContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue Attachment contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IssueAttachmentContractProperties { + #[doc = "Filename by which the binary data will be saved."] + pub title: String, + #[doc = "Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property."] + #[serde(rename = "contentFormat")] + pub content_format: String, + #[doc = "An HTTP link or Base64-encoded binary data."] + pub content: String, +} +impl IssueAttachmentContractProperties { + pub fn new(title: String, content_format: String, content: String) -> Self { + Self { + title, + content_format, + content, + } + } +} +#[doc = "Paged Issue list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueCollection { + #[doc = "Issue values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IssueCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Issue Comment list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueCommentCollection { + #[doc = "Issue Comment values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IssueCommentCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue Comment Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueCommentContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Issue Comment contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IssueCommentContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue Comment contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IssueCommentContractProperties { + #[doc = "Comment text."] + pub text: String, + #[doc = "Date and time when the comment was created."] + #[serde(rename = "createdDate", default, skip_serializing_if = "Option::is_none")] + pub created_date: Option, + #[doc = "A resource identifier for the user who left the comment."] + #[serde(rename = "userId")] + pub user_id: String, +} +impl IssueCommentContractProperties { + pub fn new(text: String, user_id: String) -> Self { + Self { + text, + created_date: None, + user_id, + } + } +} +#[doc = "A key-value pair that provides additional context on the issue."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueContext {} +impl IssueContext { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Issue contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IssueContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue contract Base Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueContractBaseProperties { + #[doc = "Date and time when the issue was created."] + #[serde(rename = "createdDate", default, skip_serializing_if = "Option::is_none")] + pub created_date: Option, + #[doc = "Status of the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "A resource identifier for the API the issue was created for."] + #[serde(rename = "apiId", default, skip_serializing_if = "Option::is_none")] + pub api_id: Option, +} +impl IssueContractBaseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod issue_contract_base_properties { + use super::*; + #[doc = "Status of the issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "proposed")] + Proposed, + #[serde(rename = "open")] + Open, + #[serde(rename = "removed")] + Removed, + #[serde(rename = "resolved")] + Resolved, + #[serde(rename = "closed")] + Closed, + } +} +#[doc = "Issue contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IssueContractProperties { + #[serde(flatten)] + pub issue_contract_base_properties: IssueContractBaseProperties, + #[doc = "The issue title."] + pub title: String, + #[doc = "Text describing the issue."] + pub description: String, + #[doc = "A resource identifier for the user created the issue."] + #[serde(rename = "userId")] + pub user_id: String, +} +impl IssueContractProperties { + pub fn new(title: String, description: String, user_id: String) -> Self { + Self { + issue_contract_base_properties: IssueContractBaseProperties::default(), + title, + description, + user_id, + } + } +} +#[doc = "Issue update Parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueUpdateContract { + #[doc = "Issue contract Update Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IssueUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue contract Update Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueUpdateContractProperties { + #[serde(flatten)] + pub issue_contract_base_properties: IssueContractBaseProperties, + #[doc = "The issue title."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Text describing the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "A resource identifier for the user created the issue."] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, +} +impl IssueUpdateContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create keyVault contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultContractCreateProperties { + #[doc = "Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi"] + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[doc = "Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret."] + #[serde(rename = "identityClientId", default, skip_serializing_if = "Option::is_none")] + pub identity_client_id: Option, +} +impl KeyVaultContractCreateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "KeyVault contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultContractProperties { + #[serde(flatten)] + pub key_vault_contract_create_properties: KeyVaultContractCreateProperties, + #[doc = "Issue contract Update Properties."] + #[serde(rename = "lastStatus", default, skip_serializing_if = "Option::is_none")] + pub last_status: Option, +} +impl KeyVaultContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Issue contract Update Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultLastAccessStatusContractProperties { + #[doc = "Last status code for sync and refresh of secret from key vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Details of the error else empty."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Last time secret was accessed. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "timeStampUtc", default, skip_serializing_if = "Option::is_none")] + pub time_stamp_utc: Option, +} +impl KeyVaultLastAccessStatusContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Logger list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggerCollection { + #[doc = "Logger values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoggerCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Logger details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggerContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The Logger entity in API Management represents an event sink that you can use to log API Management events. Currently the Logger entity supports logging API Management events to Azure Event Hubs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LoggerContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Logger entity in API Management represents an event sink that you can use to log API Management events. Currently the Logger entity supports logging API Management events to Azure Event Hubs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoggerContractProperties { + #[doc = "Logger type."] + #[serde(rename = "loggerType")] + pub logger_type: logger_contract_properties::LoggerType, + #[doc = "Logger description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The name and SendRule connection string of the event hub for azureEventHub logger.\nInstrumentation key for applicationInsights logger."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[doc = "Whether records are buffered in the logger before publishing. Default is assumed to be true."] + #[serde(rename = "isBuffered", default, skip_serializing_if = "Option::is_none")] + pub is_buffered: Option, + #[doc = "Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource)."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl LoggerContractProperties { + pub fn new(logger_type: logger_contract_properties::LoggerType) -> Self { + Self { + logger_type, + description: None, + credentials: None, + is_buffered: None, + resource_id: None, + } + } +} +pub mod logger_contract_properties { + use super::*; + #[doc = "Logger type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoggerType { + #[serde(rename = "azureEventHub")] + AzureEventHub, + #[serde(rename = "applicationInsights")] + ApplicationInsights, + #[serde(rename = "azureMonitor")] + AzureMonitor, + } +} +#[doc = "Logger update contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggerUpdateContract { + #[doc = "Parameters supplied to the Update Logger operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LoggerUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Logger operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggerUpdateParameters { + #[doc = "Logger type."] + #[serde(rename = "loggerType", default, skip_serializing_if = "Option::is_none")] + pub logger_type: Option, + #[doc = "Logger description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Logger credentials."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[doc = "Whether records are buffered in the logger before publishing. Default is assumed to be true."] + #[serde(rename = "isBuffered", default, skip_serializing_if = "Option::is_none")] + pub is_buffered: Option, +} +impl LoggerUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod logger_update_parameters { + use super::*; + #[doc = "Logger type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoggerType { + #[serde(rename = "azureEventHub")] + AzureEventHub, + #[serde(rename = "applicationInsights")] + ApplicationInsights, + #[serde(rename = "azureMonitor")] + AzureMonitor, + } +} +#[doc = "Paged NamedValue list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NamedValueCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NamedValue details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "NamedValue Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NamedValueContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NamedValue Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NamedValueContractProperties { + #[serde(flatten)] + pub named_value_entity_base_parameters: NamedValueEntityBaseParameters, + #[doc = "Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "KeyVault contract details."] + #[serde(rename = "keyVault", default, skip_serializing_if = "Option::is_none")] + pub key_vault: Option, +} +impl NamedValueContractProperties { + pub fn new(display_name: String) -> Self { + Self { + named_value_entity_base_parameters: NamedValueEntityBaseParameters::default(), + display_name, + value: None, + key_vault: None, + } + } +} +#[doc = "NamedValue details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueCreateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "NamedValue Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NamedValueCreateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NamedValue Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NamedValueCreateContractProperties { + #[serde(flatten)] + pub named_value_entity_base_parameters: NamedValueEntityBaseParameters, + #[doc = "Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Create keyVault contract details."] + #[serde(rename = "keyVault", default, skip_serializing_if = "Option::is_none")] + pub key_vault: Option, +} +impl NamedValueCreateContractProperties { + pub fn new(display_name: String) -> Self { + Self { + named_value_entity_base_parameters: NamedValueEntityBaseParameters::default(), + display_name, + value: None, + key_vault: None, + } + } +} +#[doc = "NamedValue Entity Base Parameters set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueEntityBaseParameters { + #[doc = "Optional tags that when provided can be used to filter the NamedValue list."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, + #[doc = "Determines whether the value is a secret and should be encrypted or not. Default value is false."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +impl NamedValueEntityBaseParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Client or app secret used in IdentityProviders, Aad, OpenID or OAuth."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueSecretContract { + #[doc = "This is secret value of the NamedValue entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl NamedValueSecretContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NamedValue Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueUpdateParameterProperties { + #[serde(flatten)] + pub named_value_entity_base_parameters: NamedValueEntityBaseParameters, + #[doc = "Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Create keyVault contract details."] + #[serde(rename = "keyVault", default, skip_serializing_if = "Option::is_none")] + pub key_vault: Option, +} +impl NamedValueUpdateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NamedValue update Parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NamedValueUpdateParameters { + #[doc = "NamedValue Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NamedValueUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Status details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkStatusContract { + #[doc = "Gets the list of DNS servers IPV4 addresses."] + #[serde(rename = "dnsServers")] + pub dns_servers: Vec, + #[doc = "Gets the list of Connectivity Status to the Resources on which the service depends upon."] + #[serde(rename = "connectivityStatus")] + pub connectivity_status: Vec, +} +impl NetworkStatusContract { + pub fn new(dns_servers: Vec, connectivity_status: Vec) -> Self { + Self { + dns_servers, + connectivity_status, + } + } +} +#[doc = "Network Status in the Location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkStatusContractByLocation { + #[doc = "Location of service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Network Status details."] + #[serde(rename = "networkStatus", default, skip_serializing_if = "Option::is_none")] + pub network_status: Option, +} +impl NetworkStatusContractByLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Notification list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotificationCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NotificationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notification details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotificationContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Notification Contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NotificationContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notification Contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationContractProperties { + #[doc = "Title of the Notification."] + pub title: String, + #[doc = "Description of the Notification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Notification Parameter contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recipients: Option, +} +impl NotificationContractProperties { + pub fn new(title: String) -> Self { + Self { + title, + description: None, + recipients: None, + } + } +} +#[doc = "API OAuth2 Authentication settings details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OAuth2AuthenticationSettingsContract { + #[doc = "OAuth authorization server identifier."] + #[serde(rename = "authorizationServerId", default, skip_serializing_if = "Option::is_none")] + pub authorization_server_id: Option, + #[doc = "operations scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, +} +impl OAuth2AuthenticationSettingsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API OAuth2 Authentication settings details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenIdAuthenticationSettingsContract { + #[doc = "OAuth authorization server identifier."] + #[serde(rename = "openidProviderId", default, skip_serializing_if = "Option::is_none")] + pub openid_provider_id: Option, + #[doc = "How to send token to the server."] + #[serde(rename = "bearerTokenSendingMethods", default, skip_serializing_if = "Vec::is_empty")] + pub bearer_token_sending_methods: Vec, +} +impl OpenIdAuthenticationSettingsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged OpenIdProviders list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenIdConnectProviderCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OpenIdConnectProviderCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenId Connect Provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenidConnectProviderContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "OpenID Connect Providers Contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OpenidConnectProviderContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenID Connect Providers Contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OpenidConnectProviderContractProperties { + #[doc = "User-friendly OpenID Connect Provider name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "User-friendly description of OpenID Connect Provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Metadata endpoint URI."] + #[serde(rename = "metadataEndpoint")] + pub metadata_endpoint: String, + #[doc = "Client ID of developer console which is the client application."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Client Secret of developer console which is the client application."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl OpenidConnectProviderContractProperties { + pub fn new(display_name: String, metadata_endpoint: String, client_id: String) -> Self { + Self { + display_name, + description: None, + metadata_endpoint, + client_id, + client_secret: None, + } + } +} +#[doc = "Parameters supplied to the Update OpenID Connect Provider operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenidConnectProviderUpdateContract { + #[doc = "Parameters supplied to the Update OpenID Connect Provider operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OpenidConnectProviderUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update OpenID Connect Provider operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenidConnectProviderUpdateContractProperties { + #[doc = "User-friendly OpenID Connect Provider name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "User-friendly description of OpenID Connect Provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Metadata endpoint URI."] + #[serde(rename = "metadataEndpoint", default, skip_serializing_if = "Option::is_none")] + pub metadata_endpoint: Option, + #[doc = "Client ID of developer console which is the client application."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Client Secret of developer console which is the client application."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl OpenidConnectProviderUpdateContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "REST API operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation name: {provider}/{resource}/{operation}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The object that describes the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The operation origin."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The operation properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "The object that describes the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Friendly name of the resource provider"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Operation type: read, write, delete, listKeys/action, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Resource type on which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Friendly name of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Paged Operation list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Operation Contract Properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Contract Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationContractProperties { + #[serde(flatten)] + pub operation_entity_base_contract: OperationEntityBaseContract, + #[doc = "Operation Name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them."] + pub method: String, + #[doc = "Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}"] + #[serde(rename = "urlTemplate")] + pub url_template: String, +} +impl OperationContractProperties { + pub fn new(display_name: String, method: String, url_template: String) -> Self { + Self { + operation_entity_base_contract: OperationEntityBaseContract::default(), + display_name, + method, + url_template, + } + } +} +#[doc = "API Operation Entity Base Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationEntityBaseContract { + #[doc = "Collection of URL template parameters."] + #[serde(rename = "templateParameters", default, skip_serializing_if = "Vec::is_empty")] + pub template_parameters: Vec, + #[doc = "Description of the operation. May include HTML formatting tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Operation request details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub request: Option, + #[doc = "Array of Operation responses."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub responses: Vec, + #[doc = "Operation Policies"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policies: Option, +} +impl OperationEntityBaseContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Long Running Git Operation Results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Operation Result."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationResultContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultContractProperties { + #[doc = "Operation result identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Status of an async operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub started: Option, + #[doc = "Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub updated: Option, + #[doc = "Optional result info."] + #[serde(rename = "resultInfo", default, skip_serializing_if = "Option::is_none")] + pub result_info: Option, + #[doc = "Error Body contract."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation."] + #[serde(rename = "actionLog", default, skip_serializing_if = "Vec::is_empty")] + pub action_log: Vec, +} +impl OperationResultContractProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_result_contract_properties { + use super::*; + #[doc = "Status of an async operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Started, + InProgress, + Succeeded, + Failed, + } +} +#[doc = "Log of the entity being created, updated or deleted."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultLogItemContract { + #[doc = "The type of entity contract."] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Action like create/update/delete."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "Identifier of the entity being created/updated/deleted."] + #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")] + pub object_key: Option, +} +impl OperationResultLogItemContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Entity contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationTagResourceContractProperties { + #[doc = "Identifier of the operation in form /operations/{operationId}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Operation name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "API Name."] + #[serde(rename = "apiName", default, skip_serializing_if = "Option::is_none")] + pub api_name: Option, + #[doc = "API Revision."] + #[serde(rename = "apiRevision", default, skip_serializing_if = "Option::is_none")] + pub api_revision: Option, + #[doc = "API Version."] + #[serde(rename = "apiVersion", default, skip_serializing_if = "Option::is_none")] + pub api_version: Option, + #[doc = "Operation Description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}"] + #[serde(rename = "urlTemplate", default, skip_serializing_if = "Option::is_none")] + pub url_template: Option, +} +impl OperationTagResourceContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Operation Update Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationUpdateContract { + #[doc = "Operation Update Contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Update Contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationUpdateContractProperties { + #[serde(flatten)] + pub operation_entity_base_contract: OperationEntityBaseContract, + #[doc = "Operation Name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}"] + #[serde(rename = "urlTemplate", default, skip_serializing_if = "Option::is_none")] + pub url_template: Option, +} +impl OperationUpdateContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OutboundEnvironmentEndpoint { + #[doc = "The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The endpoints that the Api Management Service reaches the service at."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +impl OutboundEnvironmentEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of Outbound Environment Endpoints"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointList { + #[doc = "Collection of resources."] + pub value: Vec, + #[doc = "Link to next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OutboundEnvironmentEndpointList { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Operation parameters details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParameterContract { + #[doc = "Parameter name."] + pub name: String, + #[doc = "Parameter description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Parameter type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Default parameter value."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "Specifies whether parameter is required or not."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub required: Option, + #[doc = "Parameter values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[doc = "Schema identifier."] + #[serde(rename = "schemaId", default, skip_serializing_if = "Option::is_none")] + pub schema_id: Option, + #[doc = "Type name defined by the schema."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "Parameter examples."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub examples: Option, +} +impl ParameterContract { + pub fn new(name: String, type_: String) -> Self { + Self { + name, + description: None, + type_, + default_value: None, + required: None, + values: Vec::new(), + schema_id: None, + type_name: None, + examples: None, + } + } +} +#[doc = "Parameter example."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParameterExampleContract { + #[doc = "Short description for the example"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[doc = "Long description for the example"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Example value. May be a primitive value, or an object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "A URL that points to the literal example"] + #[serde(rename = "externalValue", default, skip_serializing_if = "Option::is_none")] + pub external_value: Option, +} +impl ParameterExampleContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameter examples."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParameterExamplesContract {} +impl ParameterExamplesContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Diagnostic settings for incoming/outgoing HTTP messages to the Gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PipelineDiagnosticSettings { + #[doc = "Http message diagnostic settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub request: Option, + #[doc = "Http message diagnostic settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub response: Option, +} +impl PipelineDiagnosticSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response of the list policy operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyCollection { + #[doc = "Policy Contract value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PolicyCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Policy contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PolicyContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyContractProperties { + #[doc = "Contents of the Policy as defined by the format."] + pub value: String, + #[doc = "Format of the policyContent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, +} +impl PolicyContractProperties { + pub fn new(value: String) -> Self { + Self { value, format: None } + } +} +pub mod policy_contract_properties { + use super::*; + #[doc = "Format of the policyContent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Format { + #[serde(rename = "xml")] + Xml, + #[serde(rename = "xml-link")] + XmlLink, + #[serde(rename = "rawxml")] + Rawxml, + #[serde(rename = "rawxml-link")] + RawxmlLink, + } + impl Default for Format { + fn default() -> Self { + Self::Xml + } + } +} +#[doc = "Descriptions of APIM policies."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyDescriptionCollection { + #[doc = "Descriptions of APIM policies."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl PolicyDescriptionCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy description details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyDescriptionContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Policy description properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PolicyDescriptionContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy description properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyDescriptionContractProperties { + #[doc = "Policy description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Binary OR value of the Snippet scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, +} +impl PolicyDescriptionContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response of the get policy fragments operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyFragmentCollection { + #[doc = "Policy fragment contract value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PolicyFragmentCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy fragment contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyFragmentContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Policy fragment contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PolicyFragmentContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy fragment contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyFragmentContractProperties { + #[doc = "Contents of the policy fragment."] + pub value: String, + #[doc = "Policy fragment description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Format of the policy fragment content."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, +} +impl PolicyFragmentContractProperties { + pub fn new(value: String) -> Self { + Self { + value, + description: None, + format: None, + } + } +} +pub mod policy_fragment_contract_properties { + use super::*; + #[doc = "Format of the policy fragment content."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Format { + #[serde(rename = "xml")] + Xml, + #[serde(rename = "rawxml")] + Rawxml, + } + impl Default for Format { + fn default() -> Self { + Self::Xml + } + } +} +#[doc = "The collection of the developer portal configurations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigCollection { + #[doc = "The developer portal configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PortalConfigCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The developer portal configuration contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The developer portal configuration contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalConfigContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The developer portal Cross-Origin Resource Sharing (CORS) settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigCorsProperties { + #[doc = "Allowed origins, e.g. `https://trusted.com`."] + #[serde(rename = "allowedOrigins", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_origins: Vec, +} +impl PortalConfigCorsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The developer portal Content Security Policy (CSP) settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigCspProperties { + #[doc = "The mode of the developer portal Content Security Policy (CSP)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "The URLs used by the browser to report CSP violations."] + #[serde(rename = "reportUri", default, skip_serializing_if = "Vec::is_empty")] + pub report_uri: Vec, + #[doc = "Allowed sources, e.g. `*.trusted.com`, `trusted.com`, `https://`."] + #[serde(rename = "allowedSources", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_sources: Vec, +} +impl PortalConfigCspProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod portal_config_csp_properties { + use super::*; + #[doc = "The mode of the developer portal Content Security Policy (CSP)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + #[serde(rename = "enabled")] + Enabled, + #[serde(rename = "disabled")] + Disabled, + #[serde(rename = "reportOnly")] + ReportOnly, + } + impl Default for Mode { + fn default() -> Self { + Self::Disabled + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigDelegationProperties { + #[doc = "Enable or disable delegation for user registration."] + #[serde(rename = "delegateRegistration", default, skip_serializing_if = "Option::is_none")] + pub delegate_registration: Option, + #[doc = "Enable or disable delegation for product subscriptions."] + #[serde(rename = "delegateSubscription", default, skip_serializing_if = "Option::is_none")] + pub delegate_subscription: Option, + #[doc = "A delegation endpoint URL."] + #[serde(rename = "delegationUrl", default, skip_serializing_if = "Option::is_none")] + pub delegation_url: Option, + #[doc = "A base64-encoded validation key to ensure requests originate from Azure API Management service."] + #[serde(rename = "validationKey", default, skip_serializing_if = "Option::is_none")] + pub validation_key: Option, +} +impl PortalConfigDelegationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The developer portal configuration contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigProperties { + #[doc = "Enable or disable Basic authentication method."] + #[serde(rename = "enableBasicAuth", default, skip_serializing_if = "Option::is_none")] + pub enable_basic_auth: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signup: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub delegation: Option, + #[doc = "The developer portal Cross-Origin Resource Sharing (CORS) settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cors: Option, + #[doc = "The developer portal Content Security Policy (CSP) settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub csp: Option, +} +impl PortalConfigProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod portal_config_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Signin { + #[doc = "Redirect anonymous users to the sign-in page."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub require: Option, + } + impl Signin { + pub fn new() -> Self { + Self::default() + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Signup { + #[doc = "Terms of service contract properties."] + #[serde(rename = "termsOfService", default, skip_serializing_if = "Option::is_none")] + pub terms_of_service: Option, + } + impl Signup { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Terms of service contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalConfigTermsOfServiceProperties { + #[doc = "A terms of service text."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, + #[doc = "Ask user for consent to the terms of service."] + #[serde(rename = "requireConsent", default, skip_serializing_if = "Option::is_none")] + pub require_consent: Option, +} +impl PortalConfigTermsOfServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delegation settings for a developer portal."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalDelegationSettings { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Delegation settings contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalDelegationSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delegation settings contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalDelegationSettingsProperties { + #[doc = "A delegation Url."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "A base64-encoded validation key to validate, that a request is coming from Azure API Management."] + #[serde(rename = "validationKey", default, skip_serializing_if = "Option::is_none")] + pub validation_key: Option, + #[doc = "Subscriptions delegation settings properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subscriptions: Option, + #[doc = "User registration delegation settings properties."] + #[serde(rename = "userRegistration", default, skip_serializing_if = "Option::is_none")] + pub user_registration: Option, +} +impl PortalDelegationSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged list of portal revisions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalRevisionCollection { + #[doc = "Collection of portal revisions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PortalRevisionCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Portal Revision's contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalRevisionContract { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalRevisionContract { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalRevisionContractProperties { + #[doc = "Portal revision description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Portal revision publishing status details."] + #[serde(rename = "statusDetails", default, skip_serializing_if = "Option::is_none")] + pub status_details: Option, + #[doc = "Status of the portal's revision."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Indicates if the portal's revision is public."] + #[serde(rename = "isCurrent", default, skip_serializing_if = "Option::is_none")] + pub is_current: Option, + #[doc = "Portal's revision creation date and time."] + #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")] + pub created_date_time: Option, + #[doc = "Last updated date and time."] + #[serde(rename = "updatedDateTime", default, skip_serializing_if = "Option::is_none")] + pub updated_date_time: Option, +} +impl PortalRevisionContractProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod portal_revision_contract_properties { + use super::*; + #[doc = "Status of the portal's revision."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "pending")] + Pending, + #[serde(rename = "publishing")] + Publishing, + #[serde(rename = "completed")] + Completed, + #[serde(rename = "failed")] + Failed, + } +} +#[doc = "Client or app secret used in IdentityProviders, Aad, OpenID or OAuth."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSettingValidationKeyContract { + #[doc = "This is secret value of the validation key in portal settings."] + #[serde(rename = "validationKey", default, skip_serializing_if = "Option::is_none")] + pub validation_key: Option, +} +impl PortalSettingValidationKeyContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Descriptions of APIM policies."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSettingsCollection { + #[doc = "Descriptions of APIM policies."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl PortalSettingsCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Portal Settings for the Developer Portal."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSettingsContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Sign-in settings contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalSettingsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sign-in settings contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSettingsContractProperties { + #[doc = "A delegation Url."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "A base64-encoded validation key to validate, that a request is coming from Azure API Management."] + #[serde(rename = "validationKey", default, skip_serializing_if = "Option::is_none")] + pub validation_key: Option, + #[doc = "Subscriptions delegation settings properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subscriptions: Option, + #[doc = "User registration delegation settings properties."] + #[serde(rename = "userRegistration", default, skip_serializing_if = "Option::is_none")] + pub user_registration: Option, + #[doc = "Redirect Anonymous users to the Sign-In page."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Terms of service contract properties."] + #[serde(rename = "termsOfService", default, skip_serializing_if = "Option::is_none")] + pub terms_of_service: Option, +} +impl PortalSettingsContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sign-in settings contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSigninSettingProperties { + #[doc = "Redirect Anonymous users to the Sign-In page."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl PortalSigninSettingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sign-In settings for the Developer Portal."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSigninSettings { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Sign-in settings contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalSigninSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sign-Up settings for a developer portal."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSignupSettings { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Sign-up settings contract properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PortalSignupSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sign-up settings contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PortalSignupSettingsProperties { + #[doc = "Allow users to sign up on a developer portal."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Terms of service contract properties."] + #[serde(rename = "termsOfService", default, skip_serializing_if = "Option::is_none")] + pub terms_of_service: Option, +} +impl PortalSignupSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The ARM identifier for Private Endpoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the PrivateEndpointConnectProperties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of private endpoint connection associated with the specified storage account"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "Array of private endpoint connections"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the PrivateEndpointConnectProperties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "The Private Endpoint resource."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new(private_link_service_connection_state: PrivateLinkServiceConnectionState) -> Self { + Self { + private_endpoint: None, + private_link_service_connection_state, + provisioning_state: None, + } + } +} +#[doc = "The current provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointConnectionProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, +} +#[doc = "A request to approve or reject a private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionRequest { + #[doc = "Private Endpoint Connection Resource Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The connection state of the private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnectionRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_endpoint_connection_request { + use super::*; + #[doc = "The connection state of the private endpoint connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Properties of the PrivateEndpointConnectProperties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionWrapperProperties { + #[doc = "A wrapper for an ARM resource id"] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[doc = "The provisioning state of the private endpoint connection resource."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "All the Group ids."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Vec::is_empty")] + pub group_ids: Vec, +} +impl PrivateEndpointConnectionWrapperProperties { + pub fn new(private_link_service_connection_state: PrivateLinkServiceConnectionState) -> Self { + Self { + private_endpoint: None, + private_link_service_connection_state, + provisioning_state: None, + group_ids: Vec::new(), + } + } +} +#[doc = "The private endpoint connection status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointServiceConnectionStatus { + Pending, + Approved, + Rejected, +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of a private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceListResult { + #[doc = "Array of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateLinkResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "The private link resource group id."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private link resource required member names."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of information about the state of the connection between service consumer and provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "The private endpoint connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The reason for approval/rejection of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "A message indicating if changes on the service provider require any updates on the consumer."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Products list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProductCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ProductCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Product details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProductContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Product profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProductContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Product profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProductContractProperties { + #[serde(flatten)] + pub product_entity_base_parameters: ProductEntityBaseParameters, + #[doc = "Product name."] + #[serde(rename = "displayName")] + pub display_name: String, +} +impl ProductContractProperties { + pub fn new(display_name: String) -> Self { + Self { + product_entity_base_parameters: ProductEntityBaseParameters::default(), + display_name, + } + } +} +#[doc = "Product Entity Base Parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProductEntityBaseParameters { + #[doc = "Product description. May include HTML formatting tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub terms: Option, + #[doc = "Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as \"protected\" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as \"open\" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true."] + #[serde(rename = "subscriptionRequired", default, skip_serializing_if = "Option::is_none")] + pub subscription_required: Option, + #[doc = "whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false."] + #[serde(rename = "approvalRequired", default, skip_serializing_if = "Option::is_none")] + pub approval_required: Option, + #[doc = "Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false."] + #[serde(rename = "subscriptionsLimit", default, skip_serializing_if = "Option::is_none")] + pub subscriptions_limit: Option, + #[doc = "whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl ProductEntityBaseParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod product_entity_base_parameters { + use super::*; + #[doc = "whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "notPublished")] + NotPublished, + #[serde(rename = "published")] + Published, + } +} +#[doc = "Product profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProductTagResourceContractProperties { + #[serde(flatten)] + pub product_entity_base_parameters: ProductEntityBaseParameters, + #[doc = "Identifier of the product in the form of /products/{productId}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Product name."] + pub name: String, +} +impl ProductTagResourceContractProperties { + pub fn new(name: String) -> Self { + Self { + product_entity_base_parameters: ProductEntityBaseParameters::default(), + id: None, + name, + } + } +} +#[doc = "Product Update parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProductUpdateParameters { + #[doc = "Parameters supplied to the Update Product operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProductUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update Product operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProductUpdateProperties { + #[serde(flatten)] + pub product_entity_base_parameters: ProductEntityBaseParameters, + #[doc = "Product name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +impl ProductUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Quota Counter list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QuotaCounterCollection { + #[doc = "Quota counter values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl QuotaCounterCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Quota counter details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuotaCounterContract { + #[doc = "The Key value of the Counter. Must not be empty."] + #[serde(rename = "counterKey")] + pub counter_key: String, + #[doc = "Identifier of the Period for which the counter was collected. Must not be empty."] + #[serde(rename = "periodKey")] + pub period_key: String, + #[doc = "The date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "periodStartTime")] + pub period_start_time: String, + #[doc = "The date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "periodEndTime")] + pub period_end_time: String, + #[doc = "Quota counter value details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl QuotaCounterContract { + pub fn new(counter_key: String, period_key: String, period_start_time: String, period_end_time: String) -> Self { + Self { + counter_key, + period_key, + period_start_time, + period_end_time, + value: None, + } + } +} +#[doc = "Quota counter value details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QuotaCounterValueContract { + #[doc = "Quota counter value details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl QuotaCounterValueContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Quota counter value details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QuotaCounterValueContractProperties { + #[doc = "Number of times Counter was called."] + #[serde(rename = "callsCount", default, skip_serializing_if = "Option::is_none")] + pub calls_count: Option, + #[doc = "Data Transferred in KiloBytes."] + #[serde(rename = "kbTransferred", default, skip_serializing_if = "Option::is_none")] + pub kb_transferred: Option, +} +impl QuotaCounterValueContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Quota counter value details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QuotaCounterValueUpdateContract { + #[doc = "Quota counter value details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl QuotaCounterValueUpdateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Recipient User list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientEmailCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RecipientEmailCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recipient Email details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientEmailContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Recipient Email Contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecipientEmailContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recipient Email Contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientEmailContractProperties { + #[doc = "User Email subscribed to notification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, +} +impl RecipientEmailContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Recipient User list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientUserCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RecipientUserCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recipient User details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientUserContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Recipient User Contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecipientUserContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recipient User Contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientUsersContractProperties { + #[doc = "API Management UserId subscribed to notification."] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, +} +impl RecipientUsersContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notification Parameter contract."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecipientsContractProperties { + #[doc = "List of Emails subscribed for the notification."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub emails: Vec, + #[doc = "List of Users subscribed for the notification."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub users: Vec, +} +impl RecipientsContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Region profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegionContract { + #[doc = "Region name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "whether Region is the master region."] + #[serde(rename = "isMasterRegion", default, skip_serializing_if = "Option::is_none")] + pub is_master_region: Option, + #[doc = "whether Region is deleted."] + #[serde(rename = "isDeleted", default, skip_serializing_if = "Option::is_none")] + pub is_deleted: Option, +} +impl RegionContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Lists Regions operation response details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegionListResult { + #[doc = "Lists of Regions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RegionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User registration delegation settings properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegistrationDelegationSettingsProperties { + #[doc = "Enable or disable delegation for user registration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl RegistrationDelegationSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Remote Private Endpoint Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemotePrivateEndpointConnectionWrapper { + #[doc = "Private Endpoint connection resource id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Private Endpoint Connection Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Private Endpoint Connection Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Properties of the PrivateEndpointConnectProperties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RemotePrivateEndpointConnectionWrapper { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Report records list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ReportCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Report data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportRecordContract { + #[doc = "Name depending on report endpoint specifies product, API, operation or developer name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[doc = "Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[doc = "Country to which this record data is related."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, + #[doc = "Country region to which this record data is related."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[doc = "Zip code to which this record data is related."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zip: Option, + #[doc = "User identifier path. /users/{userId}"] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[doc = "Product identifier path. /products/{productId}"] + #[serde(rename = "productId", default, skip_serializing_if = "Option::is_none")] + pub product_id: Option, + #[doc = "API identifier path. /apis/{apiId}"] + #[serde(rename = "apiId", default, skip_serializing_if = "Option::is_none")] + pub api_id: Option, + #[doc = "Operation identifier path. /apis/{apiId}/operations/{operationId}"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "API region identifier."] + #[serde(rename = "apiRegion", default, skip_serializing_if = "Option::is_none")] + pub api_region: Option, + #[doc = "Subscription identifier path. /subscriptions/{subscriptionId}"] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect"] + #[serde(rename = "callCountSuccess", default, skip_serializing_if = "Option::is_none")] + pub call_count_success: Option, + #[doc = "Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests"] + #[serde(rename = "callCountBlocked", default, skip_serializing_if = "Option::is_none")] + pub call_count_blocked: Option, + #[doc = "Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600"] + #[serde(rename = "callCountFailed", default, skip_serializing_if = "Option::is_none")] + pub call_count_failed: Option, + #[doc = "Number of other calls."] + #[serde(rename = "callCountOther", default, skip_serializing_if = "Option::is_none")] + pub call_count_other: Option, + #[doc = "Total number of calls."] + #[serde(rename = "callCountTotal", default, skip_serializing_if = "Option::is_none")] + pub call_count_total: Option, + #[doc = "Bandwidth consumed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bandwidth: Option, + #[doc = "Number of times when content was served from cache policy."] + #[serde(rename = "cacheHitCount", default, skip_serializing_if = "Option::is_none")] + pub cache_hit_count: Option, + #[doc = "Number of times content was fetched from backend."] + #[serde(rename = "cacheMissCount", default, skip_serializing_if = "Option::is_none")] + pub cache_miss_count: Option, + #[doc = "Average time it took to process request."] + #[serde(rename = "apiTimeAvg", default, skip_serializing_if = "Option::is_none")] + pub api_time_avg: Option, + #[doc = "Minimum time it took to process request."] + #[serde(rename = "apiTimeMin", default, skip_serializing_if = "Option::is_none")] + pub api_time_min: Option, + #[doc = "Maximum time it took to process request."] + #[serde(rename = "apiTimeMax", default, skip_serializing_if = "Option::is_none")] + pub api_time_max: Option, + #[doc = "Average time it took to process request on backend."] + #[serde(rename = "serviceTimeAvg", default, skip_serializing_if = "Option::is_none")] + pub service_time_avg: Option, + #[doc = "Minimum time it took to process request on backend."] + #[serde(rename = "serviceTimeMin", default, skip_serializing_if = "Option::is_none")] + pub service_time_min: Option, + #[doc = "Maximum time it took to process request on backend."] + #[serde(rename = "serviceTimeMax", default, skip_serializing_if = "Option::is_none")] + pub service_time_max: Option, +} +impl ReportRecordContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation request/response representation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RepresentationContract { + #[doc = "Specifies a registered or custom content type for this representation, e.g. application/xml."] + #[serde(rename = "contentType")] + pub content_type: String, + #[doc = "Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'."] + #[serde(rename = "schemaId", default, skip_serializing_if = "Option::is_none")] + pub schema_id: Option, + #[doc = "Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "Collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.."] + #[serde(rename = "formParameters", default, skip_serializing_if = "Vec::is_empty")] + pub form_parameters: Vec, + #[doc = "Parameter examples."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub examples: Option, +} +impl RepresentationContract { + pub fn new(content_type: String) -> Self { + Self { + content_type, + schema_id: None, + type_name: None, + form_parameters: Vec::new(), + examples: None, + } + } +} +#[doc = "Operation request details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RequestContract { + #[doc = "Operation request description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Collection of operation request query parameters."] + #[serde(rename = "queryParameters", default, skip_serializing_if = "Vec::is_empty")] + pub query_parameters: Vec, + #[doc = "Collection of operation request headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + #[doc = "Collection of operation request representations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub representations: Vec, +} +impl RequestContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Report records list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RequestReportCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl RequestReportCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request Report data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RequestReportRecordContract { + #[doc = "API identifier path. /apis/{apiId}"] + #[serde(rename = "apiId", default, skip_serializing_if = "Option::is_none")] + pub api_id: Option, + #[doc = "Operation identifier path. /apis/{apiId}/operations/{operationId}"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "Product identifier path. /products/{productId}"] + #[serde(rename = "productId", default, skip_serializing_if = "Option::is_none")] + pub product_id: Option, + #[doc = "User identifier path. /users/{userId}"] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[doc = "The HTTP method associated with this request.."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "The full URL associated with this request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The client IP address associated with this request."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The HTTP status code received by the gateway as a result of forwarding this request to the backend."] + #[serde(rename = "backendResponseCode", default, skip_serializing_if = "Option::is_none")] + pub backend_response_code: Option, + #[doc = "The HTTP status code returned by the gateway."] + #[serde(rename = "responseCode", default, skip_serializing_if = "Option::is_none")] + pub response_code: Option, + #[doc = "The size of the response returned by the gateway."] + #[serde(rename = "responseSize", default, skip_serializing_if = "Option::is_none")] + pub response_size: Option, + #[doc = "The date and time when this request was received by the gateway in ISO 8601 format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[doc = "Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cache: Option, + #[doc = "The total time it took to process this request."] + #[serde(rename = "apiTime", default, skip_serializing_if = "Option::is_none")] + pub api_time: Option, + #[doc = "he time it took to forward this request to the backend and get the response back."] + #[serde(rename = "serviceTime", default, skip_serializing_if = "Option::is_none")] + pub service_time: Option, + #[doc = "Azure region where the gateway that processed this request is located."] + #[serde(rename = "apiRegion", default, skip_serializing_if = "Option::is_none")] + pub api_region: Option, + #[doc = "Subscription identifier path. /subscriptions/{subscriptionId}"] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Request Identifier."] + #[serde(rename = "requestId", default, skip_serializing_if = "Option::is_none")] + pub request_id: Option, + #[doc = "The size of this request.."] + #[serde(rename = "requestSize", default, skip_serializing_if = "Option::is_none")] + pub request_size: Option, +} +impl RequestReportRecordContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceCollection { + #[doc = "A collection of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource location data properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceLocationDataContract { + #[doc = "A canonical name for the geographic or physical location."] + pub name: String, + #[doc = "The city or locality where the resource is located."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "The district, state, or province where the resource is located."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub district: Option, + #[doc = "The country or region where the resource is located."] + #[serde(rename = "countryOrRegion", default, skip_serializing_if = "Option::is_none")] + pub country_or_region: Option, +} +impl ResourceLocationDataContract { + pub fn new(name: String) -> Self { + Self { + name, + city: None, + district: None, + country_or_region: None, + } + } +} +#[doc = "Describes an available API Management SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceSku { + #[doc = "Name of the Sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ResourceSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_sku { + use super::*; + #[doc = "Name of the Sku."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Developer, + Standard, + Premium, + Basic, + Consumption, + Isolated, + } +} +#[doc = "Describes scaling information of a SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceSkuCapacity { + #[doc = "The minimum capacity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minimum: Option, + #[doc = "The maximum capacity that can be set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[doc = "The default capacity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[doc = "The scale type applicable to the sku."] + #[serde(rename = "scaleType", default, skip_serializing_if = "Option::is_none")] + pub scale_type: Option, +} +impl ResourceSkuCapacity { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_sku_capacity { + use super::*; + #[doc = "The scale type applicable to the sku."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScaleType { + #[serde(rename = "automatic")] + Automatic, + #[serde(rename = "manual")] + Manual, + #[serde(rename = "none")] + None, + } +} +#[doc = "Describes an available API Management service SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceSkuResult { + #[doc = "The type of resource the SKU applies to."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Describes an available API Management SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Describes scaling information of a SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl ResourceSkuResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The API Management service SKUs operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceSkuResults { + #[doc = "The list of skus available for the service."] + pub value: Vec, + #[doc = "The uri to fetch the next page of API Management service Skus."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceSkuResults { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Operation response details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponseContract { + #[doc = "Operation response HTTP status code."] + #[serde(rename = "statusCode")] + pub status_code: i32, + #[doc = "Operation response description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Collection of operation response representations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub representations: Vec, + #[doc = "Collection of operation response headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, +} +impl ResponseContract { + pub fn new(status_code: i32) -> Self { + Self { + status_code, + description: None, + representations: Vec::new(), + headers: Vec::new(), + } + } +} +#[doc = "Sampling settings for Diagnostic."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SamplingSettings { + #[doc = "Sampling type."] + #[serde(rename = "samplingType", default, skip_serializing_if = "Option::is_none")] + pub sampling_type: Option, + #[doc = "Rate of sampling for fixed-rate sampling."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub percentage: Option, +} +impl SamplingSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod sampling_settings { + use super::*; + #[doc = "Sampling type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SamplingType { + #[serde(rename = "fixed")] + Fixed, + } +} +#[doc = "Save Tenant Configuration Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SaveConfigurationParameter { + #[doc = "Parameters supplied to the Save Tenant Configuration operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SaveConfigurationParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Save Tenant Configuration operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SaveConfigurationParameterProperties { + #[doc = "The name of the Git branch in which to commit the current configuration snapshot."] + pub branch: String, + #[doc = "The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +impl SaveConfigurationParameterProperties { + pub fn new(branch: String) -> Self { + Self { branch, force: None } + } +} +#[doc = "The response of the list schema operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SchemaCollection { + #[doc = "API Schema Contract value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SchemaCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Schema Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SchemaContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "API Schema create or update contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SchemaContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "API Schema create or update contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SchemaContractProperties { + #[doc = "Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`."] + #[serde(rename = "contentType")] + pub content_type: String, + #[doc = "Api Schema Document Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub document: Option, +} +impl SchemaContractProperties { + pub fn new(content_type: String) -> Self { + Self { + content_type, + document: None, + } + } +} +#[doc = "Api Schema Document Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SchemaDocumentProperties { + #[doc = "Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub definitions: Option, + #[doc = "Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null otherwise."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub components: Option, +} +impl SchemaDocumentProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Subscriptions list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SubscriptionCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscription details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Subscription details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SubscriptionContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscription details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionContractProperties { + #[doc = "The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "Scope like /products/{productId} or /apis or /apis/{apiId}."] + pub scope: String, + #[doc = "The name of the subscription, or null if the subscription has no name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + pub state: subscription_contract_properties::State, + #[doc = "Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "createdDate", default, skip_serializing_if = "Option::is_none")] + pub created_date: Option, + #[doc = "Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[doc = "Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[doc = "Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[doc = "Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "notificationDate", default, skip_serializing_if = "Option::is_none")] + pub notification_date: Option, + #[doc = "Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "Optional subscription comment added by an administrator when the state is changed to the 'rejected'."] + #[serde(rename = "stateComment", default, skip_serializing_if = "Option::is_none")] + pub state_comment: Option, + #[doc = "Determines whether tracing is enabled"] + #[serde(rename = "allowTracing", default, skip_serializing_if = "Option::is_none")] + pub allow_tracing: Option, +} +impl SubscriptionContractProperties { + pub fn new(scope: String, state: subscription_contract_properties::State) -> Self { + Self { + owner_id: None, + scope, + display_name: None, + state, + created_date: None, + start_date: None, + expiration_date: None, + end_date: None, + notification_date: None, + primary_key: None, + secondary_key: None, + state_comment: None, + allow_tracing: None, + } + } +} +pub mod subscription_contract_properties { + use super::*; + #[doc = "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "suspended")] + Suspended, + #[serde(rename = "active")] + Active, + #[serde(rename = "expired")] + Expired, + #[serde(rename = "submitted")] + Submitted, + #[serde(rename = "rejected")] + Rejected, + #[serde(rename = "cancelled")] + Cancelled, + } +} +#[doc = "Parameters supplied to the Create subscription operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionCreateParameterProperties { + #[doc = "User (user id path) for whom subscription is being created in form /users/{userId}"] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "Scope like /products/{productId} or /apis or /apis/{apiId}."] + pub scope: String, + #[doc = "Subscription name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Primary subscription key. If not specified during request key will be generated automatically."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Secondary subscription key. If not specified during request key will be generated automatically."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "Determines whether tracing can be enabled"] + #[serde(rename = "allowTracing", default, skip_serializing_if = "Option::is_none")] + pub allow_tracing: Option, +} +impl SubscriptionCreateParameterProperties { + pub fn new(scope: String, display_name: String) -> Self { + Self { + owner_id: None, + scope, + display_name, + primary_key: None, + secondary_key: None, + state: None, + allow_tracing: None, + } + } +} +pub mod subscription_create_parameter_properties { + use super::*; + #[doc = "Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "suspended")] + Suspended, + #[serde(rename = "active")] + Active, + #[serde(rename = "expired")] + Expired, + #[serde(rename = "submitted")] + Submitted, + #[serde(rename = "rejected")] + Rejected, + #[serde(rename = "cancelled")] + Cancelled, + } +} +#[doc = "Subscription create details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionCreateParameters { + #[doc = "Parameters supplied to the Create subscription operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SubscriptionCreateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscription key parameter names details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionKeyParameterNamesContract { + #[doc = "Subscription key header name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub header: Option, + #[doc = "Subscription key query string parameter name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SubscriptionKeyParameterNamesContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscription keys."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionKeysContract { + #[doc = "Subscription primary key."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Subscription secondary key."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, +} +impl SubscriptionKeysContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update subscription operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionUpdateParameterProperties { + #[doc = "User identifier path: /users/{userId}"] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "Scope like /products/{productId} or /apis or /apis/{apiId}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard."] + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[doc = "Subscription name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Primary subscription key."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "Secondary subscription key."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "Comments describing subscription state change by the administrator when the state is changed to the 'rejected'."] + #[serde(rename = "stateComment", default, skip_serializing_if = "Option::is_none")] + pub state_comment: Option, + #[doc = "Determines whether tracing can be enabled"] + #[serde(rename = "allowTracing", default, skip_serializing_if = "Option::is_none")] + pub allow_tracing: Option, +} +impl SubscriptionUpdateParameterProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod subscription_update_parameter_properties { + use super::*; + #[doc = "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "suspended")] + Suspended, + #[serde(rename = "active")] + Active, + #[serde(rename = "expired")] + Expired, + #[serde(rename = "submitted")] + Submitted, + #[serde(rename = "rejected")] + Rejected, + #[serde(rename = "cancelled")] + Cancelled, + } +} +#[doc = "Subscription update details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionUpdateParameters { + #[doc = "Parameters supplied to the Update subscription operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SubscriptionUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscriptions delegation settings properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionsDelegationSettingsProperties { + #[doc = "Enable or disable delegation for subscriptions."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl SubscriptionsDelegationSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Tag list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TagCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tag Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Tag contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TagContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tag contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagContractProperties { + #[doc = "Tag name."] + #[serde(rename = "displayName")] + pub display_name: String, +} +impl TagContractProperties { + pub fn new(display_name: String) -> Self { + Self { display_name } + } +} +#[doc = "Parameters supplied to Create/Update Tag operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagCreateUpdateParameters { + #[doc = "Tag contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TagCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Create TagDescription operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagDescriptionBaseProperties { + #[doc = "Description of the Tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Absolute URL of external resources describing the tag."] + #[serde(rename = "externalDocsUrl", default, skip_serializing_if = "Option::is_none")] + pub external_docs_url: Option, + #[doc = "Description of the external resources describing the tag."] + #[serde(rename = "externalDocsDescription", default, skip_serializing_if = "Option::is_none")] + pub external_docs_description: Option, +} +impl TagDescriptionBaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged TagDescription list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagDescriptionCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TagDescriptionCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contract details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagDescriptionContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "TagDescription contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TagDescriptionContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "TagDescription contract Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagDescriptionContractProperties { + #[serde(flatten)] + pub tag_description_base_properties: TagDescriptionBaseProperties, + #[doc = "Identifier of the tag in the form of /tags/{tagId}"] + #[serde(rename = "tagId", default, skip_serializing_if = "Option::is_none")] + pub tag_id: Option, + #[doc = "Tag name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +impl TagDescriptionContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Create TagDescription operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagDescriptionCreateParameters { + #[doc = "Parameters supplied to the Create TagDescription operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TagDescriptionCreateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged Tag list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagResourceCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TagResourceCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "TagResource contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagResourceContract { + #[doc = "Contract defining the Tag property in the Tag Resource Contract"] + pub tag: TagTagResourceContractProperties, + #[doc = "API contract properties for the Tag Resources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub api: Option, + #[doc = "Operation Entity contract Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Product profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub product: Option, +} +impl TagResourceContract { + pub fn new(tag: TagTagResourceContractProperties) -> Self { + Self { + tag, + api: None, + operation: None, + product: None, + } + } +} +#[doc = "Contract defining the Tag property in the Tag Resource Contract"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagTagResourceContractProperties { + #[doc = "Tag identifier"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Tag Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl TagTagResourceContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of Tenant Configuration Sync State."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TenantConfigurationSyncStateContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Tenant Configuration Synchronization State."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TenantConfigurationSyncStateContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant Configuration Synchronization State."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TenantConfigurationSyncStateContractProperties { + #[doc = "The name of Git branch."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[doc = "The latest commit Id."] + #[serde(rename = "commitId", default, skip_serializing_if = "Option::is_none")] + pub commit_id: Option, + #[doc = "value indicating if last sync was save (true) or deploy (false) operation."] + #[serde(rename = "isExport", default, skip_serializing_if = "Option::is_none")] + pub is_export: Option, + #[doc = "value indicating if last synchronization was later than the configuration change."] + #[serde(rename = "isSynced", default, skip_serializing_if = "Option::is_none")] + pub is_synced: Option, + #[doc = "value indicating whether Git configuration access is enabled."] + #[serde(rename = "isGitEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_git_enabled: Option, + #[doc = "The date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "syncDate", default, skip_serializing_if = "Option::is_none")] + pub sync_date: Option, + #[doc = "The date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "configurationChangeDate", default, skip_serializing_if = "Option::is_none")] + pub configuration_change_date: Option, + #[doc = "Most recent tenant configuration operation identifier"] + #[serde(rename = "lastOperationId", default, skip_serializing_if = "Option::is_none")] + pub last_operation_id: Option, +} +impl TenantConfigurationSyncStateContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paged AccessInformation list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TenantSettingsCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TenantSettingsCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant Settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TenantSettingsContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Tenant access information contract of the API Management service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TenantSettingsContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tenant access information contract of the API Management service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TenantSettingsContractProperties { + #[doc = "Tenant settings"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, +} +impl TenantSettingsContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Terms of service contract properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermsOfServiceProperties { + #[doc = "A terms of service text."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, + #[doc = "Display terms of service during a sign-up process."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Ask user for consent to the terms of service."] + #[serde(rename = "consentRequired", default, skip_serializing_if = "Option::is_none")] + pub consent_required: Option, +} +impl TermsOfServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OAuth acquire token request body parameter (www-url-form-encoded)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenBodyParameterContract { + #[doc = "body parameter name."] + pub name: String, + #[doc = "body parameter value."] + pub value: String, +} +impl TokenBodyParameterContract { + pub fn new(name: String, value: String) -> Self { + Self { name, value } + } +} +#[doc = "Paged Users list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserCollection { + #[doc = "Page values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UserCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserContract { + #[serde(flatten)] + pub resource: Resource, + #[doc = "User profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UserContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserContractProperties { + #[serde(flatten)] + pub user_entity_base_parameters: UserEntityBaseParameters, + #[doc = "First name."] + #[serde(rename = "firstName", default, skip_serializing_if = "Option::is_none")] + pub first_name: Option, + #[doc = "Last name."] + #[serde(rename = "lastName", default, skip_serializing_if = "Option::is_none")] + pub last_name: Option, + #[doc = "Email address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + #[doc = "Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + #[serde(rename = "registrationDate", default, skip_serializing_if = "Option::is_none")] + pub registration_date: Option, + #[doc = "Collection of groups user is part of."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, +} +impl UserContractProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Create User operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserCreateParameterProperties { + #[serde(flatten)] + pub user_entity_base_parameters: UserEntityBaseParameters, + #[doc = "Email address. Must not be empty and must be unique within the service instance."] + pub email: String, + #[doc = "First name."] + #[serde(rename = "firstName")] + pub first_name: String, + #[doc = "Last name."] + #[serde(rename = "lastName")] + pub last_name: String, + #[doc = "User Password. If no value is provided, a default password is generated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Determines the type of application which send the create user request. Default is legacy portal."] + #[serde(rename = "appType", default, skip_serializing_if = "Option::is_none")] + pub app_type: Option, + #[doc = "Determines the type of confirmation e-mail that will be sent to the newly created user."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub confirmation: Option, +} +impl UserCreateParameterProperties { + pub fn new(email: String, first_name: String, last_name: String) -> Self { + Self { + user_entity_base_parameters: UserEntityBaseParameters::default(), + email, + first_name, + last_name, + password: None, + app_type: None, + confirmation: None, + } + } +} +pub mod user_create_parameter_properties { + use super::*; + #[doc = "Determines the type of application which send the create user request. Default is legacy portal."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AppType { + #[serde(rename = "portal")] + Portal, + #[serde(rename = "developerPortal")] + DeveloperPortal, + } + #[doc = "Determines the type of confirmation e-mail that will be sent to the newly created user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Confirmation { + #[serde(rename = "signup")] + Signup, + #[serde(rename = "invite")] + Invite, + } +} +#[doc = "User create details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserCreateParameters { + #[doc = "Parameters supplied to the Create User operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UserCreateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User Entity Base Parameters set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserEntityBaseParameters { + #[doc = "Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "Optional note about a user set by the administrator."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub note: Option, + #[doc = "Collection of user identities."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub identities: Vec, +} +impl UserEntityBaseParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod user_entity_base_parameters { + use super::*; + #[doc = "Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "active")] + Active, + #[serde(rename = "blocked")] + Blocked, + #[serde(rename = "pending")] + Pending, + #[serde(rename = "deleted")] + Deleted, + } + impl Default for State { + fn default() -> Self { + Self::Active + } + } +} +#[doc = "List of Users Identity list representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserIdentityCollection { + #[doc = "User Identity values."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Total record count number across all pages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Next page link if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UserIdentityCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User identity details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserIdentityContract { + #[doc = "Identity provider name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Identifier value within provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl UserIdentityContract { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserIdentityProperties { + #[doc = "The principal id of user assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client id of user assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserIdentityProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Get User Token operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserTokenParameterProperties { + #[doc = "The Key to be used to generate token for user."] + #[serde(rename = "keyType")] + pub key_type: user_token_parameter_properties::KeyType, + #[doc = "The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n"] + pub expiry: String, +} +impl UserTokenParameterProperties { + pub fn new(key_type: user_token_parameter_properties::KeyType, expiry: String) -> Self { + Self { key_type, expiry } + } +} +pub mod user_token_parameter_properties { + use super::*; + #[doc = "The Key to be used to generate token for user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + } + impl Default for KeyType { + fn default() -> Self { + Self::Primary + } + } +} +#[doc = "Get User Token parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserTokenParameters { + #[doc = "Parameters supplied to the Get User Token operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UserTokenParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Get User Token response details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserTokenResult { + #[doc = "Shared Access Authorization token for the User."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl UserTokenResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User update parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserUpdateParameters { + #[doc = "Parameters supplied to the Update User operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UserUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the Update User operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserUpdateParametersProperties { + #[serde(flatten)] + pub user_entity_base_parameters: UserEntityBaseParameters, + #[doc = "Email address. Must not be empty and must be unique within the service instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + #[doc = "User Password."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "First name."] + #[serde(rename = "firstName", default, skip_serializing_if = "Option::is_none")] + pub first_name: Option, + #[doc = "Last name."] + #[serde(rename = "lastName", default, skip_serializing_if = "Option::is_none")] + pub last_name: Option, +} +impl UserUpdateParametersProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configuration of a virtual network to which API Management service is deployed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkConfiguration { + #[doc = "The virtual network ID. This is typically a GUID. Expect a null GUID by default."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vnetid: Option, + #[doc = "The name of the subnet."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnetname: Option, + #[doc = "The full resource ID of a subnet in a virtual network to deploy the API Management service in."] + #[serde(rename = "subnetResourceId", default, skip_serializing_if = "Option::is_none")] + pub subnet_resource_id: Option, +} +impl VirtualNetworkConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of server X509Names."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct X509CertificateName { + #[doc = "Common Name of the Certificate."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Thumbprint for the Issuer of the Certificate."] + #[serde(rename = "issuerCertificateThumbprint", default, skip_serializing_if = "Option::is_none")] + pub issuer_certificate_thumbprint: Option, +} +impl X509CertificateName { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/apimanagement/src/package_preview_2021_12/operations.rs b/services/mgmt/apimanagement/src/package_preview_2021_12/operations.rs new file mode 100644 index 0000000000..e694e8b698 --- /dev/null +++ b/services/mgmt/apimanagement/src/package_preview_2021_12/operations.rs @@ -0,0 +1,37896 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn api(&self) -> api::Client { + api::Client(self.clone()) + } + pub fn api_diagnostic(&self) -> api_diagnostic::Client { + api_diagnostic::Client(self.clone()) + } + pub fn api_export(&self) -> api_export::Client { + api_export::Client(self.clone()) + } + pub fn api_issue(&self) -> api_issue::Client { + api_issue::Client(self.clone()) + } + pub fn api_issue_attachment(&self) -> api_issue_attachment::Client { + api_issue_attachment::Client(self.clone()) + } + pub fn api_issue_comment(&self) -> api_issue_comment::Client { + api_issue_comment::Client(self.clone()) + } + pub fn api_management_operations(&self) -> api_management_operations::Client { + api_management_operations::Client(self.clone()) + } + pub fn api_management_service(&self) -> api_management_service::Client { + api_management_service::Client(self.clone()) + } + pub fn api_management_service_skus(&self) -> api_management_service_skus::Client { + api_management_service_skus::Client(self.clone()) + } + pub fn api_management_skus(&self) -> api_management_skus::Client { + api_management_skus::Client(self.clone()) + } + pub fn api_operation(&self) -> api_operation::Client { + api_operation::Client(self.clone()) + } + pub fn api_operation_policy(&self) -> api_operation_policy::Client { + api_operation_policy::Client(self.clone()) + } + pub fn api_policy(&self) -> api_policy::Client { + api_policy::Client(self.clone()) + } + pub fn api_product(&self) -> api_product::Client { + api_product::Client(self.clone()) + } + pub fn api_release(&self) -> api_release::Client { + api_release::Client(self.clone()) + } + pub fn api_revision(&self) -> api_revision::Client { + api_revision::Client(self.clone()) + } + pub fn api_schema(&self) -> api_schema::Client { + api_schema::Client(self.clone()) + } + pub fn api_tag_description(&self) -> api_tag_description::Client { + api_tag_description::Client(self.clone()) + } + pub fn api_version_set(&self) -> api_version_set::Client { + api_version_set::Client(self.clone()) + } + pub fn authorization_server(&self) -> authorization_server::Client { + authorization_server::Client(self.clone()) + } + pub fn backend(&self) -> backend::Client { + backend::Client(self.clone()) + } + pub fn cache(&self) -> cache::Client { + cache::Client(self.clone()) + } + pub fn certificate(&self) -> certificate::Client { + certificate::Client(self.clone()) + } + pub fn content_item(&self) -> content_item::Client { + content_item::Client(self.clone()) + } + pub fn content_type(&self) -> content_type::Client { + content_type::Client(self.clone()) + } + pub fn delegation_settings(&self) -> delegation_settings::Client { + delegation_settings::Client(self.clone()) + } + pub fn deleted_services(&self) -> deleted_services::Client { + deleted_services::Client(self.clone()) + } + pub fn diagnostic(&self) -> diagnostic::Client { + diagnostic::Client(self.clone()) + } + pub fn email_template(&self) -> email_template::Client { + email_template::Client(self.clone()) + } + pub fn gateway(&self) -> gateway::Client { + gateway::Client(self.clone()) + } + pub fn gateway_api(&self) -> gateway_api::Client { + gateway_api::Client(self.clone()) + } + pub fn gateway_certificate_authority(&self) -> gateway_certificate_authority::Client { + gateway_certificate_authority::Client(self.clone()) + } + pub fn gateway_hostname_configuration(&self) -> gateway_hostname_configuration::Client { + gateway_hostname_configuration::Client(self.clone()) + } + pub fn global_schema(&self) -> global_schema::Client { + global_schema::Client(self.clone()) + } + pub fn group(&self) -> group::Client { + group::Client(self.clone()) + } + pub fn group_user(&self) -> group_user::Client { + group_user::Client(self.clone()) + } + pub fn identity_provider(&self) -> identity_provider::Client { + identity_provider::Client(self.clone()) + } + pub fn issue(&self) -> issue::Client { + issue::Client(self.clone()) + } + pub fn logger(&self) -> logger::Client { + logger::Client(self.clone()) + } + pub fn named_value(&self) -> named_value::Client { + named_value::Client(self.clone()) + } + pub fn network_status(&self) -> network_status::Client { + network_status::Client(self.clone()) + } + pub fn notification(&self) -> notification::Client { + notification::Client(self.clone()) + } + pub fn notification_recipient_email(&self) -> notification_recipient_email::Client { + notification_recipient_email::Client(self.clone()) + } + pub fn notification_recipient_user(&self) -> notification_recipient_user::Client { + notification_recipient_user::Client(self.clone()) + } + pub fn open_id_connect_provider(&self) -> open_id_connect_provider::Client { + open_id_connect_provider::Client(self.clone()) + } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } + pub fn outbound_network_dependencies_endpoints(&self) -> outbound_network_dependencies_endpoints::Client { + outbound_network_dependencies_endpoints::Client(self.clone()) + } + pub fn policy(&self) -> policy::Client { + policy::Client(self.clone()) + } + pub fn policy_description(&self) -> policy_description::Client { + policy_description::Client(self.clone()) + } + pub fn policy_fragment(&self) -> policy_fragment::Client { + policy_fragment::Client(self.clone()) + } + pub fn portal_config(&self) -> portal_config::Client { + portal_config::Client(self.clone()) + } + pub fn portal_revision(&self) -> portal_revision::Client { + portal_revision::Client(self.clone()) + } + pub fn portal_settings(&self) -> portal_settings::Client { + portal_settings::Client(self.clone()) + } + pub fn private_endpoint_connection(&self) -> private_endpoint_connection::Client { + private_endpoint_connection::Client(self.clone()) + } + pub fn product(&self) -> product::Client { + product::Client(self.clone()) + } + pub fn product_api(&self) -> product_api::Client { + product_api::Client(self.clone()) + } + pub fn product_group(&self) -> product_group::Client { + product_group::Client(self.clone()) + } + pub fn product_policy(&self) -> product_policy::Client { + product_policy::Client(self.clone()) + } + pub fn product_subscriptions(&self) -> product_subscriptions::Client { + product_subscriptions::Client(self.clone()) + } + pub fn quota_by_counter_keys(&self) -> quota_by_counter_keys::Client { + quota_by_counter_keys::Client(self.clone()) + } + pub fn quota_by_period_keys(&self) -> quota_by_period_keys::Client { + quota_by_period_keys::Client(self.clone()) + } + pub fn region(&self) -> region::Client { + region::Client(self.clone()) + } + pub fn reports(&self) -> reports::Client { + reports::Client(self.clone()) + } + pub fn sign_in_settings(&self) -> sign_in_settings::Client { + sign_in_settings::Client(self.clone()) + } + pub fn sign_up_settings(&self) -> sign_up_settings::Client { + sign_up_settings::Client(self.clone()) + } + pub fn subscription(&self) -> subscription::Client { + subscription::Client(self.clone()) + } + pub fn tag(&self) -> tag::Client { + tag::Client(self.clone()) + } + pub fn tag_resource(&self) -> tag_resource::Client { + tag_resource::Client(self.clone()) + } + pub fn tenant_access(&self) -> tenant_access::Client { + tenant_access::Client(self.clone()) + } + pub fn tenant_access_git(&self) -> tenant_access_git::Client { + tenant_access_git::Client(self.clone()) + } + pub fn tenant_configuration(&self) -> tenant_configuration::Client { + tenant_configuration::Client(self.clone()) + } + pub fn tenant_settings(&self) -> tenant_settings::Client { + tenant_settings::Client(self.clone()) + } + pub fn user(&self) -> user::Client { + user::Client(self.clone()) + } + pub fn user_confirmation_password(&self) -> user_confirmation_password::Client { + user_confirmation_password::Client(self.clone()) + } + pub fn user_group(&self) -> user_group::Client { + user_group::Client(self.clone()) + } + pub fn user_identities(&self) -> user_identities::Client { + user_identities::Client(self.clone()) + } + pub fn user_subscription(&self) -> user_subscription::Client { + user_subscription::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ApiExport_Get(#[from] api_export::get::Error), + #[error(transparent)] + Api_ListByService(#[from] api::list_by_service::Error), + #[error(transparent)] + Api_Get(#[from] api::get::Error), + #[error(transparent)] + Api_CreateOrUpdate(#[from] api::create_or_update::Error), + #[error(transparent)] + Api_Update(#[from] api::update::Error), + #[error(transparent)] + Api_Delete(#[from] api::delete::Error), + #[error(transparent)] + Api_GetEntityTag(#[from] api::get_entity_tag::Error), + #[error(transparent)] + ApiRevision_ListByService(#[from] api_revision::list_by_service::Error), + #[error(transparent)] + ApiRelease_ListByService(#[from] api_release::list_by_service::Error), + #[error(transparent)] + ApiRelease_Get(#[from] api_release::get::Error), + #[error(transparent)] + ApiRelease_CreateOrUpdate(#[from] api_release::create_or_update::Error), + #[error(transparent)] + ApiRelease_Update(#[from] api_release::update::Error), + #[error(transparent)] + ApiRelease_Delete(#[from] api_release::delete::Error), + #[error(transparent)] + ApiRelease_GetEntityTag(#[from] api_release::get_entity_tag::Error), + #[error(transparent)] + ApiOperation_ListByApi(#[from] api_operation::list_by_api::Error), + #[error(transparent)] + ApiOperation_Get(#[from] api_operation::get::Error), + #[error(transparent)] + ApiOperation_CreateOrUpdate(#[from] api_operation::create_or_update::Error), + #[error(transparent)] + ApiOperation_Update(#[from] api_operation::update::Error), + #[error(transparent)] + ApiOperation_Delete(#[from] api_operation::delete::Error), + #[error(transparent)] + ApiOperation_GetEntityTag(#[from] api_operation::get_entity_tag::Error), + #[error(transparent)] + ApiOperationPolicy_ListByOperation(#[from] api_operation_policy::list_by_operation::Error), + #[error(transparent)] + ApiOperationPolicy_Get(#[from] api_operation_policy::get::Error), + #[error(transparent)] + ApiOperationPolicy_CreateOrUpdate(#[from] api_operation_policy::create_or_update::Error), + #[error(transparent)] + ApiOperationPolicy_Delete(#[from] api_operation_policy::delete::Error), + #[error(transparent)] + ApiOperationPolicy_GetEntityTag(#[from] api_operation_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByOperation(#[from] tag::list_by_operation::Error), + #[error(transparent)] + Tag_GetByOperation(#[from] tag::get_by_operation::Error), + #[error(transparent)] + Tag_AssignToOperation(#[from] tag::assign_to_operation::Error), + #[error(transparent)] + Tag_DetachFromOperation(#[from] tag::detach_from_operation::Error), + #[error(transparent)] + Tag_GetEntityStateByOperation(#[from] tag::get_entity_state_by_operation::Error), + #[error(transparent)] + ApiProduct_ListByApis(#[from] api_product::list_by_apis::Error), + #[error(transparent)] + ApiPolicy_ListByApi(#[from] api_policy::list_by_api::Error), + #[error(transparent)] + ApiPolicy_Get(#[from] api_policy::get::Error), + #[error(transparent)] + ApiPolicy_CreateOrUpdate(#[from] api_policy::create_or_update::Error), + #[error(transparent)] + ApiPolicy_Delete(#[from] api_policy::delete::Error), + #[error(transparent)] + ApiPolicy_GetEntityTag(#[from] api_policy::get_entity_tag::Error), + #[error(transparent)] + ApiSchema_ListByApi(#[from] api_schema::list_by_api::Error), + #[error(transparent)] + ApiSchema_Get(#[from] api_schema::get::Error), + #[error(transparent)] + ApiSchema_CreateOrUpdate(#[from] api_schema::create_or_update::Error), + #[error(transparent)] + ApiSchema_Delete(#[from] api_schema::delete::Error), + #[error(transparent)] + ApiSchema_GetEntityTag(#[from] api_schema::get_entity_tag::Error), + #[error(transparent)] + ApiDiagnostic_ListByService(#[from] api_diagnostic::list_by_service::Error), + #[error(transparent)] + ApiDiagnostic_Get(#[from] api_diagnostic::get::Error), + #[error(transparent)] + ApiDiagnostic_CreateOrUpdate(#[from] api_diagnostic::create_or_update::Error), + #[error(transparent)] + ApiDiagnostic_Update(#[from] api_diagnostic::update::Error), + #[error(transparent)] + ApiDiagnostic_Delete(#[from] api_diagnostic::delete::Error), + #[error(transparent)] + ApiDiagnostic_GetEntityTag(#[from] api_diagnostic::get_entity_tag::Error), + #[error(transparent)] + ApiIssue_ListByService(#[from] api_issue::list_by_service::Error), + #[error(transparent)] + ApiIssue_Get(#[from] api_issue::get::Error), + #[error(transparent)] + ApiIssue_CreateOrUpdate(#[from] api_issue::create_or_update::Error), + #[error(transparent)] + ApiIssue_Update(#[from] api_issue::update::Error), + #[error(transparent)] + ApiIssue_Delete(#[from] api_issue::delete::Error), + #[error(transparent)] + ApiIssue_GetEntityTag(#[from] api_issue::get_entity_tag::Error), + #[error(transparent)] + ApiIssueComment_ListByService(#[from] api_issue_comment::list_by_service::Error), + #[error(transparent)] + ApiIssueComment_Get(#[from] api_issue_comment::get::Error), + #[error(transparent)] + ApiIssueComment_CreateOrUpdate(#[from] api_issue_comment::create_or_update::Error), + #[error(transparent)] + ApiIssueComment_Delete(#[from] api_issue_comment::delete::Error), + #[error(transparent)] + ApiIssueComment_GetEntityTag(#[from] api_issue_comment::get_entity_tag::Error), + #[error(transparent)] + ApiIssueAttachment_ListByService(#[from] api_issue_attachment::list_by_service::Error), + #[error(transparent)] + ApiIssueAttachment_Get(#[from] api_issue_attachment::get::Error), + #[error(transparent)] + ApiIssueAttachment_CreateOrUpdate(#[from] api_issue_attachment::create_or_update::Error), + #[error(transparent)] + ApiIssueAttachment_Delete(#[from] api_issue_attachment::delete::Error), + #[error(transparent)] + ApiIssueAttachment_GetEntityTag(#[from] api_issue_attachment::get_entity_tag::Error), + #[error(transparent)] + ApiTagDescription_ListByService(#[from] api_tag_description::list_by_service::Error), + #[error(transparent)] + ApiTagDescription_Get(#[from] api_tag_description::get::Error), + #[error(transparent)] + ApiTagDescription_CreateOrUpdate(#[from] api_tag_description::create_or_update::Error), + #[error(transparent)] + ApiTagDescription_Delete(#[from] api_tag_description::delete::Error), + #[error(transparent)] + ApiTagDescription_GetEntityTag(#[from] api_tag_description::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByApi(#[from] tag::list_by_api::Error), + #[error(transparent)] + Tag_GetByApi(#[from] tag::get_by_api::Error), + #[error(transparent)] + Tag_AssignToApi(#[from] tag::assign_to_api::Error), + #[error(transparent)] + Tag_DetachFromApi(#[from] tag::detach_from_api::Error), + #[error(transparent)] + Tag_GetEntityStateByApi(#[from] tag::get_entity_state_by_api::Error), + #[error(transparent)] + Operation_ListByTags(#[from] operation::list_by_tags::Error), + #[error(transparent)] + Api_ListByTags(#[from] api::list_by_tags::Error), + #[error(transparent)] + ApiVersionSet_ListByService(#[from] api_version_set::list_by_service::Error), + #[error(transparent)] + ApiVersionSet_Get(#[from] api_version_set::get::Error), + #[error(transparent)] + ApiVersionSet_CreateOrUpdate(#[from] api_version_set::create_or_update::Error), + #[error(transparent)] + ApiVersionSet_Update(#[from] api_version_set::update::Error), + #[error(transparent)] + ApiVersionSet_Delete(#[from] api_version_set::delete::Error), + #[error(transparent)] + ApiVersionSet_GetEntityTag(#[from] api_version_set::get_entity_tag::Error), + #[error(transparent)] + AuthorizationServer_ListByService(#[from] authorization_server::list_by_service::Error), + #[error(transparent)] + AuthorizationServer_Get(#[from] authorization_server::get::Error), + #[error(transparent)] + AuthorizationServer_CreateOrUpdate(#[from] authorization_server::create_or_update::Error), + #[error(transparent)] + AuthorizationServer_Update(#[from] authorization_server::update::Error), + #[error(transparent)] + AuthorizationServer_Delete(#[from] authorization_server::delete::Error), + #[error(transparent)] + AuthorizationServer_GetEntityTag(#[from] authorization_server::get_entity_tag::Error), + #[error(transparent)] + AuthorizationServer_ListSecrets(#[from] authorization_server::list_secrets::Error), + #[error(transparent)] + Backend_ListByService(#[from] backend::list_by_service::Error), + #[error(transparent)] + Backend_Get(#[from] backend::get::Error), + #[error(transparent)] + Backend_CreateOrUpdate(#[from] backend::create_or_update::Error), + #[error(transparent)] + Backend_Update(#[from] backend::update::Error), + #[error(transparent)] + Backend_Delete(#[from] backend::delete::Error), + #[error(transparent)] + Backend_GetEntityTag(#[from] backend::get_entity_tag::Error), + #[error(transparent)] + Backend_Reconnect(#[from] backend::reconnect::Error), + #[error(transparent)] + Cache_ListByService(#[from] cache::list_by_service::Error), + #[error(transparent)] + Cache_Get(#[from] cache::get::Error), + #[error(transparent)] + Cache_CreateOrUpdate(#[from] cache::create_or_update::Error), + #[error(transparent)] + Cache_Update(#[from] cache::update::Error), + #[error(transparent)] + Cache_Delete(#[from] cache::delete::Error), + #[error(transparent)] + Cache_GetEntityTag(#[from] cache::get_entity_tag::Error), + #[error(transparent)] + Certificate_ListByService(#[from] certificate::list_by_service::Error), + #[error(transparent)] + Certificate_Get(#[from] certificate::get::Error), + #[error(transparent)] + Certificate_CreateOrUpdate(#[from] certificate::create_or_update::Error), + #[error(transparent)] + Certificate_Delete(#[from] certificate::delete::Error), + #[error(transparent)] + Certificate_GetEntityTag(#[from] certificate::get_entity_tag::Error), + #[error(transparent)] + Certificate_RefreshSecret(#[from] certificate::refresh_secret::Error), + #[error(transparent)] + PerformConnectivityCheckAsync(#[from] perform_connectivity_check_async::Error), + #[error(transparent)] + ContentType_ListByService(#[from] content_type::list_by_service::Error), + #[error(transparent)] + ContentType_Get(#[from] content_type::get::Error), + #[error(transparent)] + ContentType_CreateOrUpdate(#[from] content_type::create_or_update::Error), + #[error(transparent)] + ContentType_Delete(#[from] content_type::delete::Error), + #[error(transparent)] + ContentItem_ListByService(#[from] content_item::list_by_service::Error), + #[error(transparent)] + ContentItem_Get(#[from] content_item::get::Error), + #[error(transparent)] + ContentItem_CreateOrUpdate(#[from] content_item::create_or_update::Error), + #[error(transparent)] + ContentItem_Delete(#[from] content_item::delete::Error), + #[error(transparent)] + ContentItem_GetEntityTag(#[from] content_item::get_entity_tag::Error), + #[error(transparent)] + DeletedServices_ListBySubscription(#[from] deleted_services::list_by_subscription::Error), + #[error(transparent)] + DeletedServices_GetByName(#[from] deleted_services::get_by_name::Error), + #[error(transparent)] + DeletedServices_Purge(#[from] deleted_services::purge::Error), + #[error(transparent)] + ApiManagementOperations_List(#[from] api_management_operations::list::Error), + #[error(transparent)] + ApiManagementServiceSkus_ListAvailableServiceSkus(#[from] api_management_service_skus::list_available_service_skus::Error), + #[error(transparent)] + ApiManagementService_Restore(#[from] api_management_service::restore::Error), + #[error(transparent)] + ApiManagementService_Backup(#[from] api_management_service::backup::Error), + #[error(transparent)] + ApiManagementService_Get(#[from] api_management_service::get::Error), + #[error(transparent)] + ApiManagementService_CreateOrUpdate(#[from] api_management_service::create_or_update::Error), + #[error(transparent)] + ApiManagementService_Update(#[from] api_management_service::update::Error), + #[error(transparent)] + ApiManagementService_Delete(#[from] api_management_service::delete::Error), + #[error(transparent)] + ApiManagementService_ListByResourceGroup(#[from] api_management_service::list_by_resource_group::Error), + #[error(transparent)] + ApiManagementService_List(#[from] api_management_service::list::Error), + #[error(transparent)] + ApiManagementService_GetSsoToken(#[from] api_management_service::get_sso_token::Error), + #[error(transparent)] + ApiManagementService_CheckNameAvailability(#[from] api_management_service::check_name_availability::Error), + #[error(transparent)] + ApiManagementService_GetDomainOwnershipIdentifier(#[from] api_management_service::get_domain_ownership_identifier::Error), + #[error(transparent)] + ApiManagementService_ApplyNetworkConfigurationUpdates(#[from] api_management_service::apply_network_configuration_updates::Error), + #[error(transparent)] + Diagnostic_ListByService(#[from] diagnostic::list_by_service::Error), + #[error(transparent)] + Diagnostic_Get(#[from] diagnostic::get::Error), + #[error(transparent)] + Diagnostic_CreateOrUpdate(#[from] diagnostic::create_or_update::Error), + #[error(transparent)] + Diagnostic_Update(#[from] diagnostic::update::Error), + #[error(transparent)] + Diagnostic_Delete(#[from] diagnostic::delete::Error), + #[error(transparent)] + Diagnostic_GetEntityTag(#[from] diagnostic::get_entity_tag::Error), + #[error(transparent)] + EmailTemplate_ListByService(#[from] email_template::list_by_service::Error), + #[error(transparent)] + EmailTemplate_Get(#[from] email_template::get::Error), + #[error(transparent)] + EmailTemplate_CreateOrUpdate(#[from] email_template::create_or_update::Error), + #[error(transparent)] + EmailTemplate_Update(#[from] email_template::update::Error), + #[error(transparent)] + EmailTemplate_Delete(#[from] email_template::delete::Error), + #[error(transparent)] + EmailTemplate_GetEntityTag(#[from] email_template::get_entity_tag::Error), + #[error(transparent)] + Gateway_ListByService(#[from] gateway::list_by_service::Error), + #[error(transparent)] + Gateway_Get(#[from] gateway::get::Error), + #[error(transparent)] + Gateway_CreateOrUpdate(#[from] gateway::create_or_update::Error), + #[error(transparent)] + Gateway_Update(#[from] gateway::update::Error), + #[error(transparent)] + Gateway_Delete(#[from] gateway::delete::Error), + #[error(transparent)] + Gateway_GetEntityTag(#[from] gateway::get_entity_tag::Error), + #[error(transparent)] + Gateway_ListKeys(#[from] gateway::list_keys::Error), + #[error(transparent)] + Gateway_RegenerateKey(#[from] gateway::regenerate_key::Error), + #[error(transparent)] + Gateway_GenerateToken(#[from] gateway::generate_token::Error), + #[error(transparent)] + GatewayHostnameConfiguration_ListByService(#[from] gateway_hostname_configuration::list_by_service::Error), + #[error(transparent)] + GatewayHostnameConfiguration_Get(#[from] gateway_hostname_configuration::get::Error), + #[error(transparent)] + GatewayHostnameConfiguration_CreateOrUpdate(#[from] gateway_hostname_configuration::create_or_update::Error), + #[error(transparent)] + GatewayHostnameConfiguration_Delete(#[from] gateway_hostname_configuration::delete::Error), + #[error(transparent)] + GatewayHostnameConfiguration_GetEntityTag(#[from] gateway_hostname_configuration::get_entity_tag::Error), + #[error(transparent)] + GatewayApi_ListByService(#[from] gateway_api::list_by_service::Error), + #[error(transparent)] + GatewayApi_CreateOrUpdate(#[from] gateway_api::create_or_update::Error), + #[error(transparent)] + GatewayApi_Delete(#[from] gateway_api::delete::Error), + #[error(transparent)] + GatewayApi_GetEntityTag(#[from] gateway_api::get_entity_tag::Error), + #[error(transparent)] + GatewayCertificateAuthority_ListByService(#[from] gateway_certificate_authority::list_by_service::Error), + #[error(transparent)] + GatewayCertificateAuthority_Get(#[from] gateway_certificate_authority::get::Error), + #[error(transparent)] + GatewayCertificateAuthority_CreateOrUpdate(#[from] gateway_certificate_authority::create_or_update::Error), + #[error(transparent)] + GatewayCertificateAuthority_Delete(#[from] gateway_certificate_authority::delete::Error), + #[error(transparent)] + GatewayCertificateAuthority_GetEntityTag(#[from] gateway_certificate_authority::get_entity_tag::Error), + #[error(transparent)] + Group_ListByService(#[from] group::list_by_service::Error), + #[error(transparent)] + Group_Get(#[from] group::get::Error), + #[error(transparent)] + Group_CreateOrUpdate(#[from] group::create_or_update::Error), + #[error(transparent)] + Group_Update(#[from] group::update::Error), + #[error(transparent)] + Group_Delete(#[from] group::delete::Error), + #[error(transparent)] + Group_GetEntityTag(#[from] group::get_entity_tag::Error), + #[error(transparent)] + GroupUser_List(#[from] group_user::list::Error), + #[error(transparent)] + GroupUser_Create(#[from] group_user::create::Error), + #[error(transparent)] + GroupUser_Delete(#[from] group_user::delete::Error), + #[error(transparent)] + GroupUser_CheckEntityExists(#[from] group_user::check_entity_exists::Error), + #[error(transparent)] + IdentityProvider_ListByService(#[from] identity_provider::list_by_service::Error), + #[error(transparent)] + IdentityProvider_Get(#[from] identity_provider::get::Error), + #[error(transparent)] + IdentityProvider_CreateOrUpdate(#[from] identity_provider::create_or_update::Error), + #[error(transparent)] + IdentityProvider_Update(#[from] identity_provider::update::Error), + #[error(transparent)] + IdentityProvider_Delete(#[from] identity_provider::delete::Error), + #[error(transparent)] + IdentityProvider_GetEntityTag(#[from] identity_provider::get_entity_tag::Error), + #[error(transparent)] + IdentityProvider_ListSecrets(#[from] identity_provider::list_secrets::Error), + #[error(transparent)] + Issue_ListByService(#[from] issue::list_by_service::Error), + #[error(transparent)] + Issue_Get(#[from] issue::get::Error), + #[error(transparent)] + Logger_ListByService(#[from] logger::list_by_service::Error), + #[error(transparent)] + Logger_Get(#[from] logger::get::Error), + #[error(transparent)] + Logger_CreateOrUpdate(#[from] logger::create_or_update::Error), + #[error(transparent)] + Logger_Update(#[from] logger::update::Error), + #[error(transparent)] + Logger_Delete(#[from] logger::delete::Error), + #[error(transparent)] + Logger_GetEntityTag(#[from] logger::get_entity_tag::Error), + #[error(transparent)] + NamedValue_ListByService(#[from] named_value::list_by_service::Error), + #[error(transparent)] + NamedValue_Get(#[from] named_value::get::Error), + #[error(transparent)] + NamedValue_CreateOrUpdate(#[from] named_value::create_or_update::Error), + #[error(transparent)] + NamedValue_Update(#[from] named_value::update::Error), + #[error(transparent)] + NamedValue_Delete(#[from] named_value::delete::Error), + #[error(transparent)] + NamedValue_GetEntityTag(#[from] named_value::get_entity_tag::Error), + #[error(transparent)] + NamedValue_ListValue(#[from] named_value::list_value::Error), + #[error(transparent)] + NamedValue_RefreshSecret(#[from] named_value::refresh_secret::Error), + #[error(transparent)] + NetworkStatus_ListByService(#[from] network_status::list_by_service::Error), + #[error(transparent)] + NetworkStatus_ListByLocation(#[from] network_status::list_by_location::Error), + #[error(transparent)] + Notification_ListByService(#[from] notification::list_by_service::Error), + #[error(transparent)] + Notification_Get(#[from] notification::get::Error), + #[error(transparent)] + Notification_CreateOrUpdate(#[from] notification::create_or_update::Error), + #[error(transparent)] + NotificationRecipientUser_ListByNotification(#[from] notification_recipient_user::list_by_notification::Error), + #[error(transparent)] + NotificationRecipientUser_CreateOrUpdate(#[from] notification_recipient_user::create_or_update::Error), + #[error(transparent)] + NotificationRecipientUser_Delete(#[from] notification_recipient_user::delete::Error), + #[error(transparent)] + NotificationRecipientUser_CheckEntityExists(#[from] notification_recipient_user::check_entity_exists::Error), + #[error(transparent)] + NotificationRecipientEmail_ListByNotification(#[from] notification_recipient_email::list_by_notification::Error), + #[error(transparent)] + NotificationRecipientEmail_CreateOrUpdate(#[from] notification_recipient_email::create_or_update::Error), + #[error(transparent)] + NotificationRecipientEmail_Delete(#[from] notification_recipient_email::delete::Error), + #[error(transparent)] + NotificationRecipientEmail_CheckEntityExists(#[from] notification_recipient_email::check_entity_exists::Error), + #[error(transparent)] + OpenIdConnectProvider_ListByService(#[from] open_id_connect_provider::list_by_service::Error), + #[error(transparent)] + OpenIdConnectProvider_Get(#[from] open_id_connect_provider::get::Error), + #[error(transparent)] + OpenIdConnectProvider_CreateOrUpdate(#[from] open_id_connect_provider::create_or_update::Error), + #[error(transparent)] + OpenIdConnectProvider_Update(#[from] open_id_connect_provider::update::Error), + #[error(transparent)] + OpenIdConnectProvider_Delete(#[from] open_id_connect_provider::delete::Error), + #[error(transparent)] + OpenIdConnectProvider_GetEntityTag(#[from] open_id_connect_provider::get_entity_tag::Error), + #[error(transparent)] + OpenIdConnectProvider_ListSecrets(#[from] open_id_connect_provider::list_secrets::Error), + #[error(transparent)] + OutboundNetworkDependenciesEndpoints_ListByService(#[from] outbound_network_dependencies_endpoints::list_by_service::Error), + #[error(transparent)] + Policy_ListByService(#[from] policy::list_by_service::Error), + #[error(transparent)] + Policy_Get(#[from] policy::get::Error), + #[error(transparent)] + Policy_CreateOrUpdate(#[from] policy::create_or_update::Error), + #[error(transparent)] + Policy_Delete(#[from] policy::delete::Error), + #[error(transparent)] + Policy_GetEntityTag(#[from] policy::get_entity_tag::Error), + #[error(transparent)] + PolicyDescription_ListByService(#[from] policy_description::list_by_service::Error), + #[error(transparent)] + PolicyFragment_ListByService(#[from] policy_fragment::list_by_service::Error), + #[error(transparent)] + PolicyFragment_Get(#[from] policy_fragment::get::Error), + #[error(transparent)] + PolicyFragment_CreateOrUpdate(#[from] policy_fragment::create_or_update::Error), + #[error(transparent)] + PolicyFragment_Delete(#[from] policy_fragment::delete::Error), + #[error(transparent)] + PolicyFragment_GetEntityTag(#[from] policy_fragment::get_entity_tag::Error), + #[error(transparent)] + PolicyFragment_ListReferences(#[from] policy_fragment::list_references::Error), + #[error(transparent)] + PortalRevision_ListByService(#[from] portal_revision::list_by_service::Error), + #[error(transparent)] + PortalRevision_Get(#[from] portal_revision::get::Error), + #[error(transparent)] + PortalRevision_CreateOrUpdate(#[from] portal_revision::create_or_update::Error), + #[error(transparent)] + PortalRevision_Update(#[from] portal_revision::update::Error), + #[error(transparent)] + PortalRevision_GetEntityTag(#[from] portal_revision::get_entity_tag::Error), + #[error(transparent)] + PortalSettings_ListByService(#[from] portal_settings::list_by_service::Error), + #[error(transparent)] + SignInSettings_Get(#[from] sign_in_settings::get::Error), + #[error(transparent)] + SignInSettings_CreateOrUpdate(#[from] sign_in_settings::create_or_update::Error), + #[error(transparent)] + SignInSettings_Update(#[from] sign_in_settings::update::Error), + #[error(transparent)] + SignInSettings_GetEntityTag(#[from] sign_in_settings::get_entity_tag::Error), + #[error(transparent)] + SignUpSettings_Get(#[from] sign_up_settings::get::Error), + #[error(transparent)] + SignUpSettings_CreateOrUpdate(#[from] sign_up_settings::create_or_update::Error), + #[error(transparent)] + SignUpSettings_Update(#[from] sign_up_settings::update::Error), + #[error(transparent)] + SignUpSettings_GetEntityTag(#[from] sign_up_settings::get_entity_tag::Error), + #[error(transparent)] + DelegationSettings_Get(#[from] delegation_settings::get::Error), + #[error(transparent)] + DelegationSettings_CreateOrUpdate(#[from] delegation_settings::create_or_update::Error), + #[error(transparent)] + DelegationSettings_Update(#[from] delegation_settings::update::Error), + #[error(transparent)] + DelegationSettings_GetEntityTag(#[from] delegation_settings::get_entity_tag::Error), + #[error(transparent)] + DelegationSettings_ListSecrets(#[from] delegation_settings::list_secrets::Error), + #[error(transparent)] + PortalConfig_ListByService(#[from] portal_config::list_by_service::Error), + #[error(transparent)] + PortalConfig_Get(#[from] portal_config::get::Error), + #[error(transparent)] + PortalConfig_CreateOrUpdate(#[from] portal_config::create_or_update::Error), + #[error(transparent)] + PortalConfig_Update(#[from] portal_config::update::Error), + #[error(transparent)] + PortalConfig_GetEntityTag(#[from] portal_config::get_entity_tag::Error), + #[error(transparent)] + PrivateEndpointConnection_ListByService(#[from] private_endpoint_connection::list_by_service::Error), + #[error(transparent)] + PrivateEndpointConnection_GetByName(#[from] private_endpoint_connection::get_by_name::Error), + #[error(transparent)] + PrivateEndpointConnection_CreateOrUpdate(#[from] private_endpoint_connection::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnection_Delete(#[from] private_endpoint_connection::delete::Error), + #[error(transparent)] + PrivateEndpointConnection_ListPrivateLinkResources(#[from] private_endpoint_connection::list_private_link_resources::Error), + #[error(transparent)] + PrivateEndpointConnection_GetPrivateLinkResource(#[from] private_endpoint_connection::get_private_link_resource::Error), + #[error(transparent)] + Product_ListByService(#[from] product::list_by_service::Error), + #[error(transparent)] + Product_Get(#[from] product::get::Error), + #[error(transparent)] + Product_CreateOrUpdate(#[from] product::create_or_update::Error), + #[error(transparent)] + Product_Update(#[from] product::update::Error), + #[error(transparent)] + Product_Delete(#[from] product::delete::Error), + #[error(transparent)] + Product_GetEntityTag(#[from] product::get_entity_tag::Error), + #[error(transparent)] + ProductApi_ListByProduct(#[from] product_api::list_by_product::Error), + #[error(transparent)] + ProductApi_CreateOrUpdate(#[from] product_api::create_or_update::Error), + #[error(transparent)] + ProductApi_Delete(#[from] product_api::delete::Error), + #[error(transparent)] + ProductApi_CheckEntityExists(#[from] product_api::check_entity_exists::Error), + #[error(transparent)] + ProductGroup_ListByProduct(#[from] product_group::list_by_product::Error), + #[error(transparent)] + ProductGroup_CreateOrUpdate(#[from] product_group::create_or_update::Error), + #[error(transparent)] + ProductGroup_Delete(#[from] product_group::delete::Error), + #[error(transparent)] + ProductGroup_CheckEntityExists(#[from] product_group::check_entity_exists::Error), + #[error(transparent)] + ProductSubscriptions_List(#[from] product_subscriptions::list::Error), + #[error(transparent)] + ProductPolicy_ListByProduct(#[from] product_policy::list_by_product::Error), + #[error(transparent)] + ProductPolicy_Get(#[from] product_policy::get::Error), + #[error(transparent)] + ProductPolicy_CreateOrUpdate(#[from] product_policy::create_or_update::Error), + #[error(transparent)] + ProductPolicy_Delete(#[from] product_policy::delete::Error), + #[error(transparent)] + ProductPolicy_GetEntityTag(#[from] product_policy::get_entity_tag::Error), + #[error(transparent)] + Tag_ListByProduct(#[from] tag::list_by_product::Error), + #[error(transparent)] + Tag_GetByProduct(#[from] tag::get_by_product::Error), + #[error(transparent)] + Tag_AssignToProduct(#[from] tag::assign_to_product::Error), + #[error(transparent)] + Tag_DetachFromProduct(#[from] tag::detach_from_product::Error), + #[error(transparent)] + Tag_GetEntityStateByProduct(#[from] tag::get_entity_state_by_product::Error), + #[error(transparent)] + Product_ListByTags(#[from] product::list_by_tags::Error), + #[error(transparent)] + QuotaByCounterKeys_ListByService(#[from] quota_by_counter_keys::list_by_service::Error), + #[error(transparent)] + QuotaByCounterKeys_Update(#[from] quota_by_counter_keys::update::Error), + #[error(transparent)] + QuotaByPeriodKeys_Get(#[from] quota_by_period_keys::get::Error), + #[error(transparent)] + QuotaByPeriodKeys_Update(#[from] quota_by_period_keys::update::Error), + #[error(transparent)] + Region_ListByService(#[from] region::list_by_service::Error), + #[error(transparent)] + Reports_ListByApi(#[from] reports::list_by_api::Error), + #[error(transparent)] + Reports_ListByUser(#[from] reports::list_by_user::Error), + #[error(transparent)] + Reports_ListByOperation(#[from] reports::list_by_operation::Error), + #[error(transparent)] + Reports_ListByProduct(#[from] reports::list_by_product::Error), + #[error(transparent)] + Reports_ListByGeo(#[from] reports::list_by_geo::Error), + #[error(transparent)] + Reports_ListBySubscription(#[from] reports::list_by_subscription::Error), + #[error(transparent)] + Reports_ListByTime(#[from] reports::list_by_time::Error), + #[error(transparent)] + Reports_ListByRequest(#[from] reports::list_by_request::Error), + #[error(transparent)] + GlobalSchema_ListByService(#[from] global_schema::list_by_service::Error), + #[error(transparent)] + GlobalSchema_Get(#[from] global_schema::get::Error), + #[error(transparent)] + GlobalSchema_CreateOrUpdate(#[from] global_schema::create_or_update::Error), + #[error(transparent)] + GlobalSchema_Delete(#[from] global_schema::delete::Error), + #[error(transparent)] + GlobalSchema_GetEntityTag(#[from] global_schema::get_entity_tag::Error), + #[error(transparent)] + TenantSettings_ListByService(#[from] tenant_settings::list_by_service::Error), + #[error(transparent)] + TenantSettings_Get(#[from] tenant_settings::get::Error), + #[error(transparent)] + ApiManagementSkus_List(#[from] api_management_skus::list::Error), + #[error(transparent)] + Subscription_List(#[from] subscription::list::Error), + #[error(transparent)] + Subscription_Get(#[from] subscription::get::Error), + #[error(transparent)] + Subscription_CreateOrUpdate(#[from] subscription::create_or_update::Error), + #[error(transparent)] + Subscription_Update(#[from] subscription::update::Error), + #[error(transparent)] + Subscription_Delete(#[from] subscription::delete::Error), + #[error(transparent)] + Subscription_GetEntityTag(#[from] subscription::get_entity_tag::Error), + #[error(transparent)] + Subscription_RegeneratePrimaryKey(#[from] subscription::regenerate_primary_key::Error), + #[error(transparent)] + Subscription_RegenerateSecondaryKey(#[from] subscription::regenerate_secondary_key::Error), + #[error(transparent)] + Subscription_ListSecrets(#[from] subscription::list_secrets::Error), + #[error(transparent)] + TagResource_ListByService(#[from] tag_resource::list_by_service::Error), + #[error(transparent)] + Tag_ListByService(#[from] tag::list_by_service::Error), + #[error(transparent)] + Tag_Get(#[from] tag::get::Error), + #[error(transparent)] + Tag_CreateOrUpdate(#[from] tag::create_or_update::Error), + #[error(transparent)] + Tag_Update(#[from] tag::update::Error), + #[error(transparent)] + Tag_Delete(#[from] tag::delete::Error), + #[error(transparent)] + Tag_GetEntityState(#[from] tag::get_entity_state::Error), + #[error(transparent)] + TenantAccess_ListByService(#[from] tenant_access::list_by_service::Error), + #[error(transparent)] + TenantAccess_Get(#[from] tenant_access::get::Error), + #[error(transparent)] + TenantAccess_Create(#[from] tenant_access::create::Error), + #[error(transparent)] + TenantAccess_Update(#[from] tenant_access::update::Error), + #[error(transparent)] + TenantAccess_GetEntityTag(#[from] tenant_access::get_entity_tag::Error), + #[error(transparent)] + TenantAccess_RegeneratePrimaryKey(#[from] tenant_access::regenerate_primary_key::Error), + #[error(transparent)] + TenantAccess_RegenerateSecondaryKey(#[from] tenant_access::regenerate_secondary_key::Error), + #[error(transparent)] + TenantAccess_ListSecrets(#[from] tenant_access::list_secrets::Error), + #[error(transparent)] + TenantAccessGit_RegeneratePrimaryKey(#[from] tenant_access_git::regenerate_primary_key::Error), + #[error(transparent)] + TenantAccessGit_RegenerateSecondaryKey(#[from] tenant_access_git::regenerate_secondary_key::Error), + #[error(transparent)] + TenantConfiguration_Deploy(#[from] tenant_configuration::deploy::Error), + #[error(transparent)] + TenantConfiguration_Save(#[from] tenant_configuration::save::Error), + #[error(transparent)] + TenantConfiguration_Validate(#[from] tenant_configuration::validate::Error), + #[error(transparent)] + TenantConfiguration_GetSyncState(#[from] tenant_configuration::get_sync_state::Error), + #[error(transparent)] + User_ListByService(#[from] user::list_by_service::Error), + #[error(transparent)] + User_Get(#[from] user::get::Error), + #[error(transparent)] + User_CreateOrUpdate(#[from] user::create_or_update::Error), + #[error(transparent)] + User_Update(#[from] user::update::Error), + #[error(transparent)] + User_Delete(#[from] user::delete::Error), + #[error(transparent)] + User_GetEntityTag(#[from] user::get_entity_tag::Error), + #[error(transparent)] + User_GenerateSsoUrl(#[from] user::generate_sso_url::Error), + #[error(transparent)] + UserGroup_List(#[from] user_group::list::Error), + #[error(transparent)] + UserSubscription_List(#[from] user_subscription::list::Error), + #[error(transparent)] + UserSubscription_Get(#[from] user_subscription::get::Error), + #[error(transparent)] + UserIdentities_List(#[from] user_identities::list::Error), + #[error(transparent)] + User_GetSharedAccessToken(#[from] user::get_shared_access_token::Error), + #[error(transparent)] + UserConfirmationPassword_Send(#[from] user_confirmation_password::send::Error), +} +pub mod api_export { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + format: impl Into, + export: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + format: format.into(), + export: export.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) format: String, + pub(crate) export: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}?export=true", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let format = &self.format; + url.query_pairs_mut().append_pair("format", format); + let export = &self.export; + url.query_pairs_mut().append_pair("export", export); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiExportResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + tags: None, + expand_api_version_set: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_revisions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_apis: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) tags: Option, + pub(crate) expand_api_version_set: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); + self + } + pub fn expand_api_version_set(mut self, expand_api_version_set: bool) -> Self { + self.expand_api_version_set = Some(expand_api_version_set); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(expand_api_version_set) = &self.expand_api_version_set { + url.query_pairs_mut() + .append_pair("expandApiVersionSet", &expand_api_version_set.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Accepted202, + Ok200(models::ApiContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiCreateOrUpdateParameter, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) parameters: models::ApiUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) delete_revisions: Option, + } + impl Builder { + pub fn delete_revisions(mut self, delete_revisions: bool) -> Self { + self.delete_revisions = Some(delete_revisions); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(delete_revisions) = &self.delete_revisions { + url.query_pairs_mut().append_pair("deleteRevisions", &delete_revisions.to_string()); + } + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_apis: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn include_not_tagged_apis(mut self, include_not_tagged_apis: bool) -> Self { + self.include_not_tagged_apis = Some(include_not_tagged_apis); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apisByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(include_not_tagged_apis) = &self.include_not_tagged_apis { + url.query_pairs_mut() + .append_pair("includeNotTaggedApis", &include_not_tagged_apis.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/revisions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_release { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + release_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + release_id: release_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiReleaseContract), + Ok200(models::ApiReleaseContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) parameters: models::ApiReleaseContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiReleaseContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) release_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/releases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.release_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) tags: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OperationContract), + Ok200(models::OperationContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) parameters: models::OperationUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_operation_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + subscription_id: impl Into, + ) -> list_by_operation::Builder { + list_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/policies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . operation_id , & self . policy_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tag { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + subscription_id: impl Into, + ) -> list_by_operation::Builder { + list_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_operation::Builder { + get_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_operation::Builder { + assign_to_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_operation::Builder { + detach_from_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + operation_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_operation::Builder { + get_entity_state_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + operation_id: operation_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_api::Builder { + get_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_api::Builder { + assign_to_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_api::Builder { + detach_from_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_api::Builder { + get_entity_state_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_by_product::Builder { + get_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn assign_to_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> assign_to_product::Builder { + assign_to_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn detach_from_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> detach_from_product::Builder { + detach_from_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state_by_product::Builder { + get_entity_state_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + scope: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + tag_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_state::Builder { + get_entity_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + tag_id: tag_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod assign_to_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod detach_from_operation { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_state_by_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) operation_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operations/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.operation_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod assign_to_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod detach_from_api { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_state_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod assign_to_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod detach_from_product { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_state_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) scope: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagContract), + Ok200(models::TagContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) tag_id: String, + pub(crate) parameters: models::TagCreateUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) tag_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_state { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) tag_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tags/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.tag_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_apis( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_apis::Builder { + list_by_apis::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_apis { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) policy_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + schema_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + schema_id: schema_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + schema_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + force: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::SchemaContract), + Ok200(models::SchemaContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::SchemaContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + diagnostic_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) diagnostic_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + expand_comments_attachments: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + expand_comments_attachments: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) expand_comments_attachments: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) expand_comments_attachments: Option, + } + impl Builder { + pub fn expand_comments_attachments(mut self, expand_comments_attachments: bool) -> Self { + self.expand_comments_attachments = Some(expand_comments_attachments); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(expand_comments_attachments) = &self.expand_comments_attachments { + url.query_pairs_mut() + .append_pair("expandCommentsAttachments", &expand_comments_attachments.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueContract), + Ok200(models::IssueContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) parameters: models::IssueUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_issue_comment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + comment_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + comment_id: comment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/comments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueCommentContract), + Ok200(models::IssueCommentContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) parameters: models::IssueCommentContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCommentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) comment_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/comments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id, + &self.comment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_issue_attachment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + issue_id: impl Into, + attachment_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + issue_id: issue_id.into(), + attachment_id: attachment_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/attachments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IssueAttachmentContract), + Ok200(models::IssueAttachmentContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) parameters: models::IssueAttachmentContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueAttachmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) issue_id: String, + pub(crate) attachment_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/issues/{}/attachments/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . api_id , & self . issue_id , & self . attachment_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_tag_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + tag_description_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + tag_description_id: tag_description_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tagDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::TagDescriptionContract), + Ok200(models::TagDescriptionContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) parameters: models::TagDescriptionCreateParameters, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagDescriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) tag_description_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/tagDescriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id, + &self.tag_description_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_operations: None, + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_operations: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn include_not_tagged_operations(mut self, include_not_tagged_operations: bool) -> Self { + self.include_not_tagged_operations = Some(include_not_tagged_operations); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apis/{}/operationsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(include_not_tagged_operations) = &self.include_not_tagged_operations { + url.query_pairs_mut() + .append_pair("includeNotTaggedOperations", &include_not_tagged_operations.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_version_set { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + version_set_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + version_set_id: version_set_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version_set_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiVersionSetContract), + Ok200(models::ApiVersionSetContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version_set_id: String, + pub(crate) parameters: models::ApiVersionSetUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiVersionSetContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version_set_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) version_set_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/apiVersionSets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.version_set_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod authorization_server { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + authsid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + authsid: authsid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::AuthorizationServerContract), + Ok200(models::AuthorizationServerContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) parameters: models::AuthorizationServerContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) parameters: models::AuthorizationServerUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.authsid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) authsid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/authorizationServers/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . authsid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationServerSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backend { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reconnect( + &self, + resource_group_name: impl Into, + service_name: impl Into, + backend_id: impl Into, + subscription_id: impl Into, + ) -> reconnect::Builder { + reconnect::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + backend_id: backend_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendContract), + Ok200(models::BackendContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) parameters: models::BackendUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reconnect { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) backend_id: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backends/{}/reconnect", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.backend_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cache { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + cache_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + cache_id: cache_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CacheContract), + Ok200(models::CacheContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) parameters: models::CacheUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CacheContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) cache_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/caches/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.cache_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod certificate { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CertificateContract), + Ok200(models::CertificateContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::CertificateCreateOrUpdateParameters, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh_secret { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) certificate_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/certificates/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.certificate_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CertificateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn perform_connectivity_check_async( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + connectivity_check_request_params: impl Into, + ) -> perform_connectivity_check_async::Builder { + perform_connectivity_check_async::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + connectivity_check_request_params: connectivity_check_request_params.into(), + } + } +} +pub mod perform_connectivity_check_async { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ConnectivityCheckResponse), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) connectivity_check_request_params: models::ConnectivityCheckRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/connectivityCheck", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.connectivity_check_request_params).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectivityCheckResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod content_type { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ContentTypeContract), + Ok200(models::ContentTypeContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + pub(crate) parameters: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentTypeContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod content_item { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + content_type_id: impl Into, + content_item_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + content_type_id: content_type_id.into(), + content_item_id: content_item_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.content_type_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ContentItemContract), + Ok200(models::ContentItemContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContentItemContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) content_type_id: String, + pub(crate) content_item_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/contentTypes/{}/contentItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . content_type_id , & self . content_item_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deleted_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_by_name( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn purge( + &self, + service_name: impl Into, + subscription_id: impl Into, + location: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/deletedservices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeletedServicesCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeletedServiceContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod purge { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::DeletedServiceContract), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/locations/{}/deletedservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeletedServiceContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_management_operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ApiManagement/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_management_service_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets available SKUs for API Management service"] + pub fn list_available_service_skus( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_available_service_skus::Builder { + list_available_service_skus::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_available_service_skus { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/skus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceSkuResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_management_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn restore( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> restore::Builder { + restore::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backup( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> backup::Builder { + backup::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_sso_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_sso_token::Builder { + get_sso_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_name_availability( + &self, + parameters: impl Into, + subscription_id: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_domain_ownership_identifier(&self, subscription_id: impl Into) -> get_domain_ownership_identifier::Builder { + get_domain_ownership_identifier::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn apply_network_configuration_updates( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> apply_network_configuration_updates::Builder { + apply_network_configuration_updates::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/restore", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceBackupRestoreParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/backup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Created201(models::ApiManagementServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceResource, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::ApiManagementServiceUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::ApiManagementServiceResource), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/service", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sso_token { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/getssotoken", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetSsoTokenResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::ApiManagementServiceCheckNameAvailabilityParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_domain_ownership_identifier { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture< + 'static, + std::result::Result, + > { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceGetDomainOwnershipIdentifierResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod apply_network_configuration_updates { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApiManagementServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/applynetworkconfigurationupdates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod diagnostic { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + diagnostic_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + diagnostic_id: diagnostic_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DiagnosticContract), + Ok200(models::DiagnosticContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) parameters: models::DiagnosticContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) diagnostic_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/diagnostics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.diagnostic_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod email_template { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + template_name: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + template_name: template_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) template_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::EmailTemplateContract), + Ok200(models::EmailTemplateContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) template_name: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) parameters: models::EmailTemplateUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EmailTemplateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) template_name: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) template_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/templates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> regenerate_key::Builder { + regenerate_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_token::Builder { + generate_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GatewayContract), + Ok200(models::GatewayContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/listKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayKeysContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayKeyRegenerationRequestContract, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/regenerateKey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_token { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) parameters: models::GatewayTokenRequestContract, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/generateToken", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayTokenContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway_hostname_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + hc_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + hc_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + hc_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + hc_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + hc_id: hc_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayHostnameConfigurationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayHostnameConfigurationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GatewayHostnameConfigurationContract), + Ok200(models::GatewayHostnameConfigurationContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, + pub(crate) parameters: models::GatewayHostnameConfigurationContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayHostnameConfigurationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayHostnameConfigurationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) hc_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/hostnameConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . hc_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway_api { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.gateway_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gateway_certificate_authority { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + gateway_id: impl Into, + certificate_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + gateway_id: gateway_id.into(), + certificate_id: certificate_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GatewayCertificateAuthorityContract), + Ok200(models::GatewayCertificateAuthorityContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) parameters: models::GatewayCertificateAuthorityContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayCertificateAuthorityContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) gateway_id: String, + pub(crate) certificate_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/gateways/{}/certificateAuthorities/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . gateway_id , & self . certificate_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupCreateParameters, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) parameters: models::GroupUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod group_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + group_id: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + group_id: group_id.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) group_id: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/groups/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.group_id, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod identity_provider { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + identity_provider_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + identity_provider_name: identity_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::IdentityProviderContract), + Ok200(models::IdentityProviderContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderCreateContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) parameters: models::IdentityProviderUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IdentityProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.identity_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) identity_provider_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/identityProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . identity_provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod issue { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + issue_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + issue_id: issue_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) issue_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/issues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.issue_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IssueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod logger { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + logger_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + logger_id: logger_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoggerContract), + Ok200(models::LoggerContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) parameters: models::LoggerUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoggerContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) logger_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/loggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.logger_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod named_value { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + is_key_vault_refresh_failed: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_value( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> list_value::Builder { + list_value::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn refresh_secret( + &self, + resource_group_name: impl Into, + service_name: impl Into, + named_value_id: impl Into, + subscription_id: impl Into, + ) -> refresh_secret::Builder { + refresh_secret::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + named_value_id: named_value_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) is_key_vault_refresh_failed: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn is_key_vault_refresh_failed(mut self, is_key_vault_refresh_failed: bool) -> Self { + self.is_key_vault_refresh_failed = Some(is_key_vault_refresh_failed); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(is_key_vault_refresh_failed) = &self.is_key_vault_refresh_failed { + url.query_pairs_mut() + .append_pair("isKeyVaultRefreshFailed", &is_key_vault_refresh_failed.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::NamedValueContract), + Ok200(models::NamedValueContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueCreateContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::NamedValueContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) parameters: models::NamedValueUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_value { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/listValue", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh_secret { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::NamedValueContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) named_value_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/namedValues/{}/refreshSecret", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.named_value_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NamedValueContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn list_by_location( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + location_name: impl Into, + ) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + location_name: location_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_location { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) location_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/locations/{}/networkstatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.location_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkStatusContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notification { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.notification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotificationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notification_recipient_user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientUserContract), + Ok200(models::RecipientUserContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientUserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientUsers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . user_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notification_recipient_email { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_notification( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + subscription_id: impl Into, + ) -> list_by_notification::Builder { + list_by_notification::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + notification_name: impl Into, + email: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + notification_name: notification_name.into(), + email: email.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_notification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::RecipientEmailContract), + Ok200(models::RecipientEmailContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) email: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecipientEmailContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) email: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) notification_name: String, + pub(crate) email: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/notifications/{}/recipientEmails/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . notification_name , & self . email) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod open_id_connect_provider { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + opid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + opid: opid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenIdConnectProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::OpenidConnectProviderContract), + Ok200(models::OpenidConnectProviderContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) parameters: models::OpenidConnectProviderUpdateContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenidConnectProviderContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.opid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) opid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/openidConnectProviders/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . opid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientSecretContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod outbound_network_dependencies_endpoints { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + policy_id: policy_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + policy_id: policy_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_description { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + scope: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) scope: Option, + } + impl Builder { + pub fn scope(mut self, scope: impl Into) -> Self { + self.scope = Some(scope.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyDescriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(scope) = &self.scope { + url.query_pairs_mut().append_pair("scope", scope); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyDescriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod policy_fragment { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + orderby: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + id: id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + id: id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + id: id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + id: id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_references( + &self, + resource_group_name: impl Into, + service_name: impl Into, + id: impl Into, + subscription_id: impl Into, + ) -> list_references::Builder { + list_references::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + id: id.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) orderby: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyFragmentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyFragmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PolicyFragmentContract), + Created201(models::PolicyFragmentContract), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) id: String, + pub(crate) parameters: models::PolicyFragmentContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyFragmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyFragmentContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_references { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) id: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/policyFragments/{}/listReferences" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod portal_revision { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + portal_revision_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_revision_id: portal_revision_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_revision_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Created201(models::PortalRevisionContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_revision_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PortalRevisionContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) parameters: models::PortalRevisionContract, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_revision_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalRevisionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_revision_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalRevisions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_revision_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod portal_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSettingsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod sign_in_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSigninSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalSigninSettings, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signin", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod sign_up_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSignupSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalSignupSettings, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/signup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod delegation_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalDelegationSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PortalDelegationSettings, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalsettings/delegation/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalSettingValidationKeyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod portal_config { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + portal_config_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_config_id: portal_config_id.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + portal_config_id: impl Into, + if_match: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_config_id: portal_config_id.into(), + if_match: if_match.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + portal_config_id: impl Into, + if_match: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_config_id: portal_config_id.into(), + if_match: if_match.into(), + parameters: parameters.into(), + } + } + pub fn get_entity_tag( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + portal_config_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + portal_config_id: portal_config_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalconfigs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalConfigCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_config_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalconfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_config_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalConfigContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_config_id: String, + pub(crate) if_match: String, + pub(crate) parameters: models::PortalConfigContract, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalconfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_config_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalConfigContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_config_id: String, + pub(crate) if_match: String, + pub(crate) parameters: models::PortalConfigContract, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalconfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_config_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PortalConfigContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) portal_config_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/portalconfigs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.portal_config_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + service_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + } + } + pub fn get_by_name( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_request: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_request: private_endpoint_connection_request.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_private_link_resources( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + ) -> list_private_link_resources::Builder { + list_private_link_resources::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + } + } + pub fn get_private_link_resource( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + service_name: impl Into, + private_link_sub_resource_name: impl Into, + ) -> get_private_link_resource::Builder { + get_private_link_resource::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + service_name: service_name.into(), + private_link_sub_resource_name: private_link_sub_resource_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PrivateEndpointConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_request: models::PrivateEndpointConnectionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.private_endpoint_connection_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_private_link_resources { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_private_link_resource { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) service_name: String, + pub(crate) private_link_sub_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.private_link_sub_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod product { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + expand_groups: None, + tags: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_subscriptions: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_tags( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_tags::Builder { + list_by_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + include_not_tagged_products: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + pub(crate) tags: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn tags(mut self, tags: impl Into) -> Self { + self.tags = Some(tags.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + if let Some(tags) = &self.tags { + url.query_pairs_mut().append_pair("tags", tags); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ProductContract), + Ok200(models::ProductContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) parameters: models::ProductContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) parameters: models::ProductUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProductContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, + } + impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) include_not_tagged_products: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn include_not_tagged_products(mut self, include_not_tagged_products: bool) -> Self { + self.include_not_tagged_products = Some(include_not_tagged_products); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/productsByTags", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(include_not_tagged_products) = &self.include_not_tagged_products { + url.query_pairs_mut() + .append_pair("includeNotTaggedProducts", &include_not_tagged_products.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod product_api { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + api_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + api_id: api_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApiContract), + Ok200(models::ApiContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) api_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/apis/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.api_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod product_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_entity_exists( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + group_id: impl Into, + subscription_id: impl Into, + ) -> check_entity_exists::Builder { + check_entity_exists::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + group_id: group_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GroupContract), + Ok200(models::GroupContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_entity_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) group_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/groups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.group_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod product_subscriptions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/subscriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod product_policy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + format: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + policy_id: policy_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + policy_id: policy_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + product_id: impl Into, + policy_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + product_id: product_id.into(), + policy_id: policy_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + pub(crate) format: Option, + } + impl Builder { + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PolicyContract), + Ok200(models::PolicyContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) parameters: models::PolicyContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) product_id: String, + pub(crate) policy_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/products/{}/policies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.product_id, + &self.policy_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod quota_by_counter_keys { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + quota_counter_key: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + quota_counter_key: quota_counter_key.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + quota_counter_key: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + quota_counter_key: quota_counter_key.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) quota_counter_key: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/quotas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.quota_counter_key + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuotaCounterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) quota_counter_key: String, + pub(crate) parameters: models::QuotaCounterValueUpdateContract, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/quotas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.quota_counter_key + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuotaCounterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod quota_by_period_keys { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + quota_counter_key: impl Into, + quota_period_key: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + quota_counter_key: quota_counter_key.into(), + quota_period_key: quota_period_key.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + quota_counter_key: impl Into, + quota_period_key: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + quota_counter_key: quota_counter_key.into(), + quota_period_key: quota_period_key.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) quota_counter_key: String, + pub(crate) quota_period_key: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/quotas/{}/periods/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.quota_counter_key, + &self.quota_period_key + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuotaCounterContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) quota_counter_key: String, + pub(crate) quota_period_key: String, + pub(crate) parameters: models::QuotaCounterValueUpdateContract, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/quotas/{}/periods/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.quota_counter_key, + &self.quota_period_key + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuotaCounterContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod region { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/regions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod reports { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_api( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_api::Builder { + list_by_api::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_user( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_user::Builder { + list_by_user::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_operation( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_operation::Builder { + list_by_operation::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_product( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_product::Builder { + list_by_product::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_geo( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_geo::Builder { + list_by_geo::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + } + } + pub fn list_by_subscription( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_time( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + interval: impl Into, + subscription_id: impl Into, + ) -> list_by_time::Builder { + list_by_time::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + interval: interval.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + orderby: None, + } + } + pub fn list_by_request( + &self, + resource_group_name: impl Into, + service_name: impl Into, + filter: impl Into, + subscription_id: impl Into, + ) -> list_by_request::Builder { + list_by_request::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + filter: filter.into(), + subscription_id: subscription_id.into(), + top: None, + skip: None, + } + } + } + pub mod list_by_api { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byApi", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_user { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byUser", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_operation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byOperation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_product { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byProduct", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_geo { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byGeo", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/bySubscription", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_time { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) interval: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byTime", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let interval = &self.interval; + url.query_pairs_mut().append_pair("interval", interval); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_request { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) filter: String, + pub(crate) subscription_id: String, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/reports/byRequest", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RequestReportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod global_schema { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + if_match: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + schema_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + schema_id: schema_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::GlobalSchemaContract), + Ok200(models::GlobalSchemaContract), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) parameters: models::GlobalSchemaContract, + pub(crate) subscription_id: String, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GlobalSchemaContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) schema_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/schemas/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.schema_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tenant_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + settings_type: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + settings_type: settings_type.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/settings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TenantSettingsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) settings_type: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/settings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.settings_type + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TenantSettingsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod api_management_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ApiManagement/skus", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiManagementSkusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod subscription { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + notify: None, + if_match: None, + app_type: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + notify: None, + app_type: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_primary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> regenerate_primary_key::Builder { + regenerate_primary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_secondary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> regenerate_secondary_key::Builder { + regenerate_secondary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::SubscriptionContract), + Ok200(models::SubscriptionContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) parameters: models::SubscriptionCreateParameters, + pub(crate) subscription_id: String, + pub(crate) notify: Option, + pub(crate) if_match: Option, + pub(crate) app_type: Option, + } + impl Builder { + pub fn notify(mut self, notify: bool) -> Self { + self.notify = Some(notify); + self + } + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn app_type(mut self, app_type: impl Into) -> Self { + self.app_type = Some(app_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(notify) = &self.notify { + url.query_pairs_mut().append_pair("notify", ¬ify.to_string()); + } + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + if let Some(app_type) = &self.app_type { + url.query_pairs_mut().append_pair("appType", app_type); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) parameters: models::SubscriptionUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) notify: Option, + pub(crate) app_type: Option, + } + impl Builder { + pub fn notify(mut self, notify: bool) -> Self { + self.notify = Some(notify); + self + } + pub fn app_type(mut self, app_type: impl Into) -> Self { + self.app_type = Some(app_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(notify) = &self.notify { + url.query_pairs_mut().append_pair("notify", ¬ify.to_string()); + } + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(app_type) = &self.app_type { + url.query_pairs_mut().append_pair("appType", app_type); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("If-Match", &self.if_match); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_primary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}/regeneratePrimaryKey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . sid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_secondary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}/regenerateSecondaryKey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . sid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/subscriptions/{}/listSecrets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionKeysContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tag_resource { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tagResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TagResourceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tenant_access { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + access_name: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + access_name: access_name.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + access_name: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + access_name: access_name.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + pub fn regenerate_primary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> regenerate_primary_key::Builder { + regenerate_primary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + pub fn regenerate_secondary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> regenerate_secondary_key::Builder { + regenerate_secondary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + pub fn list_secrets( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessInformationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessInformationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::AccessInformationCreateParameters, + pub(crate) access_name: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessInformationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::AccessInformationUpdateParameters, + pub(crate) access_name: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessInformationContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_primary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/regeneratePrimaryKey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_secondary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/regenerateSecondaryKey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . access_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/listSecrets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.access_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessInformationSecretsContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tenant_access_git { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn regenerate_primary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> regenerate_primary_key::Builder { + regenerate_primary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + pub fn regenerate_secondary_key( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + access_name: impl Into, + ) -> regenerate_secondary_key::Builder { + regenerate_secondary_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + access_name: access_name.into(), + } + } + } + pub mod regenerate_primary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/git/regeneratePrimaryKey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . access_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_secondary_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) access_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/git/regenerateSecondaryKey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . access_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod tenant_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn deploy( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + configuration_name: impl Into, + ) -> deploy::Builder { + deploy::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + configuration_name: configuration_name.into(), + } + } + pub fn save( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + configuration_name: impl Into, + ) -> save::Builder { + save::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + configuration_name: configuration_name.into(), + } + } + pub fn validate( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + configuration_name: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + configuration_name: configuration_name.into(), + } + } + pub fn get_sync_state( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + configuration_name: impl Into, + ) -> get_sync_state::Builder { + get_sync_state::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + configuration_name: configuration_name.into(), + } + } + } + pub mod deploy { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationResultContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::DeployConfigurationParameters, + pub(crate) subscription_id: String, + pub(crate) configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/deploy", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod save { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationResultContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::SaveConfigurationParameter, + pub(crate) subscription_id: String, + pub(crate) configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/save", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationResultContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::DeployConfigurationParameters, + pub(crate) subscription_id: String, + pub(crate) configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/validate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sync_state { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) configuration_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/tenant/{}/syncState", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TenantConfigurationSyncStateContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod user { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + expand_groups: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + notify: None, + if_match: None, + } + } + pub fn update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + parameters: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + parameters: parameters.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + if_match: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + if_match: if_match.into(), + subscription_id: subscription_id.into(), + delete_subscriptions: None, + notify: None, + app_type: None, + } + } + pub fn get_entity_tag( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> get_entity_tag::Builder { + get_entity_tag::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_sso_url( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> generate_sso_url::Builder { + generate_sso_url::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_shared_access_token( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_shared_access_token::Builder { + get_shared_access_token::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + pub(crate) expand_groups: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn expand_groups(mut self, expand_groups: bool) -> Self { + self.expand_groups = Some(expand_groups); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + if let Some(expand_groups) = &self.expand_groups { + url.query_pairs_mut().append_pair("expandGroups", &expand_groups.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::UserContract), + Ok200(models::UserContract), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) parameters: models::UserCreateParameters, + pub(crate) subscription_id: String, + pub(crate) notify: Option, + pub(crate) if_match: Option, + } + impl Builder { + pub fn notify(mut self, notify: bool) -> Self { + self.notify = Some(notify); + self + } + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(notify) = &self.notify { + url.query_pairs_mut().append_pair("notify", ¬ify.to_string()); + } + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) parameters: models::UserUpdateParameters, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.header("If-Match", &self.if_match); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) if_match: String, + pub(crate) subscription_id: String, + pub(crate) delete_subscriptions: Option, + pub(crate) notify: Option, + pub(crate) app_type: Option, + } + impl Builder { + pub fn delete_subscriptions(mut self, delete_subscriptions: bool) -> Self { + self.delete_subscriptions = Some(delete_subscriptions); + self + } + pub fn notify(mut self, notify: bool) -> Self { + self.notify = Some(notify); + self + } + pub fn app_type(mut self, app_type: impl Into) -> Self { + self.app_type = Some(app_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(delete_subscriptions) = &self.delete_subscriptions { + url.query_pairs_mut() + .append_pair("deleteSubscriptions", &delete_subscriptions.to_string()); + } + if let Some(notify) = &self.notify { + url.query_pairs_mut().append_pair("notify", ¬ify.to_string()); + } + req_builder = req_builder.header("If-Match", &self.if_match); + if let Some(app_type) = &self.app_type { + url.query_pairs_mut().append_pair("appType", app_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_tag { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_sso_url { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/generateSsoUrl", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GenerateSsoUrlResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_shared_access_token { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) parameters: models::UserTokenParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/token", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserTokenResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod user_group { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/groups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod user_subscription { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + filter: None, + top: None, + skip: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + sid: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + sid: sid.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) skip: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn skip(mut self, skip: i32) -> Self { + self.skip = Some(skip); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/subscriptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip) = &self.skip { + url.query_pairs_mut().append_pair("$skip", &skip.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) sid: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/subscriptions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id, + &self.sid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubscriptionContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod user_identities { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/identities", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name, + &self.user_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserIdentityCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod user_confirmation_password { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn send( + &self, + resource_group_name: impl Into, + service_name: impl Into, + user_id: impl Into, + subscription_id: impl Into, + ) -> send::Builder { + send::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + user_id: user_id.into(), + subscription_id: subscription_id.into(), + app_type: None, + } + } + } + pub mod send { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) user_id: String, + pub(crate) subscription_id: String, + pub(crate) app_type: Option, + } + impl Builder { + pub fn app_type(mut self, app_type: impl Into) -> Self { + self.app_type = Some(app_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ApiManagement/service/{}/users/{}/confirmations/password/send" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . user_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(app_type) = &self.app_type { + url.query_pairs_mut().append_pair("appType", app_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/app/Cargo.toml b/services/mgmt/app/Cargo.toml index 9fafe9e7ea..4b284b4cfd 100644 --- a/services/mgmt/app/Cargo.toml +++ b/services/mgmt/app/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_app" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/app/README.md b/services/mgmt/app/README.md index d03f8a5d5e..d18a6f0183 100644 --- a/services/mgmt/app/README.md +++ b/services/mgmt/app/README.md @@ -10,5 +10,5 @@ The default tag is `package-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2022-03` has 44 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. +- `package-2022-03` has 45 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. - `package-2022-01-01-preview` has 43 operations from 1 API versions: `2022-01-01-preview`. Use crate feature `package-2022-01-01-preview` to enable. The operations will be in the `package_2022_01_01_preview` module. \ No newline at end of file diff --git a/services/mgmt/app/src/package_2022_03/models.rs b/services/mgmt/app/src/package_2022_03/models.rs index 3a4e4ddfad..3442e71a9e 100644 --- a/services/mgmt/app/src/package_2022_03/models.rs +++ b/services/mgmt/app/src/package_2022_03/models.rs @@ -1042,6 +1042,17 @@ impl DaprMetadata { Self::default() } } +#[doc = "Dapr component Secrets Collection ARM resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DaprSecretsCollection { + #[doc = "Collection of secrets used by a Dapr component"] + pub value: Vec, +} +impl DaprSecretsCollection { + pub fn new(value: Vec) -> Self { + Self { value } + } +} #[doc = "The configuration settings of the Azure Active Directory default authorization policy."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct DefaultAuthorizationPolicy { @@ -1491,6 +1502,9 @@ pub mod managed_environment { #[doc = "Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry"] #[serde(rename = "daprAIInstrumentationKey", default, skip_serializing_if = "Option::is_none")] pub dapr_ai_instrumentation_key: Option, + #[doc = "Application Insights connection string used by Dapr to export Service to Service communication telemetry"] + #[serde(rename = "daprAIConnectionString", default, skip_serializing_if = "Option::is_none")] + pub dapr_ai_connection_string: Option, #[doc = "Configuration properties for apps environment to join a Virtual Network"] #[serde(rename = "vnetConfiguration", default, skip_serializing_if = "Option::is_none")] pub vnet_configuration: Option, @@ -1506,6 +1520,9 @@ pub mod managed_environment { #[doc = "Configuration of application logs"] #[serde(rename = "appLogsConfiguration", default, skip_serializing_if = "Option::is_none")] pub app_logs_configuration: Option, + #[doc = "Whether or not this Managed Environment is zone-redundant."] + #[serde(rename = "zoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub zone_redundant: Option, } impl Properties { pub fn new() -> Self { @@ -1797,6 +1814,9 @@ pub struct RegistryCredentials { #[doc = "The name of the Secret that contains the registry login password"] #[serde(rename = "passwordSecretRef", default, skip_serializing_if = "Option::is_none")] pub password_secret_ref: Option, + #[doc = "A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned identities, use 'system'"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, } impl RegistryCredentials { pub fn new() -> Self { diff --git a/services/mgmt/app/src/package_2022_03/operations.rs b/services/mgmt/app/src/package_2022_03/operations.rs index 92c071d564..50fe036daa 100644 --- a/services/mgmt/app/src/package_2022_03/operations.rs +++ b/services/mgmt/app/src/package_2022_03/operations.rs @@ -159,6 +159,8 @@ pub enum Error { #[error(transparent)] DaprComponents_Delete(#[from] dapr_components::delete::Error), #[error(transparent)] + DaprComponents_ListSecrets(#[from] dapr_components::list_secrets::Error), + #[error(transparent)] Operations_List(#[from] operations::list::Error), #[error(transparent)] ManagedEnvironments_ListBySubscription(#[from] managed_environments::list_by_subscription::Error), @@ -2082,6 +2084,22 @@ pub mod dapr_components { name: name.into(), } } + #[doc = "List secrets for a dapr component"] + pub fn list_secrets( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + environment_name: impl Into, + name: impl Into, + ) -> list_secrets::Builder { + list_secrets::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + environment_name: environment_name.into(), + name: name.into(), + } + } } pub mod list { use super::models; @@ -2400,6 +2418,79 @@ pub mod dapr_components { } } } + pub mod list_secrets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::DefaultErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) environment_name: String, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/managedEnvironments/{}/daprComponents/{}/listSecrets" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . environment_name , & self . name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DaprSecretsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DefaultErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } } pub mod operations { use super::models; diff --git a/services/mgmt/appconfiguration/Cargo.toml b/services/mgmt/appconfiguration/Cargo.toml index c52cfe125a..f295362f58 100644 --- a/services/mgmt/appconfiguration/Cargo.toml +++ b/services/mgmt/appconfiguration/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_appconfiguration" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/applicationinsights/Cargo.toml b/services/mgmt/applicationinsights/Cargo.toml index 4bcb7a93bc..7dec62dcbb 100644 --- a/services/mgmt/applicationinsights/Cargo.toml +++ b/services/mgmt/applicationinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_applicationinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/appplatform/Cargo.toml b/services/mgmt/appplatform/Cargo.toml index d984d99299..3da30d8d3d 100644 --- a/services/mgmt/appplatform/Cargo.toml +++ b/services/mgmt/appplatform/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_appplatform" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/arcdata/Cargo.toml b/services/mgmt/arcdata/Cargo.toml index 5532dd8031..e783f6ebd4 100644 --- a/services/mgmt/arcdata/Cargo.toml +++ b/services/mgmt/arcdata/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_arcdata" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/arcdata/src/package_preview_2022_03/models.rs b/services/mgmt/arcdata/src/package_preview_2022_03/models.rs index de508595a9..d38cd343a0 100644 --- a/services/mgmt/arcdata/src/package_preview_2022_03/models.rs +++ b/services/mgmt/arcdata/src/package_preview_2022_03/models.rs @@ -36,6 +36,12 @@ pub struct ActiveDirectoryConnectorDomainDetails { #[doc = "NETBIOS name of the Active Directory domain."] #[serde(rename = "netbiosDomainName", default, skip_serializing_if = "Option::is_none")] pub netbios_domain_name: Option, + #[doc = "The service account provisioning mode for this Active Directory connector."] + #[serde(rename = "serviceAccountProvisioning", default, skip_serializing_if = "Option::is_none")] + pub service_account_provisioning: Option, + #[doc = "The distinguished name of the Active Directory Organizational Unit."] + #[serde(rename = "ouDistinguishedName", default, skip_serializing_if = "Option::is_none")] + pub ou_distinguished_name: Option, #[doc = "Details about the Active Directory domain controllers associated with this AD connector instance"] #[serde(rename = "domainControllers")] pub domain_controllers: ActiveDirectoryDomainControllers, @@ -45,10 +51,28 @@ impl ActiveDirectoryConnectorDomainDetails { Self { realm, netbios_domain_name: None, + service_account_provisioning: None, + ou_distinguished_name: None, domain_controllers, } } } +pub mod active_directory_connector_domain_details { + use super::*; + #[doc = "The service account provisioning mode for this Active Directory connector."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServiceAccountProvisioning { + #[serde(rename = "automatic")] + Automatic, + #[serde(rename = "manual")] + Manual, + } + impl Default for ServiceAccountProvisioning { + fn default() -> Self { + Self::Manual + } + } +} #[doc = "A list of active directory connectors"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct ActiveDirectoryConnectorListResult { @@ -67,6 +91,9 @@ impl ActiveDirectoryConnectorListResult { #[doc = "The properties of an Active Directory connector resource"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ActiveDirectoryConnectorProperties { + #[doc = "Username and password for basic login authentication."] + #[serde(rename = "domainServiceAccountLoginInformation", default, skip_serializing_if = "Option::is_none")] + pub domain_service_account_login_information: Option, #[doc = "The provisioning state of the Active Directory connector resource."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] pub provisioning_state: Option, @@ -79,6 +106,7 @@ pub struct ActiveDirectoryConnectorProperties { impl ActiveDirectoryConnectorProperties { pub fn new(spec: ActiveDirectoryConnectorSpec) -> Self { Self { + domain_service_account_login_information: None, provisioning_state: None, spec, status: None, @@ -159,6 +187,18 @@ impl ActiveDirectoryDomainControllers { Self::default() } } +#[doc = "Active Directory information that related to the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActiveDirectoryInformation { + #[doc = "Keytab used for authenticate with Active Directory."] + #[serde(rename = "keytabInformation", default, skip_serializing_if = "Option::is_none")] + pub keytab_information: Option, +} +impl ActiveDirectoryInformation { + pub fn new() -> Self { + Self::default() + } +} pub type ActiveDirectorySecondaryDomainControllers = Vec; #[doc = "Username and password for basic login authentication."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] @@ -403,6 +443,18 @@ impl K8sSchedulingOptions { Self::default() } } +#[doc = "Keytab used for authenticate with Active Directory."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeytabInformation { + #[doc = "A base64-encoded keytab."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keytab: Option, +} +impl KeytabInformation { + pub fn new() -> Self { + Self::default() + } +} #[doc = "Log analytics workspace id and primary key"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct LogAnalyticsWorkspaceConfig { @@ -763,9 +815,9 @@ pub struct SqlManagedInstanceProperties { #[doc = "The provisioning state of the Arc-enabled SQL Managed Instance resource."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] pub provisioning_state: Option, - #[doc = "A base64-encoded keytab."] - #[serde(default, skip_serializing_if = "Option::is_none")] - pub keytab: Option, + #[doc = "Active Directory information that related to the resource."] + #[serde(rename = "activeDirectoryInformation", default, skip_serializing_if = "Option::is_none")] + pub active_directory_information: Option, #[doc = "The license type to apply for this managed instance."] #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] pub license_type: Option, @@ -946,9 +998,6 @@ pub struct SqlServerInstanceProperties { #[doc = "The provisioning state of the Arc-enabled SQL Server resource."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] pub provisioning_state: Option, - #[doc = "Timestamp of ESU Expiration."] - #[serde(rename = "esuExpirationDate", default, skip_serializing_if = "Option::is_none")] - pub esu_expiration_date: Option, #[doc = "Type of host for Azure Arc SQL Server"] #[serde(rename = "hostType", default, skip_serializing_if = "Option::is_none")] pub host_type: Option, @@ -973,7 +1022,6 @@ impl SqlServerInstanceProperties { azure_defender_status_last_updated: None, azure_defender_status: None, provisioning_state: None, - esu_expiration_date: None, host_type: None, } } diff --git a/services/mgmt/arcdata/src/package_preview_2022_03/operations.rs b/services/mgmt/arcdata/src/package_preview_2022_03/operations.rs index c883e04821..0b8a7cdcd4 100644 --- a/services/mgmt/arcdata/src/package_preview_2022_03/operations.rs +++ b/services/mgmt/arcdata/src/package_preview_2022_03/operations.rs @@ -1748,6 +1748,11 @@ pub mod data_controllers { } pub mod patch_data_controller { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataControllerResource), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -1779,7 +1784,7 @@ pub mod data_controllers { pub(crate) data_controller_resource: models::DataControllerUpdate, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AzureArcData/dataControllers/{}", @@ -1809,8 +1814,9 @@ pub mod data_controllers { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::DataControllerResource = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) + Ok(Response::Ok200(rsp_value)) } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ErrorResponse = diff --git a/services/mgmt/attestation/Cargo.toml b/services/mgmt/attestation/Cargo.toml index a48ee2ab2d..c26bf79710 100644 --- a/services/mgmt/attestation/Cargo.toml +++ b/services/mgmt/attestation/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_attestation" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/authorization/Cargo.toml b/services/mgmt/authorization/Cargo.toml index 80d3be3437..1744f78398 100644 --- a/services/mgmt/authorization/Cargo.toml +++ b/services/mgmt/authorization/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_authorization" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/automanage/Cargo.toml b/services/mgmt/automanage/Cargo.toml index 05bd0b6ef9..aa463f0a26 100644 --- a/services/mgmt/automanage/Cargo.toml +++ b/services/mgmt/automanage/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_automanage" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/automation/Cargo.toml b/services/mgmt/automation/Cargo.toml index fc70141673..bbc6878b41 100644 --- a/services/mgmt/automation/Cargo.toml +++ b/services/mgmt/automation/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_automation" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/automation/src/package_2020_01_13_preview/models.rs b/services/mgmt/automation/src/package_2020_01_13_preview/models.rs index 3e3f85ace0..a3f0526b8b 100644 --- a/services/mgmt/automation/src/package_2020_01_13_preview/models.rs +++ b/services/mgmt/automation/src/package_2020_01_13_preview/models.rs @@ -1785,6 +1785,7 @@ impl FieldDefinition { } } } +pub type GroupIdsProperty = Vec; #[doc = "Definition of hybrid runbook worker."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HybridRunbookWorker { @@ -2695,6 +2696,9 @@ pub struct PrivateEndpointConnectionProperties { #[doc = "Private endpoint which the connection belongs to."] #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] pub private_endpoint: Option, + #[doc = "Gets the groupIds."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Option::is_none")] + pub group_ids: Option, #[doc = "Connection State of the Private Endpoint Connection."] #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] pub private_link_service_connection_state: Option, diff --git a/services/mgmt/automation/src/package_2021_06_22/models.rs b/services/mgmt/automation/src/package_2021_06_22/models.rs index caa4f37b12..21ac3147d9 100644 --- a/services/mgmt/automation/src/package_2021_06_22/models.rs +++ b/services/mgmt/automation/src/package_2021_06_22/models.rs @@ -1815,6 +1815,7 @@ impl GraphicalRunbookContent { Self::default() } } +pub type GroupIdsProperty = Vec; #[doc = "Definition of hybrid runbook worker."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HybridRunbookWorker { @@ -2849,6 +2850,9 @@ pub struct PrivateEndpointConnectionProperties { #[doc = "Private endpoint which the connection belongs to."] #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] pub private_endpoint: Option, + #[doc = "Gets the groupIds."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Option::is_none")] + pub group_ids: Option, #[doc = "Connection State of the Private Endpoint Connection."] #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] pub private_link_service_connection_state: Option, diff --git a/services/mgmt/automation/src/package_2022_01_31/models.rs b/services/mgmt/automation/src/package_2022_01_31/models.rs index d7f399bad0..a16701a4ee 100644 --- a/services/mgmt/automation/src/package_2022_01_31/models.rs +++ b/services/mgmt/automation/src/package_2022_01_31/models.rs @@ -1872,6 +1872,7 @@ impl GraphicalRunbookContent { Self::default() } } +pub type GroupIdsProperty = Vec; #[doc = "Definition of hybrid runbook worker."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HybridRunbookWorker { @@ -2906,6 +2907,9 @@ pub struct PrivateEndpointConnectionProperties { #[doc = "Private endpoint which the connection belongs to."] #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] pub private_endpoint: Option, + #[doc = "Gets the groupIds."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Option::is_none")] + pub group_ids: Option, #[doc = "Connection State of the Private Endpoint Connection."] #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] pub private_link_service_connection_state: Option, diff --git a/services/mgmt/baremetalinfrastructure/Cargo.toml b/services/mgmt/baremetalinfrastructure/Cargo.toml index 663163c03f..6df2cc242c 100644 --- a/services/mgmt/baremetalinfrastructure/Cargo.toml +++ b/services/mgmt/baremetalinfrastructure/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_baremetalinfrastructure" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/batch/Cargo.toml b/services/mgmt/batch/Cargo.toml index 3eb2f928ca..9d249ae0ce 100644 --- a/services/mgmt/batch/Cargo.toml +++ b/services/mgmt/batch/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_batch" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/billing/Cargo.toml b/services/mgmt/billing/Cargo.toml index 9837e7cce6..3cc07db204 100644 --- a/services/mgmt/billing/Cargo.toml +++ b/services/mgmt/billing/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_billing" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/blockchain/Cargo.toml b/services/mgmt/blockchain/Cargo.toml index 18765ea5e3..572a8f29cb 100644 --- a/services/mgmt/blockchain/Cargo.toml +++ b/services/mgmt/blockchain/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_blockchain" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/blueprint/Cargo.toml b/services/mgmt/blueprint/Cargo.toml index 8ff1ff159c..c8088bc64b 100644 --- a/services/mgmt/blueprint/Cargo.toml +++ b/services/mgmt/blueprint/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_blueprint" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/botservice/Cargo.toml b/services/mgmt/botservice/Cargo.toml index d579fe7087..ba2bbca57b 100644 --- a/services/mgmt/botservice/Cargo.toml +++ b/services/mgmt/botservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_botservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/cdn/Cargo.toml b/services/mgmt/cdn/Cargo.toml index 63c10253de..7412299c16 100644 --- a/services/mgmt/cdn/Cargo.toml +++ b/services/mgmt/cdn/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_cdn" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/changeanalysis/Cargo.toml b/services/mgmt/changeanalysis/Cargo.toml index a446d07cf7..b2f4f2ec41 100644 --- a/services/mgmt/changeanalysis/Cargo.toml +++ b/services/mgmt/changeanalysis/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_changeanalysis" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/chaos/Cargo.toml b/services/mgmt/chaos/Cargo.toml index e9082a19f9..3b256df1c7 100644 --- a/services/mgmt/chaos/Cargo.toml +++ b/services/mgmt/chaos/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_chaos" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/chaos/src/package_2021_09_15_preview/models.rs b/services/mgmt/chaos/src/package_2021_09_15_preview/models.rs index 3fbda04da0..a9bd34fdf8 100644 --- a/services/mgmt/chaos/src/package_2021_09_15_preview/models.rs +++ b/services/mgmt/chaos/src/package_2021_09_15_preview/models.rs @@ -195,6 +195,12 @@ pub struct ActionStatus { #[doc = "The status of the action."] #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, + #[doc = "String that represents the start time of the action."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "String that represents the end time of the action."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, #[doc = "The array of targets."] #[serde(default, skip_serializing_if = "Vec::is_empty")] pub targets: Vec, diff --git a/services/mgmt/cloudshell/Cargo.toml b/services/mgmt/cloudshell/Cargo.toml index 81296a6aa8..5a1cca2306 100644 --- a/services/mgmt/cloudshell/Cargo.toml +++ b/services/mgmt/cloudshell/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_cloudshell" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/cognitiveservices/Cargo.toml b/services/mgmt/cognitiveservices/Cargo.toml index ad1362d487..5796ad2fbc 100644 --- a/services/mgmt/cognitiveservices/Cargo.toml +++ b/services/mgmt/cognitiveservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_cognitiveservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/commerce/Cargo.toml b/services/mgmt/commerce/Cargo.toml index 062d59ee03..36d5651384 100644 --- a/services/mgmt/commerce/Cargo.toml +++ b/services/mgmt/commerce/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_commerce" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/communication/Cargo.toml b/services/mgmt/communication/Cargo.toml index b9608f3258..acf1e3731f 100644 --- a/services/mgmt/communication/Cargo.toml +++ b/services/mgmt/communication/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_communication" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/compute/Cargo.toml b/services/mgmt/compute/Cargo.toml index 3c2a367cd0..68475f5485 100644 --- a/services/mgmt/compute/Cargo.toml +++ b/services/mgmt/compute/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_compute" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/confidentialledger/Cargo.toml b/services/mgmt/confidentialledger/Cargo.toml index b139bd12b8..343391ad14 100644 --- a/services/mgmt/confidentialledger/Cargo.toml +++ b/services/mgmt/confidentialledger/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_confidentialledger" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/confluent/Cargo.toml b/services/mgmt/confluent/Cargo.toml index fe70f8f9a3..1900159aa1 100644 --- a/services/mgmt/confluent/Cargo.toml +++ b/services/mgmt/confluent/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_confluent" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/connectedvmware/Cargo.toml b/services/mgmt/connectedvmware/Cargo.toml index 76f9dff140..860950bf22 100644 --- a/services/mgmt/connectedvmware/Cargo.toml +++ b/services/mgmt/connectedvmware/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_connectedvmware" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/consumption/Cargo.toml b/services/mgmt/consumption/Cargo.toml index 0a08e75e60..b33302ff3b 100644 --- a/services/mgmt/consumption/Cargo.toml +++ b/services/mgmt/consumption/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_consumption" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/consumption/src/package_2019_10/models.rs b/services/mgmt/consumption/src/package_2019_10/models.rs index c6b59796ae..21d895eebc 100644 --- a/services/mgmt/consumption/src/package_2019_10/models.rs +++ b/services/mgmt/consumption/src/package_2019_10/models.rs @@ -1364,16 +1364,12 @@ pub struct ModernReservationRecommendation { pub reservation_recommendation: ReservationRecommendation, #[doc = "The properties of the reservation recommendation."] pub properties: ModernReservationRecommendationProperties, - #[doc = "Resource eTag."] - #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] - pub e_tag: Option, } impl ModernReservationRecommendation { pub fn new(reservation_recommendation: ReservationRecommendation, properties: ModernReservationRecommendationProperties) -> Self { Self { reservation_recommendation, properties, - e_tag: None, } } } @@ -2168,9 +2164,6 @@ pub struct ReservationRecommendationDetailsModel { #[doc = "Resource sku"] #[serde(default, skip_serializing_if = "Option::is_none")] pub sku: Option, - #[doc = "Resource eTag."] - #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] - pub e_tag: Option, #[doc = "The properties of the reservation recommendation."] #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, diff --git a/services/mgmt/consumption/src/package_2021_10/models.rs b/services/mgmt/consumption/src/package_2021_10/models.rs index fbbe19d617..6c00e2ce2c 100644 --- a/services/mgmt/consumption/src/package_2021_10/models.rs +++ b/services/mgmt/consumption/src/package_2021_10/models.rs @@ -2231,9 +2231,6 @@ pub struct ReservationRecommendationDetailsModel { #[doc = "Resource sku"] #[serde(default, skip_serializing_if = "Option::is_none")] pub sku: Option, - #[doc = "Resource etag."] - #[serde(default, skip_serializing_if = "Option::is_none")] - pub etag: Option, #[doc = "The properties of the reservation recommendation."] #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, diff --git a/services/mgmt/consumption/src/package_2021_10/operations.rs b/services/mgmt/consumption/src/package_2021_10/operations.rs index c941e902eb..c1a53fe6e6 100644 --- a/services/mgmt/consumption/src/package_2021_10/operations.rs +++ b/services/mgmt/consumption/src/package_2021_10/operations.rs @@ -1191,10 +1191,10 @@ pub mod reservations_summaries { filter: None, } } - pub fn list(&self, scope: impl Into, grain: impl Into) -> list::Builder { + pub fn list(&self, resource_scope: impl Into, grain: impl Into) -> list::Builder { list::Builder { client: self.0.clone(), - scope: scope.into(), + resource_scope: resource_scope.into(), grain: grain.into(), start_date: None, end_date: None, @@ -1400,7 +1400,7 @@ pub mod reservations_summaries { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) scope: String, + pub(crate) resource_scope: String, pub(crate) grain: String, pub(crate) start_date: Option, pub(crate) end_date: Option, @@ -1436,7 +1436,7 @@ pub mod reservations_summaries { let url_str = &format!( "{}/{}/providers/Microsoft.Consumption/reservationSummaries", self.client.endpoint(), - &self.scope + &self.resource_scope ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1520,10 +1520,10 @@ pub mod reservations_details { filter: filter.into(), } } - pub fn list(&self, scope: impl Into) -> list::Builder { + pub fn list(&self, resource_scope: impl Into) -> list::Builder { list::Builder { client: self.0.clone(), - scope: scope.into(), + resource_scope: resource_scope.into(), start_date: None, end_date: None, filter: None, @@ -1712,7 +1712,7 @@ pub mod reservations_details { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) scope: String, + pub(crate) resource_scope: String, pub(crate) start_date: Option, pub(crate) end_date: Option, pub(crate) filter: Option, @@ -1747,7 +1747,7 @@ pub mod reservations_details { let url_str = &format!( "{}/{}/providers/Microsoft.Consumption/reservationDetails", self.client.endpoint(), - &self.scope + &self.resource_scope ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1805,10 +1805,10 @@ pub mod reservation_recommendations { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list(&self, scope: impl Into) -> list::Builder { + pub fn list(&self, resource_scope: impl Into) -> list::Builder { list::Builder { client: self.0.clone(), - scope: scope.into(), + resource_scope: resource_scope.into(), filter: None, } } @@ -1845,7 +1845,7 @@ pub mod reservation_recommendations { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, - pub(crate) scope: String, + pub(crate) resource_scope: String, pub(crate) filter: Option, } impl Builder { @@ -1858,7 +1858,7 @@ pub mod reservation_recommendations { let url_str = &format!( "{}/{}/providers/Microsoft.Consumption/reservationRecommendations", self.client.endpoint(), - &self.scope + &self.resource_scope ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1907,6 +1907,7 @@ pub mod reservation_recommendation_details { impl Client { pub fn get( &self, + resource_scope: impl Into, scope: impl Into, region: impl Into, term: impl Into, @@ -1915,6 +1916,7 @@ pub mod reservation_recommendation_details { ) -> get::Builder { get::Builder { client: self.0.clone(), + resource_scope: resource_scope.into(), scope: scope.into(), region: region.into(), term: term.into(), @@ -1955,6 +1957,7 @@ pub mod reservation_recommendation_details { #[derive(Clone)] pub struct Builder { pub(crate) client: super::super::Client, + pub(crate) resource_scope: String, pub(crate) scope: String, pub(crate) region: String, pub(crate) term: String, @@ -1967,7 +1970,7 @@ pub mod reservation_recommendation_details { let url_str = &format!( "{}/{}/providers/Microsoft.Consumption/reservationRecommendationDetails", self.client.endpoint(), - &self.scope + &self.resource_scope ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -1979,6 +1982,8 @@ pub mod reservation_recommendation_details { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let scope = &self.scope; + url.query_pairs_mut().append_pair("scope", scope); let region = &self.region; url.query_pairs_mut().append_pair("region", region); let term = &self.term; diff --git a/services/mgmt/containerinstance/Cargo.toml b/services/mgmt/containerinstance/Cargo.toml index 616b5dcfb8..896898b499 100644 --- a/services/mgmt/containerinstance/Cargo.toml +++ b/services/mgmt/containerinstance/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_containerinstance" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/containerregistry/Cargo.toml b/services/mgmt/containerregistry/Cargo.toml index 4bbd7d98bc..fa29568922 100644 --- a/services/mgmt/containerregistry/Cargo.toml +++ b/services/mgmt/containerregistry/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_containerregistry" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/containerservice/Cargo.toml b/services/mgmt/containerservice/Cargo.toml index b88f1a2fcf..b17308e758 100644 --- a/services/mgmt/containerservice/Cargo.toml +++ b/services/mgmt/containerservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_containerservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,15 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2022-02", "package-2022-01", "package-preview-2022-01", "package-preview-2021-11"] +features = ["no-default-tag", "package-preview-2022-03", "package-2022-02", "package-preview-2022-02", "package-2022-01"] [features] -default = ["package-2022-02", "enable_reqwest"] +default = ["package-2022-03", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-03" = [] +"package-preview-2022-03" = [] "package-2022-02" = [] "package-preview-2022-02" = [] "package-2022-01" = [] diff --git a/services/mgmt/containerservice/README.md b/services/mgmt/containerservice/README.md index cdf8fddad6..625630336e 100644 --- a/services/mgmt/containerservice/README.md +++ b/services/mgmt/containerservice/README.md @@ -6,10 +6,12 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/containers To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2022-02`. +The default tag is `package-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-03` has 44 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. +- `package-preview-2022-03` has 51 operations from 1 API versions: `2022-03-02-preview`. Use crate feature `package-preview-2022-03` to enable. The operations will be in the `package_preview_2022_03` module. - `package-2022-02` has 44 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. - `package-preview-2022-02` has 50 operations from 1 API versions: `2022-02-02-preview`. Use crate feature `package-preview-2022-02` to enable. The operations will be in the `package_preview_2022_02` module. - `package-2022-01` has 44 operations from 1 API versions: `2022-01-01`. Use crate feature `package-2022-01` to enable. The operations will be in the `package_2022_01` module. diff --git a/services/mgmt/containerservice/src/lib.rs b/services/mgmt/containerservice/src/lib.rs index 683be944a4..9d8493a2b7 100644 --- a/services/mgmt/containerservice/src/lib.rs +++ b/services/mgmt/containerservice/src/lib.rs @@ -3,6 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-03")] +pub mod package_2022_03; +#[cfg(all(feature = "package-2022-03", not(feature = "no-default-tag")))] +pub use package_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-preview-2022-03")] +pub mod package_preview_2022_03; +#[cfg(all(feature = "package-preview-2022-03", not(feature = "no-default-tag")))] +pub use package_preview_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2022-02")] pub mod package_2022_02; #[cfg(all(feature = "package-2022-02", not(feature = "no-default-tag")))] diff --git a/services/mgmt/containerservice/src/package_2022_03/mod.rs b/services/mgmt/containerservice/src/package_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/containerservice/src/package_2022_03/models.rs b/services/mgmt/containerservice/src/package_2022_03/models.rs new file mode 100644 index 0000000000..b02c1e7d11 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2022_03/models.rs @@ -0,0 +1,2804 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Profile for enabling a user to access a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessProfile { + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +impl AccessProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Agent Pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties for the container service agent pool profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AgentPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available versions for an agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[doc = "The ID of the agent pool version list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the agent pool version list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the agent pool version list."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of available agent pool versions."] + pub properties: AgentPoolAvailableVersionsProperties, +} +impl AgentPoolAvailableVersions { + pub fn new(properties: AgentPoolAvailableVersionsProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "The list of available agent pool versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolAvailableVersionsProperties { + #[doc = "List of versions available for agent pool."] + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +impl AgentPoolAvailableVersionsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List Agent Pools operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolListResult { + #[doc = "The list of agent pools."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of agent pool results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AgentPoolListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[doc = "The type of Agent Pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[doc = "The list of available upgrades for an agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[doc = "The ID of the agent pool upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the agent pool upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the agent pool upgrade profile."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of available upgrade versions."] + pub properties: AgentPoolUpgradeProfileProperties, +} +impl AgentPoolUpgradeProfile { + pub fn new(properties: AgentPoolUpgradeProfileProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "The list of available upgrade versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[doc = "The Kubernetes version (major.minor.patch)."] + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType")] + pub os_type: OsType, + #[doc = "List of orchestrator types and versions available for upgrade."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[doc = "The latest AKS supported node image version."] + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +impl AgentPoolUpgradeProfileProperties { + pub fn new(kubernetes_version: String, os_type: OsType) -> Self { + Self { + kubernetes_version, + os_type, + upgrades: Vec::new(), + latest_node_image_version: None, + } + } +} +#[doc = "Settings for upgrading an agentpool"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolUpgradeSettings { + #[doc = "This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade"] + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +impl AgentPoolUpgradeSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the Container service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the Container service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the Container service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The results of a run command"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CommandResultProperties { + #[doc = "provisioning State"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The exit code of the command"] + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[doc = "The time when the command started."] + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[doc = "The time when the command finished."] + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[doc = "The command output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[doc = "An explanation of why provisioningState is set to failed (if so)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl CommandResultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile for diagnostics on the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[doc = "Profile for diagnostics on the container service VMs."] + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +impl ContainerServiceDiagnosticsProfile { + pub fn new(vm_diagnostics: ContainerServiceVmDiagnostics) -> Self { + Self { vm_diagnostics } + } +} +#[doc = "Profile for Linux VMs in the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[doc = "The administrator username to use for Linux VMs."] + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[doc = "SSH configuration for Linux-based VMs running on Azure."] + pub ssh: ContainerServiceSshConfiguration, +} +impl ContainerServiceLinuxProfile { + pub fn new(admin_username: String, ssh: ContainerServiceSshConfiguration) -> Self { + Self { admin_username, ssh } + } +} +#[doc = "Profile for the container service master."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[doc = "Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "DNS prefix to be used to create the FQDN for the master pool."] + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[doc = "Size of agent VMs. Note: This is no longer maintained."] + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[doc = "OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified."] + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[doc = "specifies a subnet's resource id with subscription, resource group, vnet and subnet name"] + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[doc = "FirstConsecutiveStaticIP used to specify the first static ip of masters."] + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[doc = "Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator."] + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[doc = "FQDN for the master pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +impl ContainerServiceMasterProfile { + pub fn new(dns_prefix: String, vm_size: ContainerServiceVmSize) -> Self { + Self { + count: None, + dns_prefix, + vm_size, + os_disk_size_gb: None, + vnet_subnet_id: None, + first_consecutive_static_ip: None, + storage_profile: None, + fqdn: None, + } + } +} +pub mod container_service_master_profile { + use super::*; + #[doc = "Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[doc = "Profile of network configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerServiceNetworkProfile { + #[doc = "Network plugin used for building the Kubernetes network."] + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[doc = "Network policy used for building the Kubernetes network."] + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[doc = "This cannot be specified if networkPlugin is anything other than 'azure'."] + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[doc = "A CIDR notation IP range from which to assign pod IPs when kubenet is used."] + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[doc = "A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges."] + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[doc = "An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr."] + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[doc = "A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range."] + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[doc = "This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype)."] + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[doc = "The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs."] + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[doc = "Profile of the managed cluster load balancer."] + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[doc = "Profile of the managed cluster NAT gateway."] + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[doc = "One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking."] + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[doc = "One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges."] + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[doc = "IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6."] + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +impl ContainerServiceNetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod container_service_network_profile { + use super::*; + #[doc = "Network plugin used for building the Kubernetes network."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + } + impl Default for NetworkPlugin { + fn default() -> Self { + Self::Kubenet + } + } + #[doc = "Network policy used for building the Kubernetes network."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, + } + #[doc = "This cannot be specified if networkPlugin is anything other than 'azure'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, + } + #[doc = "This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + impl Default for OutboundType { + fn default() -> Self { + Self::LoadBalancer + } + } + #[doc = "The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, + } +} +pub type ContainerServiceOsDisk = i32; +#[doc = "SSH configuration for Linux-based VMs running on Azure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[doc = "The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified."] + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +impl ContainerServiceSshConfiguration { + pub fn new(public_keys: Vec) -> Self { + Self { public_keys } + } +} +#[doc = "Contains information about SSH certificate public key data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[doc = "Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers."] + #[serde(rename = "keyData")] + pub key_data: String, +} +impl ContainerServiceSshPublicKey { + pub fn new(key_data: String) -> Self { + Self { key_data } + } +} +#[doc = "Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[doc = "Profile for diagnostics on the container service VMs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + #[doc = "Whether the VM diagnostic agent is provisioned on the VM."] + pub enabled: bool, + #[doc = "The URI of the storage account where diagnostics are stored."] + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +impl ContainerServiceVmDiagnostics { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + storage_uri: None, + } + } +} +#[doc = "Size of agent VMs. Note: This is no longer maintained."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[doc = "Data used when creating a target resource from a source resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreationData { + #[doc = "This is the ARM ID of the source object to be used to create the target object."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +impl CreationData { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The credential result response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialResult { + #[doc = "The name of the credential."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl CredentialResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list credential result response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialResults { + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +impl CredentialResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A domain name that AKS agent nodes are reaching at."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDependency { + #[doc = "The domain name of the dependency."] + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[doc = "The Ports and Protocols used when connecting to domainName."] + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +impl EndpointDependency { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "connect information from the AKS agent nodes to a single endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDetail { + #[doc = "An IP Address that Domain Name currently resolves to."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The port an endpoint is connected to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The protocol used for connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Description of the detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl EndpointDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The complex type of the extended location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedLocation { + #[doc = "The name of the extended location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of extendedLocation."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExtendedLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of extendedLocation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[doc = "GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubeletConfig { + #[doc = "The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'."] + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[doc = "The default is true."] + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[doc = "The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'."] + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[doc = "To disable image garbage collection, set to 100. The default is 85%"] + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[doc = "This cannot be set higher than imageGcHighThreshold. The default is 80%"] + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[doc = "For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'."] + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[doc = "Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`)."] + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[doc = "If set to true it will make the Kubelet fail to start if swap is enabled on the node."] + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[doc = "The maximum size (e.g. 10Mi) of container log file before it is rotated."] + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[doc = "The maximum number of container log files that can be present for a container. The number must be ≥ 2."] + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[doc = "The maximum number of processes per pod."] + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +impl KubeletConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinuxOsConfig { + #[doc = "Sysctl settings for Linux agent nodes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[doc = "Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge)."] + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[doc = "Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge)."] + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[doc = "The size in MB of a swap file that will be created on each node."] + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +impl LinuxOsConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned maintenance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Properties used to configure planned maintenance for a Managed Cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MaintenanceConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List maintenance configurations operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfigurationListResult { + #[doc = "The list of maintenance configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of maintenance configuration results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MaintenanceConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties used to configure planned maintenance for a Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfigurationProperties { + #[doc = "If two array entries specify the same day of the week, the applied configuration is the union of times in both entries."] + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[doc = "Time slots on which upgrade is not allowed."] + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +impl MaintenanceConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "The SKU of a Managed Cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The complex type of the extended location."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Identity for the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties of the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedCluster { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + sku: None, + extended_location: None, + identity: None, + properties: None, + } + } +} +#[doc = "For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAadProfile { + #[doc = "Whether to enable managed AAD."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[doc = "Whether to enable Azure RBAC for Kubernetes authorization."] + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[doc = "The list of AAD group object IDs that will have admin role of the cluster."] + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[doc = "The client AAD application ID."] + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[doc = "The server AAD application ID."] + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[doc = "The server AAD application secret."] + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[doc = "The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription."] + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +impl ManagedClusterAadProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Access profile for managed cluster API server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterApiServerAccessProfile { + #[doc = "IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges)."] + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[doc = "For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters)."] + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[doc = "The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'."] + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[doc = "Whether to create additional public FQDN for private cluster or not."] + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[doc = "Whether to disable run command for the cluster or not."] + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +impl ManagedClusterApiServerAccessProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Managed cluster Access Profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Profile for enabling a user to access a managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedClusterAccessProfile { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "A Kubernetes add-on profile for a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + #[doc = "Whether the add-on is enabled or not."] + pub enabled: bool, + #[doc = "Key-value pairs for configuring an add-on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[doc = "Information of user assigned identity used by this add-on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ManagedClusterAddonProfile { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + config: None, + identity: None, + } + } +} +#[doc = "Profile for the container service agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + #[doc = "Windows agent pool names must be 6 characters or less."] + pub name: String, +} +impl ManagedClusterAgentPoolProfile { + pub fn new(name: String) -> Self { + Self { + managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties::default(), + name, + } + } +} +#[doc = "Properties for the container service agent pool profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[doc = "Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions"] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified."] + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[doc = "The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os)."] + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[doc = "Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage."] + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[doc = "Determines the type of workload a node can run."] + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[doc = "If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"] + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[doc = "If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"] + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[doc = "The maximum number of pods that can run on a node."] + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[doc = "The maximum number of nodes for auto-scaling"] + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[doc = "The minimum number of nodes for auto-scaling"] + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[doc = "Whether to enable auto-scaler"] + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[doc = "Describes how VMs are added to or removed from Agent Pools. See [billing states](https://docs.microsoft.com/azure/virtual-machines/states-billing)."] + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[doc = "The type of Agent Pool."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool)."] + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[doc = "The version of node image"] + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[doc = "Settings for upgrading an agentpool"] + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[doc = "The current deployment or provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Describes the Power State of the cluster"] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'."] + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[doc = "Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false."] + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[doc = "This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"] + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[doc = "The Virtual Machine Scale Set priority."] + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[doc = "The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see [spot VMs](https://docs.microsoft.com/azure/virtual-machines/spot-vms)"] + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[doc = "Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing)"] + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[doc = "The tags to be persisted on the agent pool virtual machine scale set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The node labels to be persisted across all nodes in agent pool."] + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[doc = "The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule."] + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[doc = "The ID for Proximity Placement Group."] + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[doc = "This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption"] + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[doc = "Whether to enable UltraSSD"] + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[doc = "See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details."] + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[doc = "GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU."] + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, +} +impl ManagedClusterAgentPoolProfileProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Auto upgrade profile for a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAutoUpgradeProfile { + #[doc = "For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel)."] + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +impl ManagedClusterAutoUpgradeProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[doc = "For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[doc = "Cluster HTTP proxy configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterHttpProxyConfig { + #[doc = "The HTTP proxy server endpoint to use."] + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[doc = "The HTTPS proxy server endpoint to use."] + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[doc = "The endpoints that should not go through proxy."] + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[doc = "Alternative CA cert to use for connecting to proxy servers."] + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +impl ManagedClusterHttpProxyConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterIdentity { + #[doc = "The principal id of the system assigned identity which is used by master components."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant id of the system assigned identity which is used by master components."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ManagedClusterIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_identity { + use super::*; + #[doc = "For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[doc = "The response from the List Managed Clusters operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterListResult { + #[doc = "The list of managed clusters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of managed cluster results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ManagedClusterListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile of the managed cluster load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterLoadBalancerProfile { + #[doc = "Desired managed outbound IPs for the cluster load balancer."] + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[doc = "Desired outbound IP Prefix resources for the cluster load balancer."] + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[doc = "Desired outbound IP resources for the cluster load balancer."] + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[doc = "The effective outbound IP resources of the cluster load balancer."] + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[doc = "The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports."] + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[doc = "Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "Enable multiple standard load balancers per AKS cluster or not."] + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +impl ManagedClusterLoadBalancerProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[doc = "Desired managed outbound IPs for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ManagedOutboundIPs { + #[doc = "The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. "] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. "] + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + impl ManagedOutboundIPs { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Desired outbound IP Prefix resources for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct OutboundIpPrefixes { + #[doc = "A list of public IP prefix resources."] + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + impl OutboundIpPrefixes { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Desired outbound IP resources for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct OutboundIPs { + #[doc = "A list of public IP resources."] + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } + impl OutboundIPs { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Profile of the managed outbound IP resources of the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[doc = "The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. "] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ManagedClusterManagedOutboundIpProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile of the managed cluster NAT gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterNatGatewayProfile { + #[doc = "Profile of the managed outbound IP resources of the managed cluster."] + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[doc = "The effective outbound IP resources of the cluster NAT gateway."] + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[doc = "Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +impl ManagedClusterNatGatewayProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about the pod identity assigned to the Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + #[doc = "The name of the pod identity."] + pub name: String, + #[doc = "The namespace of the pod identity."] + pub namespace: String, + #[doc = "The binding selector to use for the AzureIdentityBinding resource."] + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + #[doc = "Details about a user assigned identity."] + pub identity: UserAssignedIdentity, + #[doc = "The current provisioning state of the pod identity."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +impl ManagedClusterPodIdentity { + pub fn new(name: String, namespace: String, identity: UserAssignedIdentity) -> Self { + Self { + name, + namespace, + binding_selector: None, + identity, + provisioning_state: None, + provisioning_info: None, + } + } +} +pub mod managed_cluster_pod_identity { + use super::*; + #[doc = "The current provisioning state of the pod identity."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ProvisioningInfo { + #[doc = "An error response from the pod identity provisioning."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } + impl ProvisioningInfo { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "See [disable AAD Pod Identity for a specific Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + #[doc = "The name of the pod identity exception."] + pub name: String, + #[doc = "The namespace of the pod identity exception."] + pub namespace: String, + #[doc = "The pod labels to match."] + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +impl ManagedClusterPodIdentityException { + pub fn new(name: String, namespace: String, pod_labels: serde_json::Value) -> Self { + Self { + name, + namespace, + pod_labels, + } + } +} +#[doc = "See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProfile { + #[doc = "Whether the pod identity addon is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information."] + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[doc = "The pod identities to use in the cluster."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[doc = "The pod identity exceptions to allow."] + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +impl ManagedClusterPodIdentityProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the pod identity provisioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[doc = "An error response from the pod identity provisioning."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ManagedClusterPodIdentityProvisioningError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the pod identity provisioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ManagedClusterPodIdentityProvisioningErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available upgrade versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[doc = "The Kubernetes version (major.minor.patch)."] + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[doc = "The Agent Pool name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType")] + pub os_type: OsType, + #[doc = "List of orchestrator types and versions available for upgrade."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +impl ManagedClusterPoolUpgradeProfile { + pub fn new(kubernetes_version: String, os_type: OsType) -> Self { + Self { + kubernetes_version, + name: None, + os_type, + upgrades: Vec::new(), + } + } +} +#[doc = "Properties of the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Describes the Power State of the cluster"] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "The max number of agent pools for the managed cluster."] + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[doc = "When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details."] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "This cannot be updated once the Managed Cluster has been created."] + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[doc = "This cannot be updated once the Managed Cluster has been created."] + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[doc = "The FQDN of the master pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The FQDN of private cluster."] + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[doc = "The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly."] + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[doc = "The agent pool properties."] + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[doc = "Profile for Linux VMs in the container service cluster."] + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[doc = "Profile for Windows VMs in the managed cluster."] + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[doc = "Information about a service principal identity for the cluster to use for manipulating Azure APIs."] + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[doc = "The profile of managed cluster add-on."] + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[doc = "See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration."] + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[doc = "The name of the resource group containing agent pool nodes."] + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[doc = "Whether to enable Kubernetes Role-Based Access Control."] + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[doc = "(DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy."] + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[doc = "Profile of network configuration."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[doc = "For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad)."] + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[doc = "Auto upgrade profile for a managed cluster."] + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[doc = "Parameters to be applied to the cluster-autoscaler when enabled"] + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[doc = "Access profile for managed cluster API server."] + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[doc = "This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'"] + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "Identities associated with the cluster."] + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[doc = "Private link resources associated with the cluster."] + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[doc = "If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview)."] + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[doc = "Cluster HTTP proxy configuration."] + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[doc = "Security profile for the container service cluster."] + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[doc = "Allow or deny public network access for AKS"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +impl ManagedClusterProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_properties { + use super::*; + #[doc = "Parameters to be applied to the cluster-autoscaler when enabled"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct AutoScalerProfile { + #[doc = "Valid values are 'true' and 'false'"] + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[doc = "If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[doc = "The default is 10."] + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[doc = "The default is 600."] + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[doc = "The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[doc = "The default is 45. The maximum is 100 and the minimum is 0."] + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[doc = "For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc)."] + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[doc = "This must be an integer. The default is 3."] + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[doc = "The default is '10'. Values must be an integer number of seconds."] + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[doc = "The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[doc = "The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[doc = "The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[doc = "The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[doc = "The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[doc = "The default is '0.5'."] + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[doc = "The default is true."] + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[doc = "The default is true."] + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + impl AutoScalerProfile { + pub fn new() -> Self { + Self::default() + } + } + pub mod auto_scaler_profile { + use super::*; + #[doc = "If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[doc = "Allow or deny public network access for AKS"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[doc = "The SKU of a Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSku { + #[doc = "The name of a managed cluster SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl ManagedClusterSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_sku { + use super::*; + #[doc = "The name of a managed cluster SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[doc = "If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[doc = "Security profile for the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSecurityProfile { + #[doc = "Azure Defender settings for the security profile."] + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, +} +impl ManagedClusterSecurityProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Defender settings for the security profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[doc = "Whether to enable Azure Defender"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty."] + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +impl ManagedClusterSecurityProfileAzureDefender { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a service principal identity for the cluster to use for manipulating Azure APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[doc = "The ID for the service principal."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "The secret password associated with the service principal in plain text."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +impl ManagedClusterServicePrincipalProfile { + pub fn new(client_id: String) -> Self { + Self { client_id, secret: None } + } +} +#[doc = "Storage profile for the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfile { + #[doc = "AzureDisk CSI Driver settings for the storage profile."] + #[serde(rename = "diskCSIDriver", default, skip_serializing_if = "Option::is_none")] + pub disk_csi_driver: Option, + #[doc = "AzureFile CSI Driver settings for the storage profile."] + #[serde(rename = "fileCSIDriver", default, skip_serializing_if = "Option::is_none")] + pub file_csi_driver: Option, + #[doc = "Snapshot Controller settings for the storage profile."] + #[serde(rename = "snapshotController", default, skip_serializing_if = "Option::is_none")] + pub snapshot_controller: Option, +} +impl ManagedClusterStorageProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureDisk CSI Driver settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileDiskCsiDriver { + #[doc = "Whether to enable AzureDisk CSI Driver. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterStorageProfileDiskCsiDriver { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureFile CSI Driver settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileFileCsiDriver { + #[doc = "Whether to enable AzureFile CSI Driver. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterStorageProfileFileCsiDriver { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Snapshot Controller settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileSnapshotController { + #[doc = "Whether to enable Snapshot Controller. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterStorageProfileSnapshotController { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available upgrades for compute pools."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[doc = "The ID of the upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the upgrade profile."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Control plane and agent pool upgrade profiles."] + pub properties: ManagedClusterUpgradeProfileProperties, +} +impl ManagedClusterUpgradeProfile { + pub fn new(properties: ManagedClusterUpgradeProfileProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "Control plane and agent pool upgrade profiles."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[doc = "The list of available upgrade versions."] + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[doc = "The list of available upgrade versions for agent pools."] + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +impl ManagedClusterUpgradeProfileProperties { + pub fn new( + control_plane_profile: ManagedClusterPoolUpgradeProfile, + agent_pool_profiles: Vec, + ) -> Self { + Self { + control_plane_profile, + agent_pool_profiles, + } + } +} +#[doc = "Profile for Windows VMs in the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[doc = "Specifies the name of the administrator account.

**Restriction:** Cannot end in \".\"

**Disallowed values:** \"administrator\", \"admin\", \"user\", \"user1\", \"test\", \"user2\", \"test1\", \"user3\", \"admin1\", \"1\", \"123\", \"a\", \"actuser\", \"adm\", \"admin2\", \"aspnet\", \"backup\", \"console\", \"david\", \"guest\", \"john\", \"owner\", \"root\", \"server\", \"sql\", \"support\", \"support_388945a0\", \"sys\", \"test2\", \"test3\", \"user4\", \"user5\".

**Minimum-length:** 1 character

**Max-length:** 20 characters"] + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[doc = "Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\\W_])

**Disallowed values:** \"abc@123\", \"P@$$w0rd\", \"P@ssw0rd\", \"P@ssword123\", \"Pa$$word\", \"pass@word1\", \"Password!\", \"Password1\", \"Password22\", \"iloveyou!\""] + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[doc = "The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy)."] + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[doc = "Windows gMSA Profile in the managed cluster."] + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +impl ManagedClusterWindowsProfile { + pub fn new(admin_username: String) -> Self { + Self { + admin_username, + admin_password: None, + license_type: None, + enable_csi_proxy: None, + gmsa_profile: None, + } + } +} +pub mod managed_cluster_windows_profile { + use super::*; + #[doc = "The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[doc = "The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[doc = "The OS option profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[doc = "The ID of the OS option resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the OS option resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the OS option resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of OS option properties."] + pub properties: OsOptionPropertyList, +} +impl OsOptionProfile { + pub fn new(properties: OsOptionPropertyList) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "OS option property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[doc = "The OS type."] + #[serde(rename = "os-type")] + pub os_type: String, + #[doc = "Whether the image is FIPS-enabled."] + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +impl OsOptionProperty { + pub fn new(os_type: String, enable_fips_image: bool) -> Self { + Self { + os_type, + enable_fips_image, + } + } +} +#[doc = "The list of OS option properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[doc = "The list of OS options."] + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +impl OsOptionPropertyList { + pub fn new(os_option_property_list: Vec) -> Self { + Self { os_option_property_list } + } +} +#[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[doc = "The operating system type. The default is Linux."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +impl Default for OsType { + fn default() -> Self { + Self::Linux + } +} +#[doc = "The List Operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "The list of operations"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Operation value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValue { + #[doc = "The origin of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Describes the properties of a Operation Value Display."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl OperationValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Operation Value Display."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValueDisplay { + #[doc = "The display name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The display name of the resource the operation applies to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The description of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The resource provider for the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +impl OperationValueDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Egress endpoints which AKS agent nodes connect to for common purpose."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OutboundEnvironmentEndpoint { + #[doc = "The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The endpoints that AKS agent nodes connect to"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +impl OutboundEnvironmentEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of OutboundEnvironmentEndpoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + #[doc = "Collection of resources."] + pub value: Vec, + #[doc = "Link to next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OutboundEnvironmentEndpointCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Describes the Power State of the cluster"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerState { + #[doc = "Tells whether the cluster is Running or Stopped"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +impl PowerState { + pub fn new() -> Self { + Self::default() + } +} +pub mod power_state { + use super::*; + #[doc = "Tells whether the cluster is Running or Stopped"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[doc = "Private endpoint which a connection belongs to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The resource ID of the private endpoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[doc = "The ID of the private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private endpoint connections"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "The collection value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Private endpoint which a connection belongs to."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "The state of a private link service connection."] + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +impl PrivateEndpointConnectionProperties { + pub fn new(private_link_service_connection_state: PrivateLinkServiceConnectionState) -> Self { + Self { + provisioning_state: None, + private_endpoint: None, + private_link_service_connection_state, + } + } +} +pub mod private_endpoint_connection_properties { + use super::*; + #[doc = "The current provisioning state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[doc = "The ID of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The group ID of the resource."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The RequiredMembers of the resource"] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link service ID of the resource, this field is exposed only to NRP internally."] + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourcesListResult { + #[doc = "The collection value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateLinkResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The state of a private link service connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "The private link service connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The private link service connection description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_link_service_connection_state { + use super::*; + #[doc = "The private link service connection status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A reference to an Azure resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceReference { + #[doc = "The fully qualified Azure resource id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ResourceReference { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A run command request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + #[doc = "The command to run."] + pub command: String, + #[doc = "A base64 encoded zip file containing the files required by the command."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[doc = "AuthToken issued for AKS AAD Server App."] + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +impl RunCommandRequest { + pub fn new(command: String) -> Self { + Self { + command, + context: None, + cluster_token: None, + } + } +} +#[doc = "run command result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RunCommandResult { + #[doc = "The command id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The results of a run command"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RunCommandResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes how VMs are added to or removed from Agent Pools. See [billing states](https://docs.microsoft.com/azure/virtual-machines/states-billing)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[doc = "The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see [spot VMs](https://docs.microsoft.com/azure/virtual-machines/spot-vms)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +impl Default for ScaleSetEvictionPolicy { + fn default() -> Self { + Self::Delete + } +} +#[doc = "The Virtual Machine Scale Set priority."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +impl Default for ScaleSetPriority { + fn default() -> Self { + Self::Regular + } +} +#[doc = "A node pool snapshot resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties used to configure a node pool snapshot."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Snapshot { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "The response from the List Snapshots operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SnapshotListResult { + #[doc = "The list of snapshots."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of snapshot results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SnapshotListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties used to configure a node pool snapshot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SnapshotProperties { + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "The type of a snapshot. The default is NodePool."] + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[doc = "The version of Kubernetes."] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "The version of node image."] + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[doc = "The size of the VM."] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "Whether to use a FIPS-enabled OS."] + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +impl SnapshotProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of a snapshot. The default is NodePool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, +} +impl Default for SnapshotType { + fn default() -> Self { + Self::NodePool + } +} +pub type SpotMaxPrice = f64; +#[doc = "Reference to another subresource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubResource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl SubResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sysctl settings for Linux agent nodes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SysctlConfig { + #[doc = "Sysctl setting net.core.somaxconn."] + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[doc = "Sysctl setting net.core.netdev_max_backlog."] + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[doc = "Sysctl setting net.core.rmem_default."] + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[doc = "Sysctl setting net.core.rmem_max."] + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[doc = "Sysctl setting net.core.wmem_default."] + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[doc = "Sysctl setting net.core.wmem_max."] + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[doc = "Sysctl setting net.core.optmem_max."] + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[doc = "Sysctl setting net.ipv4.tcp_max_syn_backlog."] + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[doc = "Sysctl setting net.ipv4.tcp_max_tw_buckets."] + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[doc = "Sysctl setting net.ipv4.tcp_fin_timeout."] + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_time."] + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_probes."] + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_intvl."] + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[doc = "Sysctl setting net.ipv4.tcp_tw_reuse."] + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[doc = "Sysctl setting net.ipv4.ip_local_port_range."] + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh1."] + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh2."] + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh3."] + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[doc = "Sysctl setting net.netfilter.nf_conntrack_max."] + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[doc = "Sysctl setting net.netfilter.nf_conntrack_buckets."] + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[doc = "Sysctl setting fs.inotify.max_user_watches."] + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[doc = "Sysctl setting fs.file-max."] + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[doc = "Sysctl setting fs.aio-max-nr."] + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[doc = "Sysctl setting fs.nr_open."] + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[doc = "Sysctl setting kernel.threads-max."] + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[doc = "Sysctl setting vm.max_map_count."] + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[doc = "Sysctl setting vm.swappiness."] + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[doc = "Sysctl setting vm.vfs_cache_pressure."] + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +impl SysctlConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tags object for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsObject { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Time in a week."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeInWeek { + #[doc = "The weekday enum."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[doc = "Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range."] + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +impl TimeInWeek { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeSpan { + #[doc = "The start of a time span"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[doc = "The end of a time span"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +impl TimeSpan { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "Details about a user assigned identity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentity { + #[doc = "The resource ID of the user assigned identity."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The client ID of the user assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The object ID of the user assigned identity."] + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +impl UserAssignedIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The weekday enum."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[doc = "Windows gMSA Profile in the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WindowsGmsaProfile { + #[doc = "Specifies whether to enable Windows gMSA in the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster."] + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[doc = "Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster."] + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +impl WindowsGmsaProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Determines the type of workload a node can run."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/containerservice/src/package_2022_03/operations.rs b/services/mgmt/containerservice/src/package_2022_03/operations.rs new file mode 100644 index 0000000000..35253ecb40 --- /dev/null +++ b/services/mgmt/containerservice/src/package_2022_03/operations.rs @@ -0,0 +1,4274 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + format: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + pub(crate) format: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/containerservice/src/package_preview_2022_03/mod.rs b/services/mgmt/containerservice/src/package_preview_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/containerservice/src/package_preview_2022_03/models.rs b/services/mgmt/containerservice/src/package_preview_2022_03/models.rs new file mode 100644 index 0000000000..d028f5260e --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2022_03/models.rs @@ -0,0 +1,3008 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Profile for enabling a user to access a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessProfile { + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(rename = "kubeConfig", default, skip_serializing_if = "Option::is_none")] + pub kube_config: Option, +} +impl AccessProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Agent Pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties for the container service agent pool profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AgentPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available versions for an agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolAvailableVersions { + #[doc = "The ID of the agent pool version list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the agent pool version list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the agent pool version list."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of available agent pool versions."] + pub properties: AgentPoolAvailableVersionsProperties, +} +impl AgentPoolAvailableVersions { + pub fn new(properties: AgentPoolAvailableVersionsProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "The list of available agent pool versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolAvailableVersionsProperties { + #[doc = "List of versions available for agent pool."] + #[serde(rename = "agentPoolVersions", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_versions: Vec, +} +impl AgentPoolAvailableVersionsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List Agent Pools operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolListResult { + #[doc = "The list of agent pools."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of agent pool results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AgentPoolListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolMode { + System, + User, +} +#[doc = "The type of Agent Pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AgentPoolType { + VirtualMachineScaleSets, + AvailabilitySet, +} +#[doc = "The list of available upgrades for an agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfile { + #[doc = "The ID of the agent pool upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the agent pool upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the agent pool upgrade profile."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of available upgrade versions."] + pub properties: AgentPoolUpgradeProfileProperties, +} +impl AgentPoolUpgradeProfile { + pub fn new(properties: AgentPoolUpgradeProfileProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "The list of available upgrade versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AgentPoolUpgradeProfileProperties { + #[doc = "The Kubernetes version (major.minor.patch)."] + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType")] + pub os_type: OsType, + #[doc = "List of orchestrator types and versions available for upgrade."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, + #[doc = "The latest AKS supported node image version."] + #[serde(rename = "latestNodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_node_image_version: Option, +} +impl AgentPoolUpgradeProfileProperties { + pub fn new(kubernetes_version: String, os_type: OsType) -> Self { + Self { + kubernetes_version, + os_type, + upgrades: Vec::new(), + latest_node_image_version: None, + } + } +} +#[doc = "Settings for upgrading an agentpool"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentPoolUpgradeSettings { + #[doc = "This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade"] + #[serde(rename = "maxSurge", default, skip_serializing_if = "Option::is_none")] + pub max_surge: Option, +} +impl AgentPoolUpgradeSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Key Vault key management service settings for the security profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVaultKms { + #[doc = "Whether to enable Azure Key Vault key management service. The default is false."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty."] + #[serde(rename = "keyId", default, skip_serializing_if = "Option::is_none")] + pub key_id: Option, +} +impl AzureKeyVaultKms { + pub fn new() -> Self { + Self::default() + } +} +pub type CapacityReservationGroupId = String; +#[doc = "An error response from the Container service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the Container service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the Container service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The results of a run command"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CommandResultProperties { + #[doc = "provisioning State"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The exit code of the command"] + #[serde(rename = "exitCode", default, skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + #[doc = "The time when the command started."] + #[serde(rename = "startedAt", default, skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[doc = "The time when the command finished."] + #[serde(rename = "finishedAt", default, skip_serializing_if = "Option::is_none")] + pub finished_at: Option, + #[doc = "The command output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub logs: Option, + #[doc = "An explanation of why provisioningState is set to failed (if so)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl CommandResultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile for diagnostics on the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceDiagnosticsProfile { + #[doc = "Profile for diagnostics on the container service VMs."] + #[serde(rename = "vmDiagnostics")] + pub vm_diagnostics: ContainerServiceVmDiagnostics, +} +impl ContainerServiceDiagnosticsProfile { + pub fn new(vm_diagnostics: ContainerServiceVmDiagnostics) -> Self { + Self { vm_diagnostics } + } +} +#[doc = "Profile for Linux VMs in the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceLinuxProfile { + #[doc = "The administrator username to use for Linux VMs."] + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[doc = "SSH configuration for Linux-based VMs running on Azure."] + pub ssh: ContainerServiceSshConfiguration, +} +impl ContainerServiceLinuxProfile { + pub fn new(admin_username: String, ssh: ContainerServiceSshConfiguration) -> Self { + Self { admin_username, ssh } + } +} +#[doc = "Profile for the container service master."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceMasterProfile { + #[doc = "Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "DNS prefix to be used to create the FQDN for the master pool."] + #[serde(rename = "dnsPrefix")] + pub dns_prefix: String, + #[doc = "Size of agent VMs. Note: This is no longer maintained."] + #[serde(rename = "vmSize")] + pub vm_size: ContainerServiceVmSize, + #[doc = "OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified."] + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[doc = "specifies a subnet's resource id with subscription, resource group, vnet and subnet name"] + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[doc = "FirstConsecutiveStaticIP used to specify the first static ip of masters."] + #[serde(rename = "firstConsecutiveStaticIP", default, skip_serializing_if = "Option::is_none")] + pub first_consecutive_static_ip: Option, + #[doc = "Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator."] + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[doc = "FQDN for the master pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, +} +impl ContainerServiceMasterProfile { + pub fn new(dns_prefix: String, vm_size: ContainerServiceVmSize) -> Self { + Self { + count: None, + dns_prefix, + vm_size, + os_disk_size_gb: None, + vnet_subnet_id: None, + first_consecutive_static_ip: None, + storage_profile: None, + fqdn: None, + } + } +} +pub mod container_service_master_profile { + use super::*; + #[doc = "Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Count {} +} +#[doc = "Profile of network configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerServiceNetworkProfile { + #[doc = "Network plugin used for building the Kubernetes network."] + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[doc = "Network policy used for building the Kubernetes network."] + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[doc = "This cannot be specified if networkPlugin is anything other than 'azure'."] + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[doc = "A CIDR notation IP range from which to assign pod IPs when kubenet is used."] + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[doc = "A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges."] + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, + #[doc = "An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr."] + #[serde(rename = "dnsServiceIP", default, skip_serializing_if = "Option::is_none")] + pub dns_service_ip: Option, + #[doc = "A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range."] + #[serde(rename = "dockerBridgeCidr", default, skip_serializing_if = "Option::is_none")] + pub docker_bridge_cidr: Option, + #[doc = "This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype)."] + #[serde(rename = "outboundType", default, skip_serializing_if = "Option::is_none")] + pub outbound_type: Option, + #[doc = "The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs."] + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, + #[doc = "Profile of the managed cluster load balancer."] + #[serde(rename = "loadBalancerProfile", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_profile: Option, + #[doc = "Profile of the managed cluster NAT gateway."] + #[serde(rename = "natGatewayProfile", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway_profile: Option, + #[doc = "One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking."] + #[serde(rename = "podCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub pod_cidrs: Vec, + #[doc = "One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges."] + #[serde(rename = "serviceCidrs", default, skip_serializing_if = "Vec::is_empty")] + pub service_cidrs: Vec, + #[doc = "IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6."] + #[serde(rename = "ipFamilies", default, skip_serializing_if = "Vec::is_empty")] + pub ip_families: Vec, +} +impl ContainerServiceNetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod container_service_network_profile { + use super::*; + #[doc = "This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutboundType { + #[serde(rename = "loadBalancer")] + LoadBalancer, + #[serde(rename = "userDefinedRouting")] + UserDefinedRouting, + #[serde(rename = "managedNATGateway")] + ManagedNatGateway, + #[serde(rename = "userAssignedNATGateway")] + UserAssignedNatGateway, + } + impl Default for OutboundType { + fn default() -> Self { + Self::LoadBalancer + } + } +} +pub type ContainerServiceOsDisk = i32; +#[doc = "SSH configuration for Linux-based VMs running on Azure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshConfiguration { + #[doc = "The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified."] + #[serde(rename = "publicKeys")] + pub public_keys: Vec, +} +impl ContainerServiceSshConfiguration { + pub fn new(public_keys: Vec) -> Self { + Self { public_keys } + } +} +#[doc = "Contains information about SSH certificate public key data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceSshPublicKey { + #[doc = "Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers."] + #[serde(rename = "keyData")] + pub key_data: String, +} +impl ContainerServiceSshPublicKey { + pub fn new(key_data: String) -> Self { + Self { key_data } + } +} +#[doc = "Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceStorageProfile { + StorageAccount, + ManagedDisks, +} +#[doc = "Profile for diagnostics on the container service VMs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerServiceVmDiagnostics { + #[doc = "Whether the VM diagnostic agent is provisioned on the VM."] + pub enabled: bool, + #[doc = "The URI of the storage account where diagnostics are stored."] + #[serde(rename = "storageUri", default, skip_serializing_if = "Option::is_none")] + pub storage_uri: Option, +} +impl ContainerServiceVmDiagnostics { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + storage_uri: None, + } + } +} +#[doc = "Size of agent VMs. Note: This is no longer maintained."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContainerServiceVmSize { + #[serde(rename = "Standard_A1")] + StandardA1, + #[serde(rename = "Standard_A10")] + StandardA10, + #[serde(rename = "Standard_A11")] + StandardA11, + #[serde(rename = "Standard_A1_v2")] + StandardA1V2, + #[serde(rename = "Standard_A2")] + StandardA2, + #[serde(rename = "Standard_A2_v2")] + StandardA2V2, + #[serde(rename = "Standard_A2m_v2")] + StandardA2mV2, + #[serde(rename = "Standard_A3")] + StandardA3, + #[serde(rename = "Standard_A4")] + StandardA4, + #[serde(rename = "Standard_A4_v2")] + StandardA4V2, + #[serde(rename = "Standard_A4m_v2")] + StandardA4mV2, + #[serde(rename = "Standard_A5")] + StandardA5, + #[serde(rename = "Standard_A6")] + StandardA6, + #[serde(rename = "Standard_A7")] + StandardA7, + #[serde(rename = "Standard_A8")] + StandardA8, + #[serde(rename = "Standard_A8_v2")] + StandardA8V2, + #[serde(rename = "Standard_A8m_v2")] + StandardA8mV2, + #[serde(rename = "Standard_A9")] + StandardA9, + #[serde(rename = "Standard_B2ms")] + StandardB2ms, + #[serde(rename = "Standard_B2s")] + StandardB2s, + #[serde(rename = "Standard_B4ms")] + StandardB4ms, + #[serde(rename = "Standard_B8ms")] + StandardB8ms, + #[serde(rename = "Standard_D1")] + StandardD1, + #[serde(rename = "Standard_D11")] + StandardD11, + #[serde(rename = "Standard_D11_v2")] + StandardD11V2, + #[serde(rename = "Standard_D11_v2_Promo")] + StandardD11V2Promo, + #[serde(rename = "Standard_D12")] + StandardD12, + #[serde(rename = "Standard_D12_v2")] + StandardD12V2, + #[serde(rename = "Standard_D12_v2_Promo")] + StandardD12V2Promo, + #[serde(rename = "Standard_D13")] + StandardD13, + #[serde(rename = "Standard_D13_v2")] + StandardD13V2, + #[serde(rename = "Standard_D13_v2_Promo")] + StandardD13V2Promo, + #[serde(rename = "Standard_D14")] + StandardD14, + #[serde(rename = "Standard_D14_v2")] + StandardD14V2, + #[serde(rename = "Standard_D14_v2_Promo")] + StandardD14V2Promo, + #[serde(rename = "Standard_D15_v2")] + StandardD15V2, + #[serde(rename = "Standard_D16_v3")] + StandardD16V3, + #[serde(rename = "Standard_D16s_v3")] + StandardD16sV3, + #[serde(rename = "Standard_D1_v2")] + StandardD1V2, + #[serde(rename = "Standard_D2")] + StandardD2, + #[serde(rename = "Standard_D2_v2")] + StandardD2V2, + #[serde(rename = "Standard_D2_v2_Promo")] + StandardD2V2Promo, + #[serde(rename = "Standard_D2_v3")] + StandardD2V3, + #[serde(rename = "Standard_D2s_v3")] + StandardD2sV3, + #[serde(rename = "Standard_D3")] + StandardD3, + #[serde(rename = "Standard_D32_v3")] + StandardD32V3, + #[serde(rename = "Standard_D32s_v3")] + StandardD32sV3, + #[serde(rename = "Standard_D3_v2")] + StandardD3V2, + #[serde(rename = "Standard_D3_v2_Promo")] + StandardD3V2Promo, + #[serde(rename = "Standard_D4")] + StandardD4, + #[serde(rename = "Standard_D4_v2")] + StandardD4V2, + #[serde(rename = "Standard_D4_v2_Promo")] + StandardD4V2Promo, + #[serde(rename = "Standard_D4_v3")] + StandardD4V3, + #[serde(rename = "Standard_D4s_v3")] + StandardD4sV3, + #[serde(rename = "Standard_D5_v2")] + StandardD5V2, + #[serde(rename = "Standard_D5_v2_Promo")] + StandardD5V2Promo, + #[serde(rename = "Standard_D64_v3")] + StandardD64V3, + #[serde(rename = "Standard_D64s_v3")] + StandardD64sV3, + #[serde(rename = "Standard_D8_v3")] + StandardD8V3, + #[serde(rename = "Standard_D8s_v3")] + StandardD8sV3, + #[serde(rename = "Standard_DS1")] + StandardDs1, + #[serde(rename = "Standard_DS11")] + StandardDs11, + #[serde(rename = "Standard_DS11_v2")] + StandardDs11V2, + #[serde(rename = "Standard_DS11_v2_Promo")] + StandardDs11V2Promo, + #[serde(rename = "Standard_DS12")] + StandardDs12, + #[serde(rename = "Standard_DS12_v2")] + StandardDs12V2, + #[serde(rename = "Standard_DS12_v2_Promo")] + StandardDs12V2Promo, + #[serde(rename = "Standard_DS13")] + StandardDs13, + #[serde(rename = "Standard_DS13-2_v2")] + StandardDs132V2, + #[serde(rename = "Standard_DS13-4_v2")] + StandardDs134V2, + #[serde(rename = "Standard_DS13_v2")] + StandardDs13V2, + #[serde(rename = "Standard_DS13_v2_Promo")] + StandardDs13V2Promo, + #[serde(rename = "Standard_DS14")] + StandardDs14, + #[serde(rename = "Standard_DS14-4_v2")] + StandardDs144V2, + #[serde(rename = "Standard_DS14-8_v2")] + StandardDs148V2, + #[serde(rename = "Standard_DS14_v2")] + StandardDs14V2, + #[serde(rename = "Standard_DS14_v2_Promo")] + StandardDs14V2Promo, + #[serde(rename = "Standard_DS15_v2")] + StandardDs15V2, + #[serde(rename = "Standard_DS1_v2")] + StandardDs1V2, + #[serde(rename = "Standard_DS2")] + StandardDs2, + #[serde(rename = "Standard_DS2_v2")] + StandardDs2V2, + #[serde(rename = "Standard_DS2_v2_Promo")] + StandardDs2V2Promo, + #[serde(rename = "Standard_DS3")] + StandardDs3, + #[serde(rename = "Standard_DS3_v2")] + StandardDs3V2, + #[serde(rename = "Standard_DS3_v2_Promo")] + StandardDs3V2Promo, + #[serde(rename = "Standard_DS4")] + StandardDs4, + #[serde(rename = "Standard_DS4_v2")] + StandardDs4V2, + #[serde(rename = "Standard_DS4_v2_Promo")] + StandardDs4V2Promo, + #[serde(rename = "Standard_DS5_v2")] + StandardDs5V2, + #[serde(rename = "Standard_DS5_v2_Promo")] + StandardDs5V2Promo, + #[serde(rename = "Standard_E16_v3")] + StandardE16V3, + #[serde(rename = "Standard_E16s_v3")] + StandardE16sV3, + #[serde(rename = "Standard_E2_v3")] + StandardE2V3, + #[serde(rename = "Standard_E2s_v3")] + StandardE2sV3, + #[serde(rename = "Standard_E32-16s_v3")] + StandardE3216sV3, + #[serde(rename = "Standard_E32-8s_v3")] + StandardE328sV3, + #[serde(rename = "Standard_E32_v3")] + StandardE32V3, + #[serde(rename = "Standard_E32s_v3")] + StandardE32sV3, + #[serde(rename = "Standard_E4_v3")] + StandardE4V3, + #[serde(rename = "Standard_E4s_v3")] + StandardE4sV3, + #[serde(rename = "Standard_E64-16s_v3")] + StandardE6416sV3, + #[serde(rename = "Standard_E64-32s_v3")] + StandardE6432sV3, + #[serde(rename = "Standard_E64_v3")] + StandardE64V3, + #[serde(rename = "Standard_E64s_v3")] + StandardE64sV3, + #[serde(rename = "Standard_E8_v3")] + StandardE8V3, + #[serde(rename = "Standard_E8s_v3")] + StandardE8sV3, + #[serde(rename = "Standard_F1")] + StandardF1, + #[serde(rename = "Standard_F16")] + StandardF16, + #[serde(rename = "Standard_F16s")] + StandardF16s, + #[serde(rename = "Standard_F16s_v2")] + StandardF16sV2, + #[serde(rename = "Standard_F1s")] + StandardF1s, + #[serde(rename = "Standard_F2")] + StandardF2, + #[serde(rename = "Standard_F2s")] + StandardF2s, + #[serde(rename = "Standard_F2s_v2")] + StandardF2sV2, + #[serde(rename = "Standard_F32s_v2")] + StandardF32sV2, + #[serde(rename = "Standard_F4")] + StandardF4, + #[serde(rename = "Standard_F4s")] + StandardF4s, + #[serde(rename = "Standard_F4s_v2")] + StandardF4sV2, + #[serde(rename = "Standard_F64s_v2")] + StandardF64sV2, + #[serde(rename = "Standard_F72s_v2")] + StandardF72sV2, + #[serde(rename = "Standard_F8")] + StandardF8, + #[serde(rename = "Standard_F8s")] + StandardF8s, + #[serde(rename = "Standard_F8s_v2")] + StandardF8sV2, + #[serde(rename = "Standard_G1")] + StandardG1, + #[serde(rename = "Standard_G2")] + StandardG2, + #[serde(rename = "Standard_G3")] + StandardG3, + #[serde(rename = "Standard_G4")] + StandardG4, + #[serde(rename = "Standard_G5")] + StandardG5, + #[serde(rename = "Standard_GS1")] + StandardGs1, + #[serde(rename = "Standard_GS2")] + StandardGs2, + #[serde(rename = "Standard_GS3")] + StandardGs3, + #[serde(rename = "Standard_GS4")] + StandardGs4, + #[serde(rename = "Standard_GS4-4")] + StandardGs44, + #[serde(rename = "Standard_GS4-8")] + StandardGs48, + #[serde(rename = "Standard_GS5")] + StandardGs5, + #[serde(rename = "Standard_GS5-16")] + StandardGs516, + #[serde(rename = "Standard_GS5-8")] + StandardGs58, + #[serde(rename = "Standard_H16")] + StandardH16, + #[serde(rename = "Standard_H16m")] + StandardH16m, + #[serde(rename = "Standard_H16mr")] + StandardH16mr, + #[serde(rename = "Standard_H16r")] + StandardH16r, + #[serde(rename = "Standard_H8")] + StandardH8, + #[serde(rename = "Standard_H8m")] + StandardH8m, + #[serde(rename = "Standard_L16s")] + StandardL16s, + #[serde(rename = "Standard_L32s")] + StandardL32s, + #[serde(rename = "Standard_L4s")] + StandardL4s, + #[serde(rename = "Standard_L8s")] + StandardL8s, + #[serde(rename = "Standard_M128-32ms")] + StandardM12832ms, + #[serde(rename = "Standard_M128-64ms")] + StandardM12864ms, + #[serde(rename = "Standard_M128ms")] + StandardM128ms, + #[serde(rename = "Standard_M128s")] + StandardM128s, + #[serde(rename = "Standard_M64-16ms")] + StandardM6416ms, + #[serde(rename = "Standard_M64-32ms")] + StandardM6432ms, + #[serde(rename = "Standard_M64ms")] + StandardM64ms, + #[serde(rename = "Standard_M64s")] + StandardM64s, + #[serde(rename = "Standard_NC12")] + StandardNc12, + #[serde(rename = "Standard_NC12s_v2")] + StandardNc12sV2, + #[serde(rename = "Standard_NC12s_v3")] + StandardNc12sV3, + #[serde(rename = "Standard_NC24")] + StandardNc24, + #[serde(rename = "Standard_NC24r")] + StandardNc24r, + #[serde(rename = "Standard_NC24rs_v2")] + StandardNc24rsV2, + #[serde(rename = "Standard_NC24rs_v3")] + StandardNc24rsV3, + #[serde(rename = "Standard_NC24s_v2")] + StandardNc24sV2, + #[serde(rename = "Standard_NC24s_v3")] + StandardNc24sV3, + #[serde(rename = "Standard_NC6")] + StandardNc6, + #[serde(rename = "Standard_NC6s_v2")] + StandardNc6sV2, + #[serde(rename = "Standard_NC6s_v3")] + StandardNc6sV3, + #[serde(rename = "Standard_ND12s")] + StandardNd12s, + #[serde(rename = "Standard_ND24rs")] + StandardNd24rs, + #[serde(rename = "Standard_ND24s")] + StandardNd24s, + #[serde(rename = "Standard_ND6s")] + StandardNd6s, + #[serde(rename = "Standard_NV12")] + StandardNv12, + #[serde(rename = "Standard_NV24")] + StandardNv24, + #[serde(rename = "Standard_NV6")] + StandardNv6, +} +pub type ContainerServiceVnetSubnetId = String; +#[doc = "Data used when creating a target resource from a source resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreationData { + #[doc = "This is the ARM ID of the source object to be used to create the target object."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +impl CreationData { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The credential result response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialResult { + #[doc = "The name of the credential."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl CredentialResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list credential result response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialResults { + #[doc = "Base64-encoded Kubernetes configuration file."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kubeconfigs: Vec, +} +impl CredentialResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A domain name that AKS agent nodes are reaching at."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDependency { + #[doc = "The domain name of the dependency."] + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[doc = "The Ports and Protocols used when connecting to domainName."] + #[serde(rename = "endpointDetails", default, skip_serializing_if = "Vec::is_empty")] + pub endpoint_details: Vec, +} +impl EndpointDependency { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "connect information from the AKS agent nodes to a single endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointDetail { + #[doc = "An IP Address that Domain Name currently resolves to."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The port an endpoint is connected to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The protocol used for connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Description of the detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl EndpointDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The complex type of the extended location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedLocation { + #[doc = "The name of the extended location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of extendedLocation."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExtendedLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of extendedLocation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[doc = "GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GpuInstanceProfile { + #[serde(rename = "MIG1g")] + Mig1g, + #[serde(rename = "MIG2g")] + Mig2g, + #[serde(rename = "MIG3g")] + Mig3g, + #[serde(rename = "MIG4g")] + Mig4g, + #[serde(rename = "MIG7g")] + Mig7g, +} +pub type HourInDay = i32; +#[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubeletConfig { + #[doc = "The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'."] + #[serde(rename = "cpuManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub cpu_manager_policy: Option, + #[doc = "The default is true."] + #[serde(rename = "cpuCfsQuota", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota: Option, + #[doc = "The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'."] + #[serde(rename = "cpuCfsQuotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub cpu_cfs_quota_period: Option, + #[doc = "To disable image garbage collection, set to 100. The default is 85%"] + #[serde(rename = "imageGcHighThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_high_threshold: Option, + #[doc = "This cannot be set higher than imageGcHighThreshold. The default is 80%"] + #[serde(rename = "imageGcLowThreshold", default, skip_serializing_if = "Option::is_none")] + pub image_gc_low_threshold: Option, + #[doc = "For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'."] + #[serde(rename = "topologyManagerPolicy", default, skip_serializing_if = "Option::is_none")] + pub topology_manager_policy: Option, + #[doc = "Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`)."] + #[serde(rename = "allowedUnsafeSysctls", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_unsafe_sysctls: Vec, + #[doc = "If set to true it will make the Kubelet fail to start if swap is enabled on the node."] + #[serde(rename = "failSwapOn", default, skip_serializing_if = "Option::is_none")] + pub fail_swap_on: Option, + #[doc = "The maximum size (e.g. 10Mi) of container log file before it is rotated."] + #[serde(rename = "containerLogMaxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_size_mb: Option, + #[doc = "The maximum number of container log files that can be present for a container. The number must be ≥ 2."] + #[serde(rename = "containerLogMaxFiles", default, skip_serializing_if = "Option::is_none")] + pub container_log_max_files: Option, + #[doc = "The maximum number of processes per pod."] + #[serde(rename = "podMaxPids", default, skip_serializing_if = "Option::is_none")] + pub pod_max_pids: Option, +} +impl KubeletConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KubeletDiskType { + #[serde(rename = "OS")] + Os, + Temporary, +} +#[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinuxOsConfig { + #[doc = "Sysctl settings for Linux agent nodes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sysctls: Option, + #[doc = "Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge)."] + #[serde(rename = "transparentHugePageEnabled", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_enabled: Option, + #[doc = "Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge)."] + #[serde(rename = "transparentHugePageDefrag", default, skip_serializing_if = "Option::is_none")] + pub transparent_huge_page_defrag: Option, + #[doc = "The size in MB of a swap file that will be created on each node."] + #[serde(rename = "swapFileSizeMB", default, skip_serializing_if = "Option::is_none")] + pub swap_file_size_mb: Option, +} +impl LinuxOsConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum LoadBalancerSku { + #[serde(rename = "standard")] + Standard, + #[serde(rename = "basic")] + Basic, +} +#[doc = "See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned maintenance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Properties used to configure planned maintenance for a Managed Cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MaintenanceConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List maintenance configurations operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfigurationListResult { + #[doc = "The list of maintenance configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of maintenance configuration results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MaintenanceConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties used to configure planned maintenance for a Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaintenanceConfigurationProperties { + #[doc = "If two array entries specify the same day of the week, the applied configuration is the union of times in both entries."] + #[serde(rename = "timeInWeek", default, skip_serializing_if = "Vec::is_empty")] + pub time_in_week: Vec, + #[doc = "Time slots on which upgrade is not allowed."] + #[serde(rename = "notAllowedTime", default, skip_serializing_if = "Vec::is_empty")] + pub not_allowed_time: Vec, +} +impl MaintenanceConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedCluster { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "The SKU of a Managed Cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The complex type of the extended location."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Identity for the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties of the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedCluster { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + sku: None, + extended_location: None, + identity: None, + properties: None, + } + } +} +#[doc = "For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAadProfile { + #[doc = "Whether to enable managed AAD."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub managed: Option, + #[doc = "Whether to enable Azure RBAC for Kubernetes authorization."] + #[serde(rename = "enableAzureRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_azure_rbac: Option, + #[doc = "The list of AAD group object IDs that will have admin role of the cluster."] + #[serde(rename = "adminGroupObjectIDs", default, skip_serializing_if = "Vec::is_empty")] + pub admin_group_object_i_ds: Vec, + #[doc = "The client AAD application ID."] + #[serde(rename = "clientAppID", default, skip_serializing_if = "Option::is_none")] + pub client_app_id: Option, + #[doc = "The server AAD application ID."] + #[serde(rename = "serverAppID", default, skip_serializing_if = "Option::is_none")] + pub server_app_id: Option, + #[doc = "The server AAD application secret."] + #[serde(rename = "serverAppSecret", default, skip_serializing_if = "Option::is_none")] + pub server_app_secret: Option, + #[doc = "The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription."] + #[serde(rename = "tenantID", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +impl ManagedClusterAadProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Access profile for managed cluster API server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterApiServerAccessProfile { + #[doc = "IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges)."] + #[serde(rename = "authorizedIPRanges", default, skip_serializing_if = "Vec::is_empty")] + pub authorized_ip_ranges: Vec, + #[doc = "For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters)."] + #[serde(rename = "enablePrivateCluster", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster: Option, + #[doc = "The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'."] + #[serde(rename = "privateDNSZone", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone: Option, + #[doc = "Whether to create additional public FQDN for private cluster or not."] + #[serde(rename = "enablePrivateClusterPublicFQDN", default, skip_serializing_if = "Option::is_none")] + pub enable_private_cluster_public_fqdn: Option, + #[doc = "Whether to disable run command for the cluster or not."] + #[serde(rename = "disableRunCommand", default, skip_serializing_if = "Option::is_none")] + pub disable_run_command: Option, +} +impl ManagedClusterApiServerAccessProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Managed cluster Access Profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAccessProfile { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Profile for enabling a user to access a managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedClusterAccessProfile { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "A Kubernetes add-on profile for a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAddonProfile { + #[doc = "Whether the add-on is enabled or not."] + pub enabled: bool, + #[doc = "Key-value pairs for configuring an add-on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub config: Option, + #[doc = "Information of user assigned identity used by this add-on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ManagedClusterAddonProfile { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + config: None, + identity: None, + } + } +} +#[doc = "Profile for the container service agent pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterAgentPoolProfile { + #[serde(flatten)] + pub managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties, + #[doc = "Windows agent pool names must be 6 characters or less."] + pub name: String, +} +impl ManagedClusterAgentPoolProfile { + pub fn new(name: String) -> Self { + Self { + managed_cluster_agent_pool_profile_properties: ManagedClusterAgentPoolProfileProperties::default(), + name, + } + } +} +#[doc = "Properties for the container service agent pool profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAgentPoolProfileProperties { + #[doc = "Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions"] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified."] + #[serde(rename = "osDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub os_disk_size_gb: Option, + #[doc = "The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os)."] + #[serde(rename = "osDiskType", default, skip_serializing_if = "Option::is_none")] + pub os_disk_type: Option, + #[doc = "Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage."] + #[serde(rename = "kubeletDiskType", default, skip_serializing_if = "Option::is_none")] + pub kubelet_disk_type: Option, + #[doc = "Determines the type of workload a node can run."] + #[serde(rename = "workloadRuntime", default, skip_serializing_if = "Option::is_none")] + pub workload_runtime: Option, + #[doc = "A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script)."] + #[serde(rename = "messageOfTheDay", default, skip_serializing_if = "Option::is_none")] + pub message_of_the_day: Option, + #[doc = "If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"] + #[serde(rename = "vnetSubnetID", default, skip_serializing_if = "Option::is_none")] + pub vnet_subnet_id: Option, + #[doc = "If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"] + #[serde(rename = "podSubnetID", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet_id: Option, + #[doc = "The maximum number of pods that can run on a node."] + #[serde(rename = "maxPods", default, skip_serializing_if = "Option::is_none")] + pub max_pods: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] + #[serde(rename = "osSKU", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[doc = "The maximum number of nodes for auto-scaling"] + #[serde(rename = "maxCount", default, skip_serializing_if = "Option::is_none")] + pub max_count: Option, + #[doc = "The minimum number of nodes for auto-scaling"] + #[serde(rename = "minCount", default, skip_serializing_if = "Option::is_none")] + pub min_count: Option, + #[doc = "Whether to enable auto-scaler"] + #[serde(rename = "enableAutoScaling", default, skip_serializing_if = "Option::is_none")] + pub enable_auto_scaling: Option, + #[doc = "Describes how VMs are added to or removed from Agent Pools. See [billing states](https://docs.microsoft.com/azure/virtual-machines/states-billing)."] + #[serde(rename = "scaleDownMode", default, skip_serializing_if = "Option::is_none")] + pub scale_down_mode: Option, + #[doc = "The type of Agent Pool."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool)."] + #[serde(rename = "orchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub orchestrator_version: Option, + #[doc = "If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion was , this field will contain the full version being used."] + #[serde(rename = "currentOrchestratorVersion", default, skip_serializing_if = "Option::is_none")] + pub current_orchestrator_version: Option, + #[doc = "The version of node image"] + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[doc = "Settings for upgrading an agentpool"] + #[serde(rename = "upgradeSettings", default, skip_serializing_if = "Option::is_none")] + pub upgrade_settings: Option, + #[doc = "The current deployment or provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Describes the Power State of the cluster"] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'."] + #[serde(rename = "availabilityZones", default, skip_serializing_if = "Vec::is_empty")] + pub availability_zones: Vec, + #[doc = "Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false."] + #[serde(rename = "enableNodePublicIP", default, skip_serializing_if = "Option::is_none")] + pub enable_node_public_ip: Option, + #[doc = "This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"] + #[serde(rename = "nodePublicIPPrefixID", default, skip_serializing_if = "Option::is_none")] + pub node_public_ip_prefix_id: Option, + #[doc = "The Virtual Machine Scale Set priority."] + #[serde(rename = "scaleSetPriority", default, skip_serializing_if = "Option::is_none")] + pub scale_set_priority: Option, + #[doc = "The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see [spot VMs](https://docs.microsoft.com/azure/virtual-machines/spot-vms)"] + #[serde(rename = "scaleSetEvictionPolicy", default, skip_serializing_if = "Option::is_none")] + pub scale_set_eviction_policy: Option, + #[doc = "Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing)"] + #[serde(rename = "spotMaxPrice", default, skip_serializing_if = "Option::is_none")] + pub spot_max_price: Option, + #[doc = "The tags to be persisted on the agent pool virtual machine scale set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The node labels to be persisted across all nodes in agent pool."] + #[serde(rename = "nodeLabels", default, skip_serializing_if = "Option::is_none")] + pub node_labels: Option, + #[doc = "The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule."] + #[serde(rename = "nodeTaints", default, skip_serializing_if = "Vec::is_empty")] + pub node_taints: Vec, + #[doc = "The ID for Proximity Placement Group."] + #[serde(rename = "proximityPlacementGroupID", default, skip_serializing_if = "Option::is_none")] + pub proximity_placement_group_id: Option, + #[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] + #[serde(rename = "kubeletConfig", default, skip_serializing_if = "Option::is_none")] + pub kubelet_config: Option, + #[doc = "See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details."] + #[serde(rename = "linuxOSConfig", default, skip_serializing_if = "Option::is_none")] + pub linux_os_config: Option, + #[doc = "This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption"] + #[serde(rename = "enableEncryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub enable_encryption_at_host: Option, + #[doc = "Whether to enable UltraSSD"] + #[serde(rename = "enableUltraSSD", default, skip_serializing_if = "Option::is_none")] + pub enable_ultra_ssd: Option, + #[doc = "See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details."] + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[doc = "GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU."] + #[serde(rename = "gpuInstanceProfile", default, skip_serializing_if = "Option::is_none")] + pub gpu_instance_profile: Option, + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "Capacity Reservation Group ID for AgentPool to associate"] + #[serde(rename = "capacityReservationGroupID", default, skip_serializing_if = "Option::is_none")] + pub capacity_reservation_group_id: Option, + #[doc = "This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts)."] + #[serde(rename = "hostGroupID", default, skip_serializing_if = "Option::is_none")] + pub host_group_id: Option, +} +impl ManagedClusterAgentPoolProfileProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Auto upgrade profile for a managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterAutoUpgradeProfile { + #[doc = "For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel)."] + #[serde(rename = "upgradeChannel", default, skip_serializing_if = "Option::is_none")] + pub upgrade_channel: Option, +} +impl ManagedClusterAutoUpgradeProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_auto_upgrade_profile { + use super::*; + #[doc = "For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpgradeChannel { + #[serde(rename = "rapid")] + Rapid, + #[serde(rename = "stable")] + Stable, + #[serde(rename = "patch")] + Patch, + #[serde(rename = "node-image")] + NodeImage, + #[serde(rename = "none")] + None, + } +} +#[doc = "Cluster HTTP proxy configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterHttpProxyConfig { + #[doc = "The HTTP proxy server endpoint to use."] + #[serde(rename = "httpProxy", default, skip_serializing_if = "Option::is_none")] + pub http_proxy: Option, + #[doc = "The HTTPS proxy server endpoint to use."] + #[serde(rename = "httpsProxy", default, skip_serializing_if = "Option::is_none")] + pub https_proxy: Option, + #[doc = "The endpoints that should not go through proxy."] + #[serde(rename = "noProxy", default, skip_serializing_if = "Vec::is_empty")] + pub no_proxy: Vec, + #[doc = "A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS."] + #[serde(rename = "effectiveNoProxy", default, skip_serializing_if = "Vec::is_empty")] + pub effective_no_proxy: Vec, + #[doc = "Alternative CA cert to use for connecting to proxy servers."] + #[serde(rename = "trustedCa", default, skip_serializing_if = "Option::is_none")] + pub trusted_ca: Option, +} +impl ManagedClusterHttpProxyConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterIdentity { + #[doc = "The principal id of the system assigned identity which is used by master components."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant id of the system assigned identity which is used by master components."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ManagedClusterIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_identity { + use super::*; + #[doc = "For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + None, + } +} +#[doc = "Ingress profile for the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterIngressProfile { + #[doc = "Web App Routing settings for the ingress profile."] + #[serde(rename = "webAppRouting", default, skip_serializing_if = "Option::is_none")] + pub web_app_routing: Option, +} +impl ManagedClusterIngressProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Web App Routing settings for the ingress profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterIngressProfileWebAppRouting { + #[doc = "Whether to enable Web App Routing."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Resource ID of the DNS Zone to be associated with the web app. Used only when Web App Routing is enabled."] + #[serde(rename = "dnsZoneResourceId", default, skip_serializing_if = "Option::is_none")] + pub dns_zone_resource_id: Option, +} +impl ManagedClusterIngressProfileWebAppRouting { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List Managed Clusters operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterListResult { + #[doc = "The list of managed clusters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of managed cluster results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ManagedClusterListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile of the managed cluster load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterLoadBalancerProfile { + #[doc = "Desired managed outbound IPs for the cluster load balancer."] + #[serde(rename = "managedOutboundIPs", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_i_ps: Option, + #[doc = "Desired outbound IP Prefix resources for the cluster load balancer."] + #[serde(rename = "outboundIPPrefixes", default, skip_serializing_if = "Option::is_none")] + pub outbound_ip_prefixes: Option, + #[doc = "Desired outbound IP resources for the cluster load balancer."] + #[serde(rename = "outboundIPs", default, skip_serializing_if = "Option::is_none")] + pub outbound_i_ps: Option, + #[doc = "The effective outbound IP resources of the cluster load balancer."] + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[doc = "The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports."] + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[doc = "Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "Enable multiple standard load balancers per AKS cluster or not."] + #[serde(rename = "enableMultipleStandardLoadBalancers", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_standard_load_balancers: Option, +} +impl ManagedClusterLoadBalancerProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_load_balancer_profile { + use super::*; + #[doc = "Desired managed outbound IPs for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ManagedOutboundIPs { + #[doc = "The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. "] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. "] + #[serde(rename = "countIPv6", default, skip_serializing_if = "Option::is_none")] + pub count_i_pv6: Option, + } + impl ManagedOutboundIPs { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Desired outbound IP Prefix resources for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct OutboundIpPrefixes { + #[doc = "A list of public IP prefix resources."] + #[serde(rename = "publicIPPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + } + impl OutboundIpPrefixes { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Desired outbound IP resources for the cluster load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct OutboundIPs { + #[doc = "A list of public IP resources."] + #[serde(rename = "publicIPs", default, skip_serializing_if = "Vec::is_empty")] + pub public_i_ps: Vec, + } + impl OutboundIPs { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Profile of the managed outbound IP resources of the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterManagedOutboundIpProfile { + #[doc = "The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. "] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ManagedClusterManagedOutboundIpProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Profile of the managed cluster NAT gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterNatGatewayProfile { + #[doc = "Profile of the managed outbound IP resources of the managed cluster."] + #[serde(rename = "managedOutboundIPProfile", default, skip_serializing_if = "Option::is_none")] + pub managed_outbound_ip_profile: Option, + #[doc = "The effective outbound IP resources of the cluster NAT gateway."] + #[serde(rename = "effectiveOutboundIPs", default, skip_serializing_if = "Vec::is_empty")] + pub effective_outbound_i_ps: Vec, + #[doc = "Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +impl ManagedClusterNatGatewayProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The OIDC issuer profile of the Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterOidcIssuerProfile { + #[doc = "The OIDC issuer url of the Managed Cluster."] + #[serde(rename = "issuerURL", default, skip_serializing_if = "Option::is_none")] + pub issuer_url: Option, + #[doc = "Whether the OIDC issuer is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterOidcIssuerProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about the pod identity assigned to the Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentity { + #[doc = "The name of the pod identity."] + pub name: String, + #[doc = "The namespace of the pod identity."] + pub namespace: String, + #[doc = "The binding selector to use for the AzureIdentityBinding resource."] + #[serde(rename = "bindingSelector", default, skip_serializing_if = "Option::is_none")] + pub binding_selector: Option, + #[doc = "Details about a user assigned identity."] + pub identity: UserAssignedIdentity, + #[doc = "The current provisioning state of the pod identity."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "provisioningInfo", default, skip_serializing_if = "Option::is_none")] + pub provisioning_info: Option, +} +impl ManagedClusterPodIdentity { + pub fn new(name: String, namespace: String, identity: UserAssignedIdentity) -> Self { + Self { + name, + namespace, + binding_selector: None, + identity, + provisioning_state: None, + provisioning_info: None, + } + } +} +pub mod managed_cluster_pod_identity { + use super::*; + #[doc = "The current provisioning state of the pod identity."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Assigned, + Updating, + Deleting, + Failed, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ProvisioningInfo { + #[doc = "An error response from the pod identity provisioning."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + } + impl ProvisioningInfo { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "See [disable AAD Pod Identity for a specific Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for more details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPodIdentityException { + #[doc = "The name of the pod identity exception."] + pub name: String, + #[doc = "The namespace of the pod identity exception."] + pub namespace: String, + #[doc = "The pod labels to match."] + #[serde(rename = "podLabels")] + pub pod_labels: serde_json::Value, +} +impl ManagedClusterPodIdentityException { + pub fn new(name: String, namespace: String, pod_labels: serde_json::Value) -> Self { + Self { + name, + namespace, + pod_labels, + } + } +} +#[doc = "See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProfile { + #[doc = "Whether the pod identity addon is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information."] + #[serde(rename = "allowNetworkPluginKubenet", default, skip_serializing_if = "Option::is_none")] + pub allow_network_plugin_kubenet: Option, + #[doc = "The pod identities to use in the cluster."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identities: Vec, + #[doc = "The pod identity exceptions to allow."] + #[serde(rename = "userAssignedIdentityExceptions", default, skip_serializing_if = "Vec::is_empty")] + pub user_assigned_identity_exceptions: Vec, +} +impl ManagedClusterPodIdentityProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the pod identity provisioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProvisioningError { + #[doc = "An error response from the pod identity provisioning."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ManagedClusterPodIdentityProvisioningError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the pod identity provisioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPodIdentityProvisioningErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ManagedClusterPodIdentityProvisioningErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available upgrade versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterPoolUpgradeProfile { + #[doc = "The Kubernetes version (major.minor.patch)."] + #[serde(rename = "kubernetesVersion")] + pub kubernetes_version: String, + #[doc = "The Agent Pool name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType")] + pub os_type: OsType, + #[doc = "List of orchestrator types and versions available for upgrade."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub upgrades: Vec, +} +impl ManagedClusterPoolUpgradeProfile { + pub fn new(kubernetes_version: String, os_type: OsType) -> Self { + Self { + kubernetes_version, + name: None, + os_type, + upgrades: Vec::new(), + } + } +} +#[doc = "Properties of the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Describes the Power State of the cluster"] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "The max number of agent pools for the managed cluster."] + #[serde(rename = "maxAgentPools", default, skip_serializing_if = "Option::is_none")] + pub max_agent_pools: Option, + #[doc = "When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details."] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "The version of Kubernetes the Managed Cluster is running."] + #[serde(rename = "currentKubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub current_kubernetes_version: Option, + #[doc = "This cannot be updated once the Managed Cluster has been created."] + #[serde(rename = "dnsPrefix", default, skip_serializing_if = "Option::is_none")] + pub dns_prefix: Option, + #[doc = "This cannot be updated once the Managed Cluster has been created."] + #[serde(rename = "fqdnSubdomain", default, skip_serializing_if = "Option::is_none")] + pub fqdn_subdomain: Option, + #[doc = "The FQDN of the master pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The FQDN of private cluster."] + #[serde(rename = "privateFQDN", default, skip_serializing_if = "Option::is_none")] + pub private_fqdn: Option, + #[doc = "The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly."] + #[serde(rename = "azurePortalFQDN", default, skip_serializing_if = "Option::is_none")] + pub azure_portal_fqdn: Option, + #[doc = "The agent pool properties."] + #[serde(rename = "agentPoolProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub agent_pool_profiles: Vec, + #[doc = "Profile for Linux VMs in the container service cluster."] + #[serde(rename = "linuxProfile", default, skip_serializing_if = "Option::is_none")] + pub linux_profile: Option, + #[doc = "Profile for Windows VMs in the managed cluster."] + #[serde(rename = "windowsProfile", default, skip_serializing_if = "Option::is_none")] + pub windows_profile: Option, + #[doc = "Information about a service principal identity for the cluster to use for manipulating Azure APIs."] + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[doc = "The profile of managed cluster add-on."] + #[serde(rename = "addonProfiles", default, skip_serializing_if = "Option::is_none")] + pub addon_profiles: Option, + #[doc = "See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration."] + #[serde(rename = "podIdentityProfile", default, skip_serializing_if = "Option::is_none")] + pub pod_identity_profile: Option, + #[doc = "The OIDC issuer profile of the Managed Cluster."] + #[serde(rename = "oidcIssuerProfile", default, skip_serializing_if = "Option::is_none")] + pub oidc_issuer_profile: Option, + #[doc = "The name of the resource group containing agent pool nodes."] + #[serde(rename = "nodeResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub node_resource_group: Option, + #[doc = "Whether to enable Kubernetes Role-Based Access Control."] + #[serde(rename = "enableRBAC", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[doc = "(DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy."] + #[serde(rename = "enablePodSecurityPolicy", default, skip_serializing_if = "Option::is_none")] + pub enable_pod_security_policy: Option, + #[doc = "The default value is false. It can be enabled/disabled on creation and updation of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource."] + #[serde(rename = "enableNamespaceResources", default, skip_serializing_if = "Option::is_none")] + pub enable_namespace_resources: Option, + #[doc = "Profile of network configuration."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[doc = "For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad)."] + #[serde(rename = "aadProfile", default, skip_serializing_if = "Option::is_none")] + pub aad_profile: Option, + #[doc = "Auto upgrade profile for a managed cluster."] + #[serde(rename = "autoUpgradeProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_profile: Option, + #[doc = "Parameters to be applied to the cluster-autoscaler when enabled"] + #[serde(rename = "autoScalerProfile", default, skip_serializing_if = "Option::is_none")] + pub auto_scaler_profile: Option, + #[doc = "Access profile for managed cluster API server."] + #[serde(rename = "apiServerAccessProfile", default, skip_serializing_if = "Option::is_none")] + pub api_server_access_profile: Option, + #[doc = "This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'"] + #[serde(rename = "diskEncryptionSetID", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "Identities associated with the cluster."] + #[serde(rename = "identityProfile", default, skip_serializing_if = "Option::is_none")] + pub identity_profile: Option, + #[doc = "Private link resources associated with the cluster."] + #[serde(rename = "privateLinkResources", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_resources: Vec, + #[doc = "If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview)."] + #[serde(rename = "disableLocalAccounts", default, skip_serializing_if = "Option::is_none")] + pub disable_local_accounts: Option, + #[doc = "Cluster HTTP proxy configuration."] + #[serde(rename = "httpProxyConfig", default, skip_serializing_if = "Option::is_none")] + pub http_proxy_config: Option, + #[doc = "Security profile for the container service cluster."] + #[serde(rename = "securityProfile", default, skip_serializing_if = "Option::is_none")] + pub security_profile: Option, + #[doc = "Ingress profile for the container service cluster."] + #[serde(rename = "ingressProfile", default, skip_serializing_if = "Option::is_none")] + pub ingress_profile: Option, + #[doc = "Allow or deny public network access for AKS"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +impl ManagedClusterProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_properties { + use super::*; + #[doc = "Parameters to be applied to the cluster-autoscaler when enabled"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct AutoScalerProfile { + #[doc = "Valid values are 'true' and 'false'"] + #[serde(rename = "balance-similar-node-groups", default, skip_serializing_if = "Option::is_none")] + pub balance_similar_node_groups: Option, + #[doc = "If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expander: Option, + #[doc = "The default is 10."] + #[serde(rename = "max-empty-bulk-delete", default, skip_serializing_if = "Option::is_none")] + pub max_empty_bulk_delete: Option, + #[doc = "The default is 600."] + #[serde(rename = "max-graceful-termination-sec", default, skip_serializing_if = "Option::is_none")] + pub max_graceful_termination_sec: Option, + #[doc = "The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "max-node-provision-time", default, skip_serializing_if = "Option::is_none")] + pub max_node_provision_time: Option, + #[doc = "The default is 45. The maximum is 100 and the minimum is 0."] + #[serde(rename = "max-total-unready-percentage", default, skip_serializing_if = "Option::is_none")] + pub max_total_unready_percentage: Option, + #[doc = "For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc)."] + #[serde(rename = "new-pod-scale-up-delay", default, skip_serializing_if = "Option::is_none")] + pub new_pod_scale_up_delay: Option, + #[doc = "This must be an integer. The default is 3."] + #[serde(rename = "ok-total-unready-count", default, skip_serializing_if = "Option::is_none")] + pub ok_total_unready_count: Option, + #[doc = "The default is '10'. Values must be an integer number of seconds."] + #[serde(rename = "scan-interval", default, skip_serializing_if = "Option::is_none")] + pub scan_interval: Option, + #[doc = "The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-add", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_add: Option, + #[doc = "The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-delete", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_delete: Option, + #[doc = "The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-delay-after-failure", default, skip_serializing_if = "Option::is_none")] + pub scale_down_delay_after_failure: Option, + #[doc = "The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-unneeded-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unneeded_time: Option, + #[doc = "The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported."] + #[serde(rename = "scale-down-unready-time", default, skip_serializing_if = "Option::is_none")] + pub scale_down_unready_time: Option, + #[doc = "The default is '0.5'."] + #[serde(rename = "scale-down-utilization-threshold", default, skip_serializing_if = "Option::is_none")] + pub scale_down_utilization_threshold: Option, + #[doc = "The default is true."] + #[serde(rename = "skip-nodes-with-local-storage", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_local_storage: Option, + #[doc = "The default is true."] + #[serde(rename = "skip-nodes-with-system-pods", default, skip_serializing_if = "Option::is_none")] + pub skip_nodes_with_system_pods: Option, + } + impl AutoScalerProfile { + pub fn new() -> Self { + Self::default() + } + } + pub mod auto_scaler_profile { + use super::*; + #[doc = "If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Expander { + #[serde(rename = "least-waste")] + LeastWaste, + #[serde(rename = "most-pods")] + MostPods, + #[serde(rename = "priority")] + Priority, + #[serde(rename = "random")] + Random, + } + } + #[doc = "Allow or deny public network access for AKS"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[doc = "managed cluster properties for snapshot, these properties are read only."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterPropertiesForSnapshot { + #[doc = "The current kubernetes version."] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "The SKU of a Managed Cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Whether the cluster has enabled Kubernetes Role-Based Access Control or not."] + #[serde(rename = "enableRbac", default, skip_serializing_if = "Option::is_none")] + pub enable_rbac: Option, + #[doc = "network profile for managed cluster snapshot, these properties are read only."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, +} +impl ManagedClusterPropertiesForSnapshot { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The SKU of a Managed Cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSku { + #[doc = "The name of a managed cluster SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl ManagedClusterSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cluster_sku { + use super::*; + #[doc = "The name of a managed cluster SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + } + #[doc = "If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Paid, + Free, + } +} +#[doc = "Security profile for the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSecurityProfile { + #[doc = "Azure Defender settings for the security profile."] + #[serde(rename = "azureDefender", default, skip_serializing_if = "Option::is_none")] + pub azure_defender: Option, + #[doc = "Azure Key Vault key management service settings for the security profile."] + #[serde(rename = "azureKeyVaultKms", default, skip_serializing_if = "Option::is_none")] + pub azure_key_vault_kms: Option, + #[doc = "Workload Identity settings for the security profile."] + #[serde(rename = "workloadIdentity", default, skip_serializing_if = "Option::is_none")] + pub workload_identity: Option, +} +impl ManagedClusterSecurityProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Defender settings for the security profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSecurityProfileAzureDefender { + #[doc = "Whether to enable Azure Defender"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty."] + #[serde(rename = "logAnalyticsWorkspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_workspace_resource_id: Option, +} +impl ManagedClusterSecurityProfileAzureDefender { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Workload Identity settings for the security profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSecurityProfileWorkloadIdentity { + #[doc = "Whether to enable Workload Identity"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterSecurityProfileWorkloadIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a service principal identity for the cluster to use for manipulating Azure APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterServicePrincipalProfile { + #[doc = "The ID for the service principal."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "The secret password associated with the service principal in plain text."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +impl ManagedClusterServicePrincipalProfile { + pub fn new(client_id: String) -> Self { + Self { client_id, secret: None } + } +} +#[doc = "A managed cluster snapshot resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterSnapshot { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties for a managed cluster snapshot."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedClusterSnapshot { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "The response from the List Managed Cluster Snapshots operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSnapshotListResult { + #[doc = "The list of managed cluster snapshots."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of managed cluster snapshot results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ManagedClusterSnapshotListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for a managed cluster snapshot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterSnapshotProperties { + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "The type of a snapshot. The default is NodePool."] + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[doc = "managed cluster properties for snapshot, these properties are read only."] + #[serde(rename = "managedClusterPropertiesReadOnly", default, skip_serializing_if = "Option::is_none")] + pub managed_cluster_properties_read_only: Option, +} +impl ManagedClusterSnapshotProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage profile for the container service cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfile { + #[doc = "AzureDisk CSI Driver settings for the storage profile."] + #[serde(rename = "diskCSIDriver", default, skip_serializing_if = "Option::is_none")] + pub disk_csi_driver: Option, + #[doc = "AzureFile CSI Driver settings for the storage profile."] + #[serde(rename = "fileCSIDriver", default, skip_serializing_if = "Option::is_none")] + pub file_csi_driver: Option, + #[doc = "Snapshot Controller settings for the storage profile."] + #[serde(rename = "snapshotController", default, skip_serializing_if = "Option::is_none")] + pub snapshot_controller: Option, +} +impl ManagedClusterStorageProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureDisk CSI Driver settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileDiskCsiDriver { + #[doc = "Whether to enable AzureDisk CSI Driver. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "The version of AzureDisk CSI Driver. The default value is v1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl ManagedClusterStorageProfileDiskCsiDriver { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureFile CSI Driver settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileFileCsiDriver { + #[doc = "Whether to enable AzureFile CSI Driver. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterStorageProfileFileCsiDriver { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Snapshot Controller settings for the storage profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedClusterStorageProfileSnapshotController { + #[doc = "Whether to enable Snapshot Controller. The default value is true."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ManagedClusterStorageProfileSnapshotController { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of available upgrades for compute pools."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfile { + #[doc = "The ID of the upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the upgrade profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the upgrade profile."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Control plane and agent pool upgrade profiles."] + pub properties: ManagedClusterUpgradeProfileProperties, +} +impl ManagedClusterUpgradeProfile { + pub fn new(properties: ManagedClusterUpgradeProfileProperties) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "Control plane and agent pool upgrade profiles."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterUpgradeProfileProperties { + #[doc = "The list of available upgrade versions."] + #[serde(rename = "controlPlaneProfile")] + pub control_plane_profile: ManagedClusterPoolUpgradeProfile, + #[doc = "The list of available upgrade versions for agent pools."] + #[serde(rename = "agentPoolProfiles")] + pub agent_pool_profiles: Vec, +} +impl ManagedClusterUpgradeProfileProperties { + pub fn new( + control_plane_profile: ManagedClusterPoolUpgradeProfile, + agent_pool_profiles: Vec, + ) -> Self { + Self { + control_plane_profile, + agent_pool_profiles, + } + } +} +#[doc = "Profile for Windows VMs in the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedClusterWindowsProfile { + #[doc = "Specifies the name of the administrator account.

**Restriction:** Cannot end in \".\"

**Disallowed values:** \"administrator\", \"admin\", \"user\", \"user1\", \"test\", \"user2\", \"test1\", \"user3\", \"admin1\", \"1\", \"123\", \"a\", \"actuser\", \"adm\", \"admin2\", \"aspnet\", \"backup\", \"console\", \"david\", \"guest\", \"john\", \"owner\", \"root\", \"server\", \"sql\", \"support\", \"support_388945a0\", \"sys\", \"test2\", \"test3\", \"user4\", \"user5\".

**Minimum-length:** 1 character

**Max-length:** 20 characters"] + #[serde(rename = "adminUsername")] + pub admin_username: String, + #[doc = "Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\\W_])

**Disallowed values:** \"abc@123\", \"P@$$w0rd\", \"P@ssw0rd\", \"P@ssword123\", \"Pa$$word\", \"pass@word1\", \"Password!\", \"Password1\", \"Password22\", \"iloveyou!\""] + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[doc = "The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy)."] + #[serde(rename = "enableCSIProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_csi_proxy: Option, + #[doc = "Windows gMSA Profile in the managed cluster."] + #[serde(rename = "gmsaProfile", default, skip_serializing_if = "Option::is_none")] + pub gmsa_profile: Option, +} +impl ManagedClusterWindowsProfile { + pub fn new(admin_username: String) -> Self { + Self { + admin_username, + admin_password: None, + license_type: None, + enable_csi_proxy: None, + gmsa_profile: None, + } + } +} +pub mod managed_cluster_windows_profile { + use super::*; + #[doc = "The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + None, + #[serde(rename = "Windows_Server")] + WindowsServer, + } +} +#[doc = "This cannot be specified if networkPlugin is anything other than 'azure'."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkMode { + #[serde(rename = "transparent")] + Transparent, + #[serde(rename = "bridge")] + Bridge, +} +#[doc = "Network plugin used for building the Kubernetes network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkPlugin { + #[serde(rename = "azure")] + Azure, + #[serde(rename = "kubenet")] + Kubenet, + #[serde(rename = "none")] + None, +} +impl Default for NetworkPlugin { + fn default() -> Self { + Self::Kubenet + } +} +#[doc = "Network policy used for building the Kubernetes network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkPolicy { + #[serde(rename = "calico")] + Calico, + #[serde(rename = "azure")] + Azure, +} +#[doc = "network profile for managed cluster snapshot, these properties are read only."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfileForSnapshot { + #[doc = "Network plugin used for building the Kubernetes network."] + #[serde(rename = "networkPlugin", default, skip_serializing_if = "Option::is_none")] + pub network_plugin: Option, + #[doc = "Network policy used for building the Kubernetes network."] + #[serde(rename = "networkPolicy", default, skip_serializing_if = "Option::is_none")] + pub network_policy: Option, + #[doc = "This cannot be specified if networkPlugin is anything other than 'azure'."] + #[serde(rename = "networkMode", default, skip_serializing_if = "Option::is_none")] + pub network_mode: Option, + #[doc = "The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs."] + #[serde(rename = "loadBalancerSku", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_sku: Option, +} +impl NetworkProfileForSnapshot { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see [Ephemeral OS](https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsDiskType { + Managed, + Ephemeral, +} +#[doc = "The OS option profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProfile { + #[doc = "The ID of the OS option resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the OS option resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the OS option resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of OS option properties."] + pub properties: OsOptionPropertyList, +} +impl OsOptionProfile { + pub fn new(properties: OsOptionPropertyList) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[doc = "OS option property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionProperty { + #[doc = "The OS type."] + #[serde(rename = "os-type")] + pub os_type: String, + #[doc = "Whether the image is FIPS-enabled."] + #[serde(rename = "enable-fips-image")] + pub enable_fips_image: bool, +} +impl OsOptionProperty { + pub fn new(os_type: String, enable_fips_image: bool) -> Self { + Self { + os_type, + enable_fips_image, + } + } +} +#[doc = "The list of OS option properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsOptionPropertyList { + #[doc = "The list of OS options."] + #[serde(rename = "osOptionPropertyList")] + pub os_option_property_list: Vec, +} +impl OsOptionPropertyList { + pub fn new(os_option_property_list: Vec) -> Self { + Self { os_option_property_list } + } +} +#[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Ossku { + Ubuntu, + #[serde(rename = "CBLMariner")] + CblMariner, +} +#[doc = "The operating system type. The default is Linux."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Linux, + Windows, +} +impl Default for OsType { + fn default() -> Self { + Self::Linux + } +} +#[doc = "The List Operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "The list of operations"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Operation value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValue { + #[doc = "The origin of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Describes the properties of a Operation Value Display."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl OperationValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Operation Value Display."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValueDisplay { + #[doc = "The display name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The display name of the resource the operation applies to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The description of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The resource provider for the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +impl OperationValueDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Egress endpoints which AKS agent nodes connect to for common purpose."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OutboundEnvironmentEndpoint { + #[doc = "The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The endpoints that AKS agent nodes connect to"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +impl OutboundEnvironmentEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of OutboundEnvironmentEndpoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundEnvironmentEndpointCollection { + #[doc = "Collection of resources."] + pub value: Vec, + #[doc = "Link to next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OutboundEnvironmentEndpointCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Describes the Power State of the cluster"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerState { + #[doc = "Tells whether the cluster is Running or Stopped"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +impl PowerState { + pub fn new() -> Self { + Self::default() + } +} +pub mod power_state { + use super::*; + #[doc = "Tells whether the cluster is Running or Stopped"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Code { + Running, + Stopped, + } +} +#[doc = "Private endpoint which a connection belongs to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The resource ID of the private endpoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[doc = "The ID of the private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private endpoint connections"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "The collection value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Private endpoint which a connection belongs to."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "The state of a private link service connection."] + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, +} +impl PrivateEndpointConnectionProperties { + pub fn new(private_link_service_connection_state: PrivateLinkServiceConnectionState) -> Self { + Self { + provisioning_state: None, + private_endpoint: None, + private_link_service_connection_state, + } + } +} +pub mod private_endpoint_connection_properties { + use super::*; + #[doc = "The current provisioning state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, + } +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[doc = "The ID of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The group ID of the resource."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The RequiredMembers of the resource"] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link service ID of the resource, this field is exposed only to NRP internally."] + #[serde(rename = "privateLinkServiceID", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourcesListResult { + #[doc = "The collection value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateLinkResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The state of a private link service connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "The private link service connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The private link service connection description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_link_service_connection_state { + use super::*; + #[doc = "The private link service connection status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +pub type ProximityPlacementGroupId = String; +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A reference to an Azure resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceReference { + #[doc = "The fully qualified Azure resource id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ResourceReference { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A run command request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunCommandRequest { + #[doc = "The command to run."] + pub command: String, + #[doc = "A base64 encoded zip file containing the files required by the command."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[doc = "AuthToken issued for AKS AAD Server App."] + #[serde(rename = "clusterToken", default, skip_serializing_if = "Option::is_none")] + pub cluster_token: Option, +} +impl RunCommandRequest { + pub fn new(command: String) -> Self { + Self { + command, + context: None, + cluster_token: None, + } + } +} +#[doc = "run command result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RunCommandResult { + #[doc = "The command id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The results of a run command"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RunCommandResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes how VMs are added to or removed from Agent Pools. See [billing states](https://docs.microsoft.com/azure/virtual-machines/states-billing)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleDownMode { + Delete, + Deallocate, +} +#[doc = "The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see [spot VMs](https://docs.microsoft.com/azure/virtual-machines/spot-vms)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetEvictionPolicy { + Delete, + Deallocate, +} +impl Default for ScaleSetEvictionPolicy { + fn default() -> Self { + Self::Delete + } +} +#[doc = "The Virtual Machine Scale Set priority."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScaleSetPriority { + Spot, + Regular, +} +impl Default for ScaleSetPriority { + fn default() -> Self { + Self::Regular + } +} +#[doc = "A node pool snapshot resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Snapshot { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties used to configure a node pool snapshot."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Snapshot { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "The response from the List Snapshots operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SnapshotListResult { + #[doc = "The list of snapshots."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of snapshot results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SnapshotListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties used to configure a node pool snapshot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SnapshotProperties { + #[doc = "Data used when creating a target resource from a source resource."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "The type of a snapshot. The default is NodePool."] + #[serde(rename = "snapshotType", default, skip_serializing_if = "Option::is_none")] + pub snapshot_type: Option, + #[doc = "The version of Kubernetes."] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "The version of node image."] + #[serde(rename = "nodeImageVersion", default, skip_serializing_if = "Option::is_none")] + pub node_image_version: Option, + #[doc = "The operating system type. The default is Linux."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Specifies an OS SKU. This value must not be specified if OSType is Windows."] + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[doc = "The size of the VM."] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "Whether to use a FIPS-enabled OS."] + #[serde(rename = "enableFIPS", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, +} +impl SnapshotProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of a snapshot. The default is NodePool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SnapshotType { + NodePool, + ManagedCluster, +} +impl Default for SnapshotType { + fn default() -> Self { + Self::NodePool + } +} +pub type SpotMaxPrice = f64; +#[doc = "Reference to another subresource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubResource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl SubResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sysctl settings for Linux agent nodes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SysctlConfig { + #[doc = "Sysctl setting net.core.somaxconn."] + #[serde(rename = "netCoreSomaxconn", default, skip_serializing_if = "Option::is_none")] + pub net_core_somaxconn: Option, + #[doc = "Sysctl setting net.core.netdev_max_backlog."] + #[serde(rename = "netCoreNetdevMaxBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_core_netdev_max_backlog: Option, + #[doc = "Sysctl setting net.core.rmem_default."] + #[serde(rename = "netCoreRmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_default: Option, + #[doc = "Sysctl setting net.core.rmem_max."] + #[serde(rename = "netCoreRmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_rmem_max: Option, + #[doc = "Sysctl setting net.core.wmem_default."] + #[serde(rename = "netCoreWmemDefault", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_default: Option, + #[doc = "Sysctl setting net.core.wmem_max."] + #[serde(rename = "netCoreWmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_wmem_max: Option, + #[doc = "Sysctl setting net.core.optmem_max."] + #[serde(rename = "netCoreOptmemMax", default, skip_serializing_if = "Option::is_none")] + pub net_core_optmem_max: Option, + #[doc = "Sysctl setting net.ipv4.tcp_max_syn_backlog."] + #[serde(rename = "netIpv4TcpMaxSynBacklog", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_syn_backlog: Option, + #[doc = "Sysctl setting net.ipv4.tcp_max_tw_buckets."] + #[serde(rename = "netIpv4TcpMaxTwBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_max_tw_buckets: Option, + #[doc = "Sysctl setting net.ipv4.tcp_fin_timeout."] + #[serde(rename = "netIpv4TcpFinTimeout", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_fin_timeout: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_time."] + #[serde(rename = "netIpv4TcpKeepaliveTime", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_time: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_probes."] + #[serde(rename = "netIpv4TcpKeepaliveProbes", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_keepalive_probes: Option, + #[doc = "Sysctl setting net.ipv4.tcp_keepalive_intvl."] + #[serde(rename = "netIpv4TcpkeepaliveIntvl", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcpkeepalive_intvl: Option, + #[doc = "Sysctl setting net.ipv4.tcp_tw_reuse."] + #[serde(rename = "netIpv4TcpTwReuse", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_tcp_tw_reuse: Option, + #[doc = "Sysctl setting net.ipv4.ip_local_port_range."] + #[serde(rename = "netIpv4IpLocalPortRange", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_ip_local_port_range: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh1."] + #[serde(rename = "netIpv4NeighDefaultGcThresh1", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh1: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh2."] + #[serde(rename = "netIpv4NeighDefaultGcThresh2", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh2: Option, + #[doc = "Sysctl setting net.ipv4.neigh.default.gc_thresh3."] + #[serde(rename = "netIpv4NeighDefaultGcThresh3", default, skip_serializing_if = "Option::is_none")] + pub net_ipv4_neigh_default_gc_thresh3: Option, + #[doc = "Sysctl setting net.netfilter.nf_conntrack_max."] + #[serde(rename = "netNetfilterNfConntrackMax", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_max: Option, + #[doc = "Sysctl setting net.netfilter.nf_conntrack_buckets."] + #[serde(rename = "netNetfilterNfConntrackBuckets", default, skip_serializing_if = "Option::is_none")] + pub net_netfilter_nf_conntrack_buckets: Option, + #[doc = "Sysctl setting fs.inotify.max_user_watches."] + #[serde(rename = "fsInotifyMaxUserWatches", default, skip_serializing_if = "Option::is_none")] + pub fs_inotify_max_user_watches: Option, + #[doc = "Sysctl setting fs.file-max."] + #[serde(rename = "fsFileMax", default, skip_serializing_if = "Option::is_none")] + pub fs_file_max: Option, + #[doc = "Sysctl setting fs.aio-max-nr."] + #[serde(rename = "fsAioMaxNr", default, skip_serializing_if = "Option::is_none")] + pub fs_aio_max_nr: Option, + #[doc = "Sysctl setting fs.nr_open."] + #[serde(rename = "fsNrOpen", default, skip_serializing_if = "Option::is_none")] + pub fs_nr_open: Option, + #[doc = "Sysctl setting kernel.threads-max."] + #[serde(rename = "kernelThreadsMax", default, skip_serializing_if = "Option::is_none")] + pub kernel_threads_max: Option, + #[doc = "Sysctl setting vm.max_map_count."] + #[serde(rename = "vmMaxMapCount", default, skip_serializing_if = "Option::is_none")] + pub vm_max_map_count: Option, + #[doc = "Sysctl setting vm.swappiness."] + #[serde(rename = "vmSwappiness", default, skip_serializing_if = "Option::is_none")] + pub vm_swappiness: Option, + #[doc = "Sysctl setting vm.vfs_cache_pressure."] + #[serde(rename = "vmVfsCachePressure", default, skip_serializing_if = "Option::is_none")] + pub vm_vfs_cache_pressure: Option, +} +impl SysctlConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tags object for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsObject { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Time in a week."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeInWeek { + #[doc = "The weekday enum."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[doc = "Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range."] + #[serde(rename = "hourSlots", default, skip_serializing_if = "Vec::is_empty")] + pub hour_slots: Vec, +} +impl TimeInWeek { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeSpan { + #[doc = "The start of a time span"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[doc = "The end of a time span"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +impl TimeSpan { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "Details about a user assigned identity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentity { + #[doc = "The resource ID of the user assigned identity."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The client ID of the user assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The object ID of the user assigned identity."] + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, +} +impl UserAssignedIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The weekday enum."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeekDay { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[doc = "Windows gMSA Profile in the managed cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WindowsGmsaProfile { + #[doc = "Specifies whether to enable Windows gMSA in the managed cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster."] + #[serde(rename = "dnsServer", default, skip_serializing_if = "Option::is_none")] + pub dns_server: Option, + #[doc = "Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster."] + #[serde(rename = "rootDomainName", default, skip_serializing_if = "Option::is_none")] + pub root_domain_name: Option, +} +impl WindowsGmsaProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Determines the type of workload a node can run."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WorkloadRuntime { + #[serde(rename = "OCIContainer")] + OciContainer, + WasmWasi, +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/containerservice/src/package_preview_2022_03/operations.rs b/services/mgmt/containerservice/src/package_preview_2022_03/operations.rs new file mode 100644 index 0000000000..99016cae4f --- /dev/null +++ b/services/mgmt/containerservice/src/package_preview_2022_03/operations.rs @@ -0,0 +1,4959 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn agent_pools(&self) -> agent_pools::Client { + agent_pools::Client(self.clone()) + } + pub fn maintenance_configurations(&self) -> maintenance_configurations::Client { + maintenance_configurations::Client(self.clone()) + } + pub fn managed_cluster_snapshots(&self) -> managed_cluster_snapshots::Client { + managed_cluster_snapshots::Client(self.clone()) + } + pub fn managed_clusters(&self) -> managed_clusters::Client { + managed_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn resolve_private_link_service_id(&self) -> resolve_private_link_service_id::Client { + resolve_private_link_service_id::Client(self.clone()) + } + pub fn snapshots(&self) -> snapshots::Client { + snapshots::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ManagedClusters_GetOsOptions(#[from] managed_clusters::get_os_options::Error), + #[error(transparent)] + ManagedClusters_List(#[from] managed_clusters::list::Error), + #[error(transparent)] + ManagedClusters_ListByResourceGroup(#[from] managed_clusters::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusters_GetUpgradeProfile(#[from] managed_clusters::get_upgrade_profile::Error), + #[error(transparent)] + ManagedClusters_GetAccessProfile(#[from] managed_clusters::get_access_profile::Error), + #[error(transparent)] + ManagedClusters_ListClusterAdminCredentials(#[from] managed_clusters::list_cluster_admin_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterUserCredentials(#[from] managed_clusters::list_cluster_user_credentials::Error), + #[error(transparent)] + ManagedClusters_ListClusterMonitoringUserCredentials(#[from] managed_clusters::list_cluster_monitoring_user_credentials::Error), + #[error(transparent)] + ManagedClusters_Get(#[from] managed_clusters::get::Error), + #[error(transparent)] + ManagedClusters_CreateOrUpdate(#[from] managed_clusters::create_or_update::Error), + #[error(transparent)] + ManagedClusters_UpdateTags(#[from] managed_clusters::update_tags::Error), + #[error(transparent)] + ManagedClusters_Delete(#[from] managed_clusters::delete::Error), + #[error(transparent)] + MaintenanceConfigurations_ListByManagedCluster(#[from] maintenance_configurations::list_by_managed_cluster::Error), + #[error(transparent)] + MaintenanceConfigurations_Get(#[from] maintenance_configurations::get::Error), + #[error(transparent)] + MaintenanceConfigurations_CreateOrUpdate(#[from] maintenance_configurations::create_or_update::Error), + #[error(transparent)] + MaintenanceConfigurations_Delete(#[from] maintenance_configurations::delete::Error), + #[error(transparent)] + AgentPools_List(#[from] agent_pools::list::Error), + #[error(transparent)] + AgentPools_Get(#[from] agent_pools::get::Error), + #[error(transparent)] + AgentPools_CreateOrUpdate(#[from] agent_pools::create_or_update::Error), + #[error(transparent)] + AgentPools_Delete(#[from] agent_pools::delete::Error), + #[error(transparent)] + AgentPools_GetUpgradeProfile(#[from] agent_pools::get_upgrade_profile::Error), + #[error(transparent)] + AgentPools_GetAvailableAgentPoolVersions(#[from] agent_pools::get_available_agent_pool_versions::Error), + #[error(transparent)] + ManagedClusters_ResetServicePrincipalProfile(#[from] managed_clusters::reset_service_principal_profile::Error), + #[error(transparent)] + ManagedClusters_ResetAadProfile(#[from] managed_clusters::reset_aad_profile::Error), + #[error(transparent)] + ManagedClusters_RotateClusterCertificates(#[from] managed_clusters::rotate_cluster_certificates::Error), + #[error(transparent)] + ManagedClusters_RotateServiceAccountSigningKeys(#[from] managed_clusters::rotate_service_account_signing_keys::Error), + #[error(transparent)] + ManagedClusters_Stop(#[from] managed_clusters::stop::Error), + #[error(transparent)] + ManagedClusters_Start(#[from] managed_clusters::start::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Update(#[from] private_endpoint_connections::update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + AgentPools_UpgradeNodeImageVersion(#[from] agent_pools::upgrade_node_image_version::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + ResolvePrivateLinkServiceId_Post(#[from] resolve_private_link_service_id::post::Error), + #[error(transparent)] + ManagedClusters_RunCommand(#[from] managed_clusters::run_command::Error), + #[error(transparent)] + ManagedClusters_GetCommandResult(#[from] managed_clusters::get_command_result::Error), + #[error(transparent)] + ManagedClusters_ListOutboundNetworkDependenciesEndpoints(#[from] managed_clusters::list_outbound_network_dependencies_endpoints::Error), + #[error(transparent)] + Snapshots_List(#[from] snapshots::list::Error), + #[error(transparent)] + Snapshots_ListByResourceGroup(#[from] snapshots::list_by_resource_group::Error), + #[error(transparent)] + Snapshots_Get(#[from] snapshots::get::Error), + #[error(transparent)] + Snapshots_CreateOrUpdate(#[from] snapshots::create_or_update::Error), + #[error(transparent)] + Snapshots_UpdateTags(#[from] snapshots::update_tags::Error), + #[error(transparent)] + Snapshots_Delete(#[from] snapshots::delete::Error), + #[error(transparent)] + ManagedClusterSnapshots_List(#[from] managed_cluster_snapshots::list::Error), + #[error(transparent)] + ManagedClusterSnapshots_ListByResourceGroup(#[from] managed_cluster_snapshots::list_by_resource_group::Error), + #[error(transparent)] + ManagedClusterSnapshots_Get(#[from] managed_cluster_snapshots::get::Error), + #[error(transparent)] + ManagedClusterSnapshots_CreateOrUpdate(#[from] managed_cluster_snapshots::create_or_update::Error), + #[error(transparent)] + ManagedClusterSnapshots_UpdateTags(#[from] managed_cluster_snapshots::update_tags::Error), + #[error(transparent)] + ManagedClusterSnapshots_Delete(#[from] managed_cluster_snapshots::delete::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ContainerService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_clusters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets supported OS options in the specified subscription."] + pub fn get_os_options(&self, subscription_id: impl Into, location: impl Into) -> get_os_options::Builder { + get_os_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + resource_type: None, + } + } + #[doc = "Gets a list of managed clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the upgrade profile of a managed cluster."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets an access profile of a managed cluster."] + pub fn get_access_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + role_name: impl Into, + ) -> get_access_profile::Builder { + get_access_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + role_name: role_name.into(), + } + } + #[doc = "Lists the admin credentials of a managed cluster."] + pub fn list_cluster_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_admin_credentials::Builder { + list_cluster_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Lists the user credentials of a managed cluster."] + pub fn list_cluster_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_user_credentials::Builder { + list_cluster_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + format: None, + } + } + #[doc = "Lists the cluster monitoring user credentials of a managed cluster."] + pub fn list_cluster_monitoring_user_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_cluster_monitoring_user_credentials::Builder { + list_cluster_monitoring_user_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + server_fqdn: None, + } + } + #[doc = "Gets a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + ignore_pod_disruption_budget: None, + } + } + #[doc = "Reset the Service Principal Profile of a managed cluster."] + pub fn reset_service_principal_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_service_principal_profile::Builder { + reset_service_principal_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Reset the AAD Profile of a managed cluster."] + pub fn reset_aad_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> reset_aad_profile::Builder { + reset_aad_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Rotates the certificates of a managed cluster."] + pub fn rotate_cluster_certificates( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_cluster_certificates::Builder { + rotate_cluster_certificates::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Rotates the service account signing keys of a managed cluster."] + pub fn rotate_service_account_signing_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> rotate_service_account_signing_keys::Builder { + rotate_service_account_signing_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Stops a Managed Cluster"] + pub fn stop( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Starts a previously stopped Managed Cluster"] + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Submits a command to run against the Managed Cluster."] + pub fn run_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + request_payload: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + request_payload: request_payload.into(), + } + } + #[doc = "Gets the results of a command which has been run on the Managed Cluster."] + pub fn get_command_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + command_id: impl Into, + ) -> get_command_result::Builder { + get_command_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + command_id: command_id.into(), + } + } + #[doc = "Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster."] + pub fn list_outbound_network_dependencies_endpoints( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_outbound_network_dependencies_endpoints::Builder { + list_outbound_network_dependencies_endpoints::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod get_os_options { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) resource_type: Option, + } + impl Builder { + pub fn resource_type(mut self, resource_type: impl Into) -> Self { + self.resource_type = Some(resource_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/locations/{}/osOptions/default", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(resource_type) = &self.resource_type { + url.query_pairs_mut().append_pair("resource-type", resource_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OsOptionProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_access_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) role_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/accessProfiles/{}/listCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterAccessProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_admin_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterAdminCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_user_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + pub(crate) format: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn format(mut self, format: impl Into) -> Self { + self.format = Some(format.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + if let Some(format) = &self.format { + url.query_pairs_mut().append_pair("format", format); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cluster_monitoring_user_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) server_fqdn: Option, + } + impl Builder { + pub fn server_fqdn(mut self, server_fqdn: impl Into) -> Self { + self.server_fqdn = Some(server_fqdn.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/listClusterMonitoringUserCredential" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(server_fqdn) = &self.server_fqdn { + url.query_pairs_mut().append_pair("server-fqdn", server_fqdn); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedCluster), + Created201(models::ManagedCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) ignore_pod_disruption_budget: Option, + } + impl Builder { + pub fn ignore_pod_disruption_budget(mut self, ignore_pod_disruption_budget: bool) -> Self { + self.ignore_pod_disruption_budget = Some(ignore_pod_disruption_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(ignore_pod_disruption_budget) = &self.ignore_pod_disruption_budget { + url.query_pairs_mut() + .append_pair("ignore-pod-disruption-budget", &ignore_pod_disruption_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_service_principal_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterServicePrincipalProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetServicePrincipalProfile" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_aad_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterAadProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resetAADProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_cluster_certificates { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateClusterCertificates" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rotate_service_account_signing_keys { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/rotateServiceAccountSigningKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) request_payload: models::RunCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/runCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request_payload).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::RunCommandResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) command_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/commandResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.command_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RunCommandResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_outbound_network_dependencies_endpoints { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/outboundNetworkDependenciesEndpoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundEnvironmentEndpointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod maintenance_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of maintenance configurations in the specified managed cluster."] + pub fn list_by_managed_cluster( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_managed_cluster::Builder { + list_by_managed_cluster::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified maintenance configuration of a managed cluster."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + #[doc = "Creates or updates a maintenance configuration in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a maintenance configuration."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + config_name: config_name.into(), + } + } + } + pub mod list_by_managed_cluster { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + pub(crate) parameters: models::MaintenanceConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MaintenanceConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/maintenanceConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . config_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod agent_pools { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of agent pools in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified managed cluster agent pool."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Creates or updates an agent pool in the specified managed cluster."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes an agent pool in the specified managed cluster."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + ignore_pod_disruption_budget: None, + } + } + #[doc = "Gets the upgrade profile for an agent pool."] + pub fn get_upgrade_profile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> get_upgrade_profile::Builder { + get_upgrade_profile::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + #[doc = "Gets a list of supported Kubernetes versions for the specified agent pool."] + pub fn get_available_agent_pool_versions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get_available_agent_pool_versions::Builder { + get_available_agent_pool_versions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Upgrades the node image version of an agent pool to the latest."] + pub fn upgrade_node_image_version( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + agent_pool_name: impl Into, + ) -> upgrade_node_image_version::Builder { + upgrade_node_image_version::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + agent_pool_name: agent_pool_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AgentPool), + Created201(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) parameters: models::AgentPool, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + pub(crate) ignore_pod_disruption_budget: Option, + } + impl Builder { + pub fn ignore_pod_disruption_budget(mut self, ignore_pod_disruption_budget: bool) -> Self { + self.ignore_pod_disruption_budget = Some(ignore_pod_disruption_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.agent_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + if let Some(ignore_pod_disruption_budget) = &self.ignore_pod_disruption_budget { + url.query_pairs_mut() + .append_pair("ignore-pod-disruption-budget", &ignore_pod_disruption_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_upgrade_profile { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeProfiles/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolUpgradeProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_available_agent_pool_versions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/availableAgentPoolVersions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPoolAvailableVersions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod upgrade_node_image_version { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::AgentPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) agent_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/agentPools/{}/upgradeNodeImageVersion" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . agent_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AgentPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private endpoint connections in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Gets the specified private endpoint connection."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + #[doc = "Updates a private endpoint connection."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a private endpoint connection."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of private link resources in the specified managed cluster."] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/privateLinkResources" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resolve_private_link_service_id { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the private link service ID for the specified managed cluster."] + pub fn post( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> post::Builder { + post::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + } + pub mod post { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::PrivateLinkResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedClusters/{}/resolvePrivateLinkServiceId" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod snapshots { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Snapshot), + Created201(models::Snapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::Snapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Snapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/snapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod managed_cluster_snapshots { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a list of managed cluster snapshots in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists managed cluster snapshots in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a managed cluster snapshot."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a managed cluster snapshot."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates tags on a managed cluster snapshot."] + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a managed cluster snapshot."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ContainerService/managedclustersnapshots", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedclustersnapshots", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshotListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedclustersnapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ManagedClusterSnapshot), + Created201(models::ManagedClusterSnapshot), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::ManagedClusterSnapshot, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedclustersnapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedclustersnapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedClusterSnapshot = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ContainerService/managedclustersnapshots/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-02-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/cosmosdb/Cargo.toml b/services/mgmt/cosmosdb/Cargo.toml index 869276586e..3a41dcb759 100644 --- a/services/mgmt/cosmosdb/Cargo.toml +++ b/services/mgmt/cosmosdb/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_cosmosdb" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-10", "package-preview-2021-10", "package-2021-07-preview", "package-2021-06"] +features = ["no-default-tag", "package-preview-2021-11", "package-2021-10", "package-preview-2021-10", "package-2021-07-preview"] [features] -default = ["package-preview-2021-11", "enable_reqwest"] +default = ["package-preview-2022-02", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-preview-2022-02" = [] "package-preview-2021-11" = [] "package-2021-10" = [] "package-preview-2021-10" = [] diff --git a/services/mgmt/cosmosdb/README.md b/services/mgmt/cosmosdb/README.md index b395a87ae4..465fa030d0 100644 --- a/services/mgmt/cosmosdb/README.md +++ b/services/mgmt/cosmosdb/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/ To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-preview-2021-11`. +The default tag is `package-preview-2022-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-preview-2022-02` has 216 operations from 1 API versions: `2022-02-15-preview`. Use crate feature `package-preview-2022-02` to enable. The operations will be in the `package_preview_2022_02` module. - `package-preview-2021-11` has 207 operations from 1 API versions: `2021-11-15-preview`. Use crate feature `package-preview-2021-11` to enable. The operations will be in the `package_preview_2021_11` module. - `package-2021-10` has 168 operations from 1 API versions: `2021-10-15`. Use crate feature `package-2021-10` to enable. The operations will be in the `package_2021_10` module. - `package-preview-2021-10` has 200 operations from 1 API versions: `2021-10-15-preview`. Use crate feature `package-preview-2021-10` to enable. The operations will be in the `package_preview_2021_10` module. diff --git a/services/mgmt/cosmosdb/src/lib.rs b/services/mgmt/cosmosdb/src/lib.rs index a7e02f9dd3..2ea2a57d9f 100644 --- a/services/mgmt/cosmosdb/src/lib.rs +++ b/services/mgmt/cosmosdb/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-preview-2022-02")] +pub mod package_preview_2022_02; +#[cfg(all(feature = "package-preview-2022-02", not(feature = "no-default-tag")))] +pub use package_preview_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2021-11")] pub mod package_preview_2021_11; #[cfg(all(feature = "package-preview-2021-11", not(feature = "no-default-tag")))] diff --git a/services/mgmt/cosmosdb/src/package_preview_2022_02/mod.rs b/services/mgmt/cosmosdb/src/package_preview_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/cosmosdb/src/package_preview_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/cosmosdb/src/package_preview_2022_02/models.rs b/services/mgmt/cosmosdb/src/package_preview_2022_02/models.rs new file mode 100644 index 0000000000..24d507a9a5 --- /dev/null +++ b/services/mgmt/cosmosdb/src/package_preview_2022_02/models.rs @@ -0,0 +1,5938 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The resource model definition for a ARM proxy resource. It will have everything other than required location and tags"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArmProxyResource { + #[doc = "The unique resource identifier of the database account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the database account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ArmProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The core properties of ARM resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArmResourceProperties { + #[doc = "The unique resource identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The location of the resource group to which the resource belongs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with \"defaultExperience\": \"Cassandra\". Current \"defaultExperience\" values also include \"Table\", \"Graph\", \"DocumentDB\", and \"MongoDB\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ArmResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Analytical storage specific properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AnalyticalStorageConfiguration { + #[doc = "Describes the types of schema for analytical storage."] + #[serde(rename = "schemaType", default, skip_serializing_if = "Option::is_none")] + pub schema_type: Option, +} +impl AnalyticalStorageConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the types of schema for analytical storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AnalyticalStorageSchemaType { + WellDefined, + FullFidelity, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiProperties { + #[doc = "Describes the ServerVersion of an a MongoDB account."] + #[serde(rename = "serverVersion", default, skip_serializing_if = "Option::is_none")] + pub server_version: Option, +} +impl ApiProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod api_properties { + use super::*; + #[doc = "Describes the ServerVersion of an a MongoDB account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServerVersion { + #[serde(rename = "3.2")] + N3_2, + #[serde(rename = "3.6")] + N3_6, + #[serde(rename = "4.0")] + N4_0, + #[serde(rename = "4.2")] + N4_2, + } +} +#[doc = "Enum to indicate the API type of the restorable database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ApiType { + #[serde(rename = "MongoDB")] + MongoDb, + Gremlin, + Cassandra, + Table, + Sql, + GremlinV2, +} +#[doc = "Ldap authentication method properties. This feature is in preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthenticationMethodLdapProperties { + #[doc = "Hostname of the LDAP server."] + #[serde(rename = "serverHostname", default, skip_serializing_if = "Option::is_none")] + pub server_hostname: Option, + #[doc = "Port of the LDAP server."] + #[serde(rename = "serverPort", default, skip_serializing_if = "Option::is_none")] + pub server_port: Option, + #[doc = "Distinguished name of the look up user account, who can look up user details on authentication."] + #[serde(rename = "serviceUserDistinguishedName", default, skip_serializing_if = "Option::is_none")] + pub service_user_distinguished_name: Option, + #[doc = "Password of the look up user."] + #[serde(rename = "serviceUserPassword", default, skip_serializing_if = "Option::is_none")] + pub service_user_password: Option, + #[doc = "Distinguished name of the object to start the recursive search of users from."] + #[serde(rename = "searchBaseDistinguishedName", default, skip_serializing_if = "Option::is_none")] + pub search_base_distinguished_name: Option, + #[doc = "Template to use for searching. Defaults to (cn=%s) where %s will be replaced by the username used to login."] + #[serde(rename = "searchFilterTemplate", default, skip_serializing_if = "Option::is_none")] + pub search_filter_template: Option, + #[serde(rename = "serverCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub server_certificates: Vec, +} +impl AuthenticationMethodLdapProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB resource auto-upgrade policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoUpgradePolicyResource { + #[doc = "Cosmos DB resource throughput policy"] + #[serde(rename = "throughputPolicy", default, skip_serializing_if = "Option::is_none")] + pub throughput_policy: Option, +} +impl AutoUpgradePolicyResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoscaleSettings { + #[doc = "Represents maximum throughput, the resource can scale up to."] + #[serde(rename = "maxThroughput", default, skip_serializing_if = "Option::is_none")] + pub max_throughput: Option, +} +impl AutoscaleSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB provisioned throughput settings object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoscaleSettingsResource { + #[doc = "Represents maximum throughput container can scale up to."] + #[serde(rename = "maxThroughput")] + pub max_throughput: i64, + #[doc = "Cosmos DB resource auto-upgrade policy"] + #[serde(rename = "autoUpgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_policy: Option, + #[doc = "Represents target maximum throughput container can scale up to once offer is no longer in pending state."] + #[serde(rename = "targetMaxThroughput", default, skip_serializing_if = "Option::is_none")] + pub target_max_throughput: Option, +} +impl AutoscaleSettingsResource { + pub fn new(max_throughput: i64) -> Self { + Self { + max_throughput, + auto_upgrade_policy: None, + target_max_throughput: None, + } + } +} +#[doc = "An Azure Blob Storage data source/sink"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobDataTransferDataSourceSink { + #[serde(flatten)] + pub data_transfer_data_source_sink: DataTransferDataSourceSink, + #[serde(rename = "containerName")] + pub container_name: String, + #[serde(rename = "endpointUrl", default, skip_serializing_if = "Option::is_none")] + pub endpoint_url: Option, +} +impl AzureBlobDataTransferDataSourceSink { + pub fn new(data_transfer_data_source_sink: DataTransferDataSourceSink, container_name: String) -> Self { + Self { + data_transfer_data_source_sink, + container_name, + endpoint_url: None, + } + } +} +#[doc = "Backup information of a resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupInformation { + #[doc = "Information about the status of continuous backups."] + #[serde(rename = "continuousBackupInformation", default, skip_serializing_if = "Option::is_none")] + pub continuous_backup_information: Option, +} +impl BackupInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The object representing the policy for taking backups on an account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + #[doc = "Describes the mode of backups."] + #[serde(rename = "type")] + pub type_: BackupPolicyType, + #[doc = "The object representing the state of the migration between the backup policies."] + #[serde(rename = "migrationState", default, skip_serializing_if = "Option::is_none")] + pub migration_state: Option, +} +impl BackupPolicy { + pub fn new(type_: BackupPolicyType) -> Self { + Self { + type_, + migration_state: None, + } + } +} +#[doc = "The object representing the state of the migration between the backup policies."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupPolicyMigrationState { + #[doc = "Describes the status of migration between backup policy types."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Describes the mode of backups."] + #[serde(rename = "targetType", default, skip_serializing_if = "Option::is_none")] + pub target_type: Option, + #[doc = "Time at which the backup policy migration started (ISO-8601 format)."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +impl BackupPolicyMigrationState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the status of migration between backup policy types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BackupPolicyMigrationStatus { + Invalid, + InProgress, + Completed, + Failed, +} +#[doc = "Describes the mode of backups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BackupPolicyType { + Periodic, + Continuous, +} +#[doc = "A restorable backup of a Cassandra cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResource { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupResource { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_resource { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "The time this backup was taken, formatted like 2021-01-21T17:35:21"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Enum to indicate type of backup storage redundancy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BackupStorageRedundancy { + Geo, + Local, + Zone, +} +#[doc = "Cosmos DB capability object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Capability { + #[doc = "Name of the Cosmos DB capability. For example, \"name\": \"EnableCassandra\". Current values also include \"EnableTable\" and \"EnableGremlin\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl Capability { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The object that represents all properties related to capacity enforcement on an account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Capacity { + #[doc = "The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of throughput."] + #[serde(rename = "totalThroughputLimit", default, skip_serializing_if = "Option::is_none")] + pub total_throughput_limit: Option, +} +impl Capacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a managed Cassandra cluster public status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraClusterPublicStatus { + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[serde(rename = "reaperStatus", default, skip_serializing_if = "Option::is_none")] + pub reaper_status: Option, + #[doc = "List relevant information about any connection errors to the Datacenters."] + #[serde(rename = "connectionErrors", default, skip_serializing_if = "Vec::is_empty")] + pub connection_errors: Vec, + #[doc = "List of the status of each datacenter in this cluster."] + #[serde(rename = "dataCenters", default, skip_serializing_if = "Vec::is_empty")] + pub data_centers: Vec, +} +impl CassandraClusterPublicStatus { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB Cassandra keyspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Cassandra keyspace."] + pub properties: CassandraKeyspaceCreateUpdateProperties, +} +impl CassandraKeyspaceCreateUpdateParameters { + pub fn new(properties: CassandraKeyspaceCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Cassandra keyspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceCreateUpdateProperties { + #[doc = "Cosmos DB Cassandra keyspace resource object"] + pub resource: CassandraKeyspaceResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraKeyspaceCreateUpdateProperties { + pub fn new(resource: CassandraKeyspaceResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB Cassandra keyspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraKeyspaceGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraKeyspaceGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Cassandra keyspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraKeyspaceGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB Cassandra keyspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CassandraKeyspaceGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Cassandra keyspaces and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraKeyspaceListResult { + #[doc = "List of Cassandra keyspaces and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl CassandraKeyspaceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Cassandra keyspace resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceResource { + #[doc = "Name of the Cosmos DB Cassandra keyspace"] + pub id: String, +} +impl CassandraKeyspaceResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Cosmos DB Cassandra table partition key"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraPartitionKey { + #[doc = "Name of the Cosmos DB Cassandra table partition key"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl CassandraPartitionKey { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Cassandra table schema"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraSchema { + #[doc = "List of Cassandra table columns."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, + #[doc = "List of partition key."] + #[serde(rename = "partitionKeys", default, skip_serializing_if = "Vec::is_empty")] + pub partition_keys: Vec, + #[doc = "List of cluster key."] + #[serde(rename = "clusterKeys", default, skip_serializing_if = "Vec::is_empty")] + pub cluster_keys: Vec, +} +impl CassandraSchema { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB Cassandra table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Cassandra table."] + pub properties: CassandraTableCreateUpdateProperties, +} +impl CassandraTableCreateUpdateParameters { + pub fn new(properties: CassandraTableCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Cassandra table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableCreateUpdateProperties { + #[doc = "Cosmos DB Cassandra table resource object"] + pub resource: CassandraTableResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraTableCreateUpdateProperties { + pub fn new(resource: CassandraTableResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB Cassandra table"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraTableGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraTableGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Cassandra table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraTableGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB Cassandra table"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CassandraTableGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Cassandra tables and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraTableListResult { + #[doc = "List of Cassandra tables and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl CassandraTableListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Cassandra table resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableResource { + #[doc = "Name of the Cosmos DB Cassandra table"] + pub id: String, + #[doc = "Time to live of the Cosmos DB Cassandra table"] + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[doc = "Cosmos DB Cassandra table schema"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "Analytical TTL."] + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +impl CassandraTableResource { + pub fn new(id: String) -> Self { + Self { + id, + default_ttl: None, + schema: None, + analytical_storage_ttl: None, + } + } +} +#[doc = "Parameters to create and update Cosmos DB Cassandra view."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraViewCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Cassandra view."] + pub properties: CassandraViewCreateUpdateProperties, +} +impl CassandraViewCreateUpdateParameters { + pub fn new(properties: CassandraViewCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Cassandra view."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraViewCreateUpdateProperties { + #[doc = "Cosmos DB Cassandra view resource object"] + pub resource: CassandraViewResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraViewCreateUpdateProperties { + pub fn new(resource: CassandraViewResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB Cassandra view"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraViewGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl CassandraViewGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Cassandra view."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraViewGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB Cassandra view"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CassandraViewGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Cassandra views and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraViewListResult { + #[doc = "List of Cassandra views and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl CassandraViewListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Cassandra view resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraViewResource { + #[doc = "Name of the Cosmos DB Cassandra view"] + pub id: String, + #[doc = "View Definition of the Cosmos DB Cassandra view"] + #[serde(rename = "viewDefinition")] + pub view_definition: String, +} +impl CassandraViewResource { + pub fn new(id: String, view_definition: String) -> Self { + Self { id, view_definition } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Certificate { + #[doc = "PEM formatted public key."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pem: Option, +} +impl Certificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientEncryptionIncludedPath { + #[doc = "Path that needs to be encrypted."] + pub path: String, + #[doc = "The identifier of the Client Encryption Key to be used to encrypt the path."] + #[serde(rename = "clientEncryptionKeyId")] + pub client_encryption_key_id: String, + #[doc = "The type of encryption to be performed. Eg - Deterministic, Randomized."] + #[serde(rename = "encryptionType")] + pub encryption_type: String, + #[doc = "The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256."] + #[serde(rename = "encryptionAlgorithm")] + pub encryption_algorithm: String, +} +impl ClientEncryptionIncludedPath { + pub fn new(path: String, client_encryption_key_id: String, encryption_type: String, encryption_algorithm: String) -> Self { + Self { + path, + client_encryption_key_id, + encryption_type, + encryption_algorithm, + } + } +} +#[doc = "Parameters to create and update ClientEncryptionKey."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientEncryptionKeyCreateUpdateParameters { + #[doc = "Properties to create and update ClientEncryptionKey."] + pub properties: ClientEncryptionKeyCreateUpdateProperties, +} +impl ClientEncryptionKeyCreateUpdateParameters { + pub fn new(properties: ClientEncryptionKeyCreateUpdateProperties) -> Self { + Self { properties } + } +} +#[doc = "Properties to create and update ClientEncryptionKey."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientEncryptionKeyCreateUpdateProperties { + #[doc = "Cosmos DB client encryption key resource object."] + pub resource: ClientEncryptionKeyResource, +} +impl ClientEncryptionKeyCreateUpdateProperties { + pub fn new(resource: ClientEncryptionKeyResource) -> Self { + Self { resource } + } +} +#[doc = "The properties of a ClientEncryptionKey resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientEncryptionKeyGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl ClientEncryptionKeyGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Client Encryption Key."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientEncryptionKeyGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "The properties of a ClientEncryptionKey resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientEncryptionKeyGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB client encryption key resource object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientEncryptionKeyResource { + #[doc = "Name of the ClientEncryptionKey"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data."] + #[serde(rename = "encryptionAlgorithm", default, skip_serializing_if = "Option::is_none")] + pub encryption_algorithm: Option, + #[doc = "Wrapped (encrypted) form of the key represented as a byte array."] + #[serde(rename = "wrappedDataEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub wrapped_data_encryption_key: Option, + #[doc = "Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key."] + #[serde(rename = "keyWrapMetadata", default, skip_serializing_if = "Option::is_none")] + pub key_wrap_metadata: Option, +} +impl ClientEncryptionKeyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the client encryption keys and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientEncryptionKeysListResult { + #[doc = "List of client encryption keys and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ClientEncryptionKeysListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB client encryption policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientEncryptionPolicy { + #[doc = "Paths of the item that need encryption along with path-specific settings."] + #[serde(rename = "includedPaths")] + pub included_paths: Vec, + #[doc = "Version of the client encryption policy definition. Please note, user passed value is ignored. Default policy version is 1."] + #[serde(rename = "policyFormatVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_format_version: Option, +} +impl ClientEncryptionPolicy { + pub fn new(included_paths: Vec) -> Self { + Self { + included_paths, + policy_format_version: None, + } + } +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "Error Response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Cassandra table cluster key"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterKey { + #[doc = "Name of the Cosmos DB Cassandra table cluster key"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Order of the Cosmos DB Cassandra table cluster key, only support \"Asc\" and \"Desc\""] + #[serde(rename = "orderBy", default, skip_serializing_if = "Option::is_none")] + pub order_by: Option, +} +impl ClusterKey { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Representation of a managed Cassandra cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterResource { + #[serde(flatten)] + pub managed_cassandra_arm_resource_properties: ManagedCassandraArmResourceProperties, + #[doc = "Properties of a managed Cassandra cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClusterResource { + pub fn new() -> Self { + Self::default() + } +} +pub mod cluster_resource { + use super::*; + #[doc = "Properties of a managed Cassandra cluster."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "The status of the resource at the time the operation was called."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup."] + #[serde(rename = "restoreFromBackupId", default, skip_serializing_if = "Option::is_none")] + pub restore_from_backup_id: Option, + #[doc = "Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'"] + #[serde(rename = "delegatedManagementSubnetId", default, skip_serializing_if = "Option::is_none")] + pub delegated_management_subnet_id: Option, + #[doc = "Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version."] + #[serde(rename = "cassandraVersion", default, skip_serializing_if = "Option::is_none")] + pub cassandra_version: Option, + #[doc = "If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the cluster, set the value to use on this property."] + #[serde(rename = "clusterNameOverride", default, skip_serializing_if = "Option::is_none")] + pub cluster_name_override: Option, + #[doc = "Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. 'Ldap' is in preview."] + #[serde(rename = "authenticationMethod", default, skip_serializing_if = "Option::is_none")] + pub authentication_method: Option, + #[doc = "Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only applies when the authenticationMethod field is 'Cassandra'."] + #[serde(rename = "initialCassandraAdminPassword", default, skip_serializing_if = "Option::is_none")] + pub initial_cassandra_admin_password: Option, + #[serde(rename = "prometheusEndpoint", default, skip_serializing_if = "Option::is_none")] + pub prometheus_endpoint: Option, + #[doc = "Should automatic repairs run on this cluster? If omitted, this is true, and should stay true unless you are running a hybrid cluster where you are already doing your own repairs."] + #[serde(rename = "repairEnabled", default, skip_serializing_if = "Option::is_none")] + pub repair_enabled: Option, + #[doc = "List of TLS certificates used to authorize clients connecting to the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be validated from one or more of the public certificates in this property."] + #[serde(rename = "clientCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub client_certificates: Vec, + #[doc = "List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the certificates provided in this property."] + #[serde(rename = "externalGossipCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub external_gossip_certificates: Vec, + #[doc = "List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will present TLS client certificates that are verifiable using one of the certificates provided in this property."] + #[serde(rename = "gossipCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub gossip_certificates: Vec, + #[doc = "List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed node lists of all managed nodes."] + #[serde(rename = "externalSeedNodes", default, skip_serializing_if = "Vec::is_empty")] + pub external_seed_nodes: Vec, + #[doc = "List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of all unmanaged nodes."] + #[serde(rename = "seedNodes", default, skip_serializing_if = "Vec::is_empty")] + pub seed_nodes: Vec, + #[doc = "Number of hours to wait between taking a backup of the cluster."] + #[serde(rename = "hoursBetweenBackups", default, skip_serializing_if = "Option::is_none")] + pub hours_between_backups: Option, + #[doc = "Whether the cluster and associated data centers has been deallocated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deallocated: Option, + #[doc = "Whether Cassandra audit logging is enabled"] + #[serde(rename = "cassandraAuditLoggingEnabled", default, skip_serializing_if = "Option::is_none")] + pub cassandra_audit_logging_enabled: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. 'Ldap' is in preview."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationMethod { + None, + Cassandra, + Ldap, + } + } +} +pub type CollectionName = String; +#[doc = "Cosmos DB Cassandra table column"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Column { + #[doc = "Name of the Cosmos DB Cassandra table column"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the Cosmos DB Cassandra table column"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Column { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response of /command api"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CommandOutput { + #[doc = "Output of the command."] + #[serde(rename = "commandOutput", default, skip_serializing_if = "Option::is_none")] + pub command_output: Option, +} +impl CommandOutput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specification of which command to run where"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandPostBody { + #[doc = "The command which should be run"] + pub command: String, + #[doc = "The arguments for the command to be run"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub arguments: Option, + #[doc = "IP address of the cassandra host to run the command on"] + pub host: String, + #[doc = "If true, stops cassandra before executing the command and then start it again"] + #[serde(rename = "cassandra-stop-start", default, skip_serializing_if = "Option::is_none")] + pub cassandra_stop_start: Option, + #[doc = "If true, allows the command to *write* to the cassandra directory, otherwise read-only."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub readwrite: Option, +} +impl CommandPostBody { + pub fn new(command: String, host: String) -> Self { + Self { + command, + arguments: None, + host, + cassandra_stop_start: None, + readwrite: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CompositePath { + #[doc = "The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Sort order for composite paths."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, +} +impl CompositePath { + pub fn new() -> Self { + Self::default() + } +} +pub mod composite_path { + use super::*; + #[doc = "Sort order for composite paths."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Order { + #[serde(rename = "ascending")] + Ascending, + #[serde(rename = "descending")] + Descending, + } +} +pub type CompositePathList = Vec; +#[doc = "The conflict resolution policy for the container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConflictResolutionPolicy { + #[doc = "Indicates the conflict resolution mode."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "The conflict resolution path in the case of LastWriterWins mode."] + #[serde(rename = "conflictResolutionPath", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_path: Option, + #[doc = "The procedure to resolve conflicts in the case of custom mode."] + #[serde(rename = "conflictResolutionProcedure", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_procedure: Option, +} +impl ConflictResolutionPolicy { + pub fn new() -> Self { + Self::default() + } +} +pub mod conflict_resolution_policy { + use super::*; + #[doc = "Indicates the conflict resolution mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + LastWriterWins, + Custom, + } + impl Default for Mode { + fn default() -> Self { + Self::LastWriterWins + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionError { + #[doc = "The kind of connection error that occurred."] + #[serde(rename = "connectionState", default, skip_serializing_if = "Option::is_none")] + pub connection_state: Option, + #[doc = "The IP of host that originated the failed connection."] + #[serde(rename = "iPFrom", default, skip_serializing_if = "Option::is_none")] + pub i_p_from: Option, + #[doc = "The IP that the connection attempted to reach."] + #[serde(rename = "iPTo", default, skip_serializing_if = "Option::is_none")] + pub i_p_to: Option, + #[doc = "The TCP port the connection was attempted on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Detailed error message about the failed connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub exception: Option, +} +impl ConnectionError { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_error { + use super::*; + #[doc = "The kind of connection error that occurred."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionState { + Unknown, + #[serde(rename = "OK")] + Ok, + OperatorToDataCenterNetworkError, + DatacenterToDatacenterNetworkError, + InternalOperatorToDataCenterCertificateError, + InternalError, + } +} +#[doc = "The cassandra connector offer type for the Cosmos DB C* database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ConnectorOffer { + Small, +} +#[doc = "The consistency policy for the Cosmos DB database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConsistencyPolicy { + #[doc = "The default consistency level and configuration settings of the Cosmos DB account."] + #[serde(rename = "defaultConsistencyLevel")] + pub default_consistency_level: consistency_policy::DefaultConsistencyLevel, + #[doc = "When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'."] + #[serde(rename = "maxStalenessPrefix", default, skip_serializing_if = "Option::is_none")] + pub max_staleness_prefix: Option, + #[doc = "When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'."] + #[serde(rename = "maxIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub max_interval_in_seconds: Option, +} +impl ConsistencyPolicy { + pub fn new(default_consistency_level: consistency_policy::DefaultConsistencyLevel) -> Self { + Self { + default_consistency_level, + max_staleness_prefix: None, + max_interval_in_seconds: None, + } + } +} +pub mod consistency_policy { + use super::*; + #[doc = "The default consistency level and configuration settings of the Cosmos DB account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultConsistencyLevel { + Eventual, + Session, + BoundedStaleness, + Strong, + ConsistentPrefix, + } +} +#[doc = "The configuration of the partition key to be used for partitioning data into multiple partitions"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerPartitionKey { + #[doc = "List of paths using which data within the container can be partitioned"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub paths: Vec, + #[doc = "Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Indicates the version of the partition key definition"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Indicates if the container is using a system generated partition key"] + #[serde(rename = "systemKey", default, skip_serializing_if = "Option::is_none")] + pub system_key: Option, +} +impl ContainerPartitionKey { + pub fn new() -> Self { + Self::default() + } +} +pub mod container_partition_key { + use super::*; + #[doc = "Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Hash, + Range, + MultiHash, + } + impl Default for Kind { + fn default() -> Self { + Self::Hash + } + } +} +#[doc = "Information about the status of continuous backups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContinuousBackupInformation { + #[doc = "The latest restorable timestamp for a resource."] + #[serde(rename = "latestRestorableTimestamp", default, skip_serializing_if = "Option::is_none")] + pub latest_restorable_timestamp: Option, +} +impl ContinuousBackupInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the regional restorable account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContinuousBackupRestoreLocation { + #[doc = "The name of the continuous backup restore location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl ContinuousBackupRestoreLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The object representing continuous mode backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContinuousModeBackupPolicy { + #[serde(flatten)] + pub backup_policy: BackupPolicy, + #[doc = "Configuration values for periodic mode backup"] + #[serde(rename = "continuousModeProperties", default, skip_serializing_if = "Option::is_none")] + pub continuous_mode_properties: Option, +} +impl ContinuousModeBackupPolicy { + pub fn new(backup_policy: BackupPolicy) -> Self { + Self { + backup_policy, + continuous_mode_properties: None, + } + } +} +#[doc = "Configuration values for periodic mode backup"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContinuousModeProperties { + #[doc = "Enum to indicate type of Continuous backup tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl ContinuousModeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enum to indicate type of Continuous backup tier."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContinuousTier { + Continuous7Days, + Continuous30Days, +} +#[doc = "The CORS policy for the Cosmos DB database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CorsPolicy { + #[doc = "The origin domains that are permitted to make a request against the service via CORS."] + #[serde(rename = "allowedOrigins")] + pub allowed_origins: String, + #[doc = "The methods (HTTP request verbs) that the origin domain may use for a CORS request."] + #[serde(rename = "allowedMethods", default, skip_serializing_if = "Option::is_none")] + pub allowed_methods: Option, + #[doc = "The request headers that the origin domain may specify on the CORS request."] + #[serde(rename = "allowedHeaders", default, skip_serializing_if = "Option::is_none")] + pub allowed_headers: Option, + #[doc = "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer."] + #[serde(rename = "exposedHeaders", default, skip_serializing_if = "Option::is_none")] + pub exposed_headers: Option, + #[doc = "The maximum amount time that a browser should cache the preflight OPTIONS request."] + #[serde(rename = "maxAgeInSeconds", default, skip_serializing_if = "Option::is_none")] + pub max_age_in_seconds: Option, +} +impl CorsPolicy { + pub fn new(allowed_origins: String) -> Self { + Self { + allowed_origins, + allowed_methods: None, + allowed_headers: None, + exposed_headers: None, + max_age_in_seconds: None, + } + } +} +#[doc = "A CosmosDB Cassandra API data source/sink"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosCassandraDataTransferDataSourceSink { + #[serde(flatten)] + pub data_transfer_data_source_sink: DataTransferDataSourceSink, + #[serde(rename = "keyspaceName")] + pub keyspace_name: String, + #[serde(rename = "tableName")] + pub table_name: String, +} +impl CosmosCassandraDataTransferDataSourceSink { + pub fn new(data_transfer_data_source_sink: DataTransferDataSourceSink, keyspace_name: String, table_name: String) -> Self { + Self { + data_transfer_data_source_sink, + keyspace_name, + table_name, + } + } +} +#[doc = "A CosmosDB Cassandra API data source/sink"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosSqlDataTransferDataSourceSink { + #[serde(flatten)] + pub data_transfer_data_source_sink: DataTransferDataSourceSink, + #[serde(rename = "databaseName")] + pub database_name: String, + #[serde(rename = "containerName")] + pub container_name: String, +} +impl CosmosSqlDataTransferDataSourceSink { + pub fn new(data_transfer_data_source_sink: DataTransferDataSourceSink, database_name: String, container_name: String) -> Self { + Self { + data_transfer_data_source_sink, + database_name, + container_name, + } + } +} +#[doc = "Parameters to create Data Transfer Job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateJobRequest { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "The properties of a DataTransfer Job"] + pub properties: DataTransferJobProperties, +} +impl CreateJobRequest { + pub fn new(properties: DataTransferJobProperties) -> Self { + Self { + arm_proxy_resource: ArmProxyResource::default(), + properties, + } + } +} +#[doc = "Enum to indicate the mode of account creation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CreateMode { + Default, + Restore, +} +impl Default for CreateMode { + fn default() -> Self { + Self::Default + } +} +#[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateUpdateOptions { + #[doc = "Request Units per second. For example, \"throughput\": 10000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, +} +impl CreateUpdateOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A managed Cassandra data center."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataCenterResource { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Properties of a managed Cassandra data center."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DataCenterResource { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_center_resource { + use super::*; + #[doc = "Properties of a managed Cassandra data center."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "The status of the resource at the time the operation was called."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The region this data center should be created in."] + #[serde(rename = "dataCenterLocation", default, skip_serializing_if = "Option::is_none")] + pub data_center_location: Option, + #[doc = "Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'."] + #[serde(rename = "delegatedSubnetId", default, skip_serializing_if = "Option::is_none")] + pub delegated_subnet_id: Option, + #[doc = "The number of nodes the data center should have. This is the desired number. After it is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster."] + #[serde(rename = "nodeCount", default, skip_serializing_if = "Option::is_none")] + pub node_count: Option, + #[doc = "IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the seedNodes property on the cluster, which aggregates the seed nodes from all data centers in the cluster."] + #[serde(rename = "seedNodes", default, skip_serializing_if = "Vec::is_empty")] + pub seed_nodes: Vec, + #[doc = "A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are allowed."] + #[serde(rename = "base64EncodedCassandraYamlFragment", default, skip_serializing_if = "Option::is_none")] + pub base64_encoded_cassandra_yaml_fragment: Option, + #[doc = "Key uri to use for encryption of managed disks. Ensure the system assigned identity of the cluster has been assigned appropriate permissions(key get/wrap/unwrap permissions) on the key."] + #[serde(rename = "managedDiskCustomerKeyUri", default, skip_serializing_if = "Option::is_none")] + pub managed_disk_customer_key_uri: Option, + #[doc = "Indicates the Key Uri of the customer key to use for encryption of the backup storage account."] + #[serde(rename = "backupStorageCustomerKeyUri", default, skip_serializing_if = "Option::is_none")] + pub backup_storage_customer_key_uri: Option, + #[doc = "Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Disk SKU used for data centers. Default value is P30."] + #[serde(rename = "diskSku", default, skip_serializing_if = "Option::is_none")] + pub disk_sku: Option, + #[doc = "Number of disk used for data centers. Default value is 4."] + #[serde(rename = "diskCapacity", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity: Option, + #[doc = "If the data center has Availability Zone feature, apply it to the Virtual Machine ScaleSet that host the cassandra data center virtual machines."] + #[serde(rename = "availabilityZone", default, skip_serializing_if = "Option::is_none")] + pub availability_zone: Option, + #[doc = "Ldap authentication method properties. This feature is in preview."] + #[serde(rename = "authenticationMethodLdapProperties", default, skip_serializing_if = "Option::is_none")] + pub authentication_method_ldap_properties: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Base class for all DataTransfer source/sink"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataTransferDataSourceSink { + pub component: data_transfer_data_source_sink::Component, +} +impl DataTransferDataSourceSink { + pub fn new(component: data_transfer_data_source_sink::Component) -> Self { + Self { component } + } +} +pub mod data_transfer_data_source_sink { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Component { + #[serde(rename = "CosmosDBCassandra")] + CosmosDbCassandra, + #[serde(rename = "CosmosDBSql")] + CosmosDbSql, + AzureBlobStorage, + } + impl Default for Component { + fn default() -> Self { + Self::CosmosDbCassandra + } + } +} +#[doc = "The List operation response, that contains the Data Transfer jobs and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataTransferJobFeedResults { + #[doc = "List of Data Transfer jobs and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of Data Transfer job list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DataTransferJobFeedResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A Cosmos DB Data Transfer Job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataTransferJobGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "The properties of a DataTransfer Job"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DataTransferJobGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a DataTransfer Job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataTransferJobProperties { + #[doc = "Job Name"] + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[doc = "Base class for all DataTransfer source/sink"] + pub source: DataTransferDataSourceSink, + #[doc = "Base class for all DataTransfer source/sink"] + pub destination: DataTransferDataSourceSink, + #[doc = "Job Status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Processed Count."] + #[serde(rename = "processedCount", default, skip_serializing_if = "Option::is_none")] + pub processed_count: Option, + #[doc = "Total Count."] + #[serde(rename = "totalCount", default, skip_serializing_if = "Option::is_none")] + pub total_count: Option, + #[doc = "Last Updated Time (ISO-8601 format)."] + #[serde(rename = "lastUpdatedUtcTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_utc_time: Option, + #[doc = "Worker count"] + #[serde(rename = "workerCount", default, skip_serializing_if = "Option::is_none")] + pub worker_count: Option, + #[doc = "Error Response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl DataTransferJobProperties { + pub fn new(source: DataTransferDataSourceSink, destination: DataTransferDataSourceSink) -> Self { + Self { + job_name: None, + source, + destination, + status: None, + processed_count: None, + total_count: None, + last_updated_utc_time: None, + worker_count: None, + error: None, + } + } +} +#[doc = "Resource for a regional service location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataTransferRegionalServiceResource { + #[serde(flatten)] + pub regional_service_resource: RegionalServiceResource, +} +impl DataTransferRegionalServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the service response property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataTransferServiceResource { + #[doc = "Properties for DataTransferServiceResource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DataTransferServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for DataTransferServiceResource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataTransferServiceResourceProperties { + #[serde(flatten)] + pub service_resource_properties: ServiceResourceProperties, + #[doc = "An array that contains all of the locations for the service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, +} +impl DataTransferServiceResourceProperties { + pub fn new(service_resource_properties: ServiceResourceProperties) -> Self { + Self { + service_resource_properties, + locations: Vec::new(), + } + } +} +#[doc = "Connection string for the Cosmos DB account"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountConnectionString { + #[doc = "Value of the connection string"] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Description of the connection string"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl DatabaseAccountConnectionString { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB database accounts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Indicates the type of database account. This can only be set at database account creation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties to create and update Azure Cosmos DB database accounts."] + pub properties: DatabaseAccountCreateUpdateProperties, +} +impl DatabaseAccountCreateUpdateParameters { + pub fn new(properties: DatabaseAccountCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + kind: None, + identity: None, + properties, + } + } +} +pub mod database_account_create_update_parameters { + use super::*; + #[doc = "Indicates the type of database account. This can only be set at database account creation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "GlobalDocumentDB")] + GlobalDocumentDb, + #[serde(rename = "MongoDB")] + MongoDb, + Parse, + } + impl Default for Kind { + fn default() -> Self { + Self::GlobalDocumentDb + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB database accounts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountCreateUpdateProperties { + #[doc = "The consistency policy for the Cosmos DB database account."] + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + #[doc = "An array that contains the georeplication locations enabled for the Cosmos DB account."] + pub locations: Vec, + #[doc = "The offer type for the Cosmos DB database account."] + #[serde(rename = "databaseAccountOfferType")] + pub database_account_offer_type: DatabaseAccountOfferType, + #[doc = "Array of IpAddressOrRange objects."] + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[doc = "Flag to indicate whether to enable/disable Virtual Network ACL rules."] + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[doc = "Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account."] + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[doc = "List of Cosmos DB capabilities for the account"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[doc = "List of Virtual Network ACL rules configured for the Cosmos DB account."] + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[doc = "Enables the account to write in multiple locations"] + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[doc = "Enables the cassandra connector on the Cosmos DB C* account"] + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[doc = "The cassandra connector offer type for the Cosmos DB C* database account."] + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[doc = "Disable write operations on metadata resources (databases, containers, throughput) via account keys"] + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[doc = "The URI of the key vault"] + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[doc = "The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", \"SystemAssignedIdentity\" and more."] + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[doc = "Whether requests from Public Network are allowed"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Flag to indicate whether Free Tier is enabled."] + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[doc = "Flag to indicate whether to enable storage analytics."] + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[doc = "Analytical storage specific properties."] + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[doc = "Enum to indicate the mode of account creation."] + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[doc = "The object representing the policy for taking backups on an account."] + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[doc = "The CORS policy for the Cosmos DB database account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[doc = "Indicates what services are allowed to bypass firewall checks."] + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[doc = "An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account."] + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, + #[doc = "Indicates what diagnostic log settings are to be enabled."] + #[serde(rename = "diagnosticLogSettings", default, skip_serializing_if = "Option::is_none")] + pub diagnostic_log_settings: Option, + #[doc = "Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication."] + #[serde(rename = "disableLocalAuth", default, skip_serializing_if = "Option::is_none")] + pub disable_local_auth: Option, + #[doc = "Parameters to indicate the information about the restore."] + #[serde(rename = "restoreParameters", default, skip_serializing_if = "Option::is_none")] + pub restore_parameters: Option, + #[doc = "The object that represents all properties related to capacity enforcement on an account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "Flag to indicate whether to enable MaterializedViews on the Cosmos DB account"] + #[serde(rename = "enableMaterializedViews", default, skip_serializing_if = "Option::is_none")] + pub enable_materialized_views: Option, +} +impl DatabaseAccountCreateUpdateProperties { + pub fn new(locations: Vec, database_account_offer_type: DatabaseAccountOfferType) -> Self { + Self { + consistency_policy: None, + locations, + database_account_offer_type, + ip_rules: None, + is_virtual_network_filter_enabled: None, + enable_automatic_failover: None, + capabilities: Vec::new(), + virtual_network_rules: Vec::new(), + enable_multiple_write_locations: None, + enable_cassandra_connector: None, + connector_offer: None, + disable_key_based_metadata_write_access: None, + key_vault_key_uri: None, + default_identity: None, + public_network_access: None, + enable_free_tier: None, + api_properties: None, + enable_analytical_storage: None, + analytical_storage_configuration: None, + create_mode: None, + backup_policy: None, + cors: Vec::new(), + network_acl_bypass: None, + network_acl_bypass_resource_ids: Vec::new(), + diagnostic_log_settings: None, + disable_local_auth: None, + restore_parameters: None, + capacity: None, + enable_materialized_views: None, + } + } +} +#[doc = "Properties for the database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountGetProperties { + #[doc = "The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The connection endpoint for the Cosmos DB database account."] + #[serde(rename = "documentEndpoint", default, skip_serializing_if = "Option::is_none")] + pub document_endpoint: Option, + #[doc = "The offer type for the Cosmos DB database account."] + #[serde(rename = "databaseAccountOfferType", default, skip_serializing_if = "Option::is_none")] + pub database_account_offer_type: Option, + #[doc = "Array of IpAddressOrRange objects."] + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[doc = "Flag to indicate whether to enable/disable Virtual Network ACL rules."] + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[doc = "Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account."] + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[doc = "The consistency policy for the Cosmos DB database account."] + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + #[doc = "List of Cosmos DB capabilities for the account"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[doc = "An array that contains the write location for the Cosmos DB account."] + #[serde(rename = "writeLocations", default, skip_serializing_if = "Vec::is_empty")] + pub write_locations: Vec, + #[doc = "An array that contains of the read locations enabled for the Cosmos DB account."] + #[serde(rename = "readLocations", default, skip_serializing_if = "Vec::is_empty")] + pub read_locations: Vec, + #[doc = "An array that contains all of the locations enabled for the Cosmos DB account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "An array that contains the regions ordered by their failover priorities."] + #[serde(rename = "failoverPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub failover_policies: Vec, + #[doc = "List of Virtual Network ACL rules configured for the Cosmos DB account."] + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[doc = "List of Private Endpoint Connections configured for the Cosmos DB account."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Enables the account to write in multiple locations"] + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[doc = "Enables the cassandra connector on the Cosmos DB C* account"] + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[doc = "The cassandra connector offer type for the Cosmos DB C* database account."] + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[doc = "Disable write operations on metadata resources (databases, containers, throughput) via account keys"] + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[doc = "The URI of the key vault"] + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[doc = "The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", \"SystemAssignedIdentity\" and more."] + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[doc = "Whether requests from Public Network are allowed"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Flag to indicate whether Free Tier is enabled."] + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[doc = "Flag to indicate whether to enable storage analytics."] + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[doc = "Analytical storage specific properties."] + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[doc = "A unique identifier assigned to the database account"] + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[doc = "Enum to indicate the mode of account creation."] + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[doc = "Parameters to indicate the information about the restore."] + #[serde(rename = "restoreParameters", default, skip_serializing_if = "Option::is_none")] + pub restore_parameters: Option, + #[doc = "The object representing the policy for taking backups on an account."] + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[doc = "The CORS policy for the Cosmos DB database account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[doc = "Indicates what services are allowed to bypass firewall checks."] + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[doc = "An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account."] + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, + #[doc = "Indicates what diagnostic log settings are to be enabled."] + #[serde(rename = "diagnosticLogSettings", default, skip_serializing_if = "Option::is_none")] + pub diagnostic_log_settings: Option, + #[doc = "Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication."] + #[serde(rename = "disableLocalAuth", default, skip_serializing_if = "Option::is_none")] + pub disable_local_auth: Option, + #[doc = "The object that represents all properties related to capacity enforcement on an account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "Flag to indicate whether to enable MaterializedViews on the Cosmos DB account"] + #[serde(rename = "enableMaterializedViews", default, skip_serializing_if = "Option::is_none")] + pub enable_materialized_views: Option, +} +impl DatabaseAccountGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Indicates the type of database account. This can only be set at database account creation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties for the database account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DatabaseAccountGetResults { + pub fn new() -> Self { + Self::default() + } +} +pub mod database_account_get_results { + use super::*; + #[doc = "Indicates the type of database account. This can only be set at database account creation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "GlobalDocumentDB")] + GlobalDocumentDb, + #[serde(rename = "MongoDB")] + MongoDb, + Parse, + } + impl Default for Kind { + fn default() -> Self { + Self::GlobalDocumentDb + } + } +} +#[doc = "The connection strings for the given database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountListConnectionStringsResult { + #[doc = "An array that contains the connection strings for the Cosmos DB account."] + #[serde(rename = "connectionStrings", default, skip_serializing_if = "Vec::is_empty")] + pub connection_strings: Vec, +} +impl DatabaseAccountListConnectionStringsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The access keys for the given database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountListKeysResult { + #[serde(flatten)] + pub database_account_list_read_only_keys_result: DatabaseAccountListReadOnlyKeysResult, + #[doc = "Base 64 encoded value of the primary read-write key."] + #[serde(rename = "primaryMasterKey", default, skip_serializing_if = "Option::is_none")] + pub primary_master_key: Option, + #[doc = "Base 64 encoded value of the secondary read-write key."] + #[serde(rename = "secondaryMasterKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_master_key: Option, +} +impl DatabaseAccountListKeysResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The read-only access keys for the given database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountListReadOnlyKeysResult { + #[doc = "Base 64 encoded value of the primary read-only key."] + #[serde(rename = "primaryReadonlyMasterKey", default, skip_serializing_if = "Option::is_none")] + pub primary_readonly_master_key: Option, + #[doc = "Base 64 encoded value of the secondary read-only key."] + #[serde(rename = "secondaryReadonlyMasterKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_readonly_master_key: Option, +} +impl DatabaseAccountListReadOnlyKeysResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The offer type for the Cosmos DB database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DatabaseAccountOfferType { + Standard, +} +#[doc = "Parameters to regenerate the keys within the database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountRegenerateKeyParameters { + #[doc = "The access key to regenerate."] + #[serde(rename = "keyKind")] + pub key_kind: database_account_regenerate_key_parameters::KeyKind, +} +impl DatabaseAccountRegenerateKeyParameters { + pub fn new(key_kind: database_account_regenerate_key_parameters::KeyKind) -> Self { + Self { key_kind } + } +} +pub mod database_account_regenerate_key_parameters { + use super::*; + #[doc = "The access key to regenerate."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyKind { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + #[serde(rename = "primaryReadonly")] + PrimaryReadonly, + #[serde(rename = "secondaryReadonly")] + SecondaryReadonly, + } +} +#[doc = "Parameters for patching Azure Cosmos DB database account properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountUpdateParameters { + #[doc = "Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with \"defaultExperience\": \"Cassandra\". Current \"defaultExperience\" values also include \"Table\", \"Graph\", \"DocumentDB\", and \"MongoDB\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The location of the resource group to which the resource belongs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties to update Azure Cosmos DB database accounts."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DatabaseAccountUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties to update Azure Cosmos DB database accounts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountUpdateProperties { + #[doc = "The consistency policy for the Cosmos DB database account."] + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + #[doc = "An array that contains the georeplication locations enabled for the Cosmos DB account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "Array of IpAddressOrRange objects."] + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[doc = "Flag to indicate whether to enable/disable Virtual Network ACL rules."] + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[doc = "Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account."] + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[doc = "List of Cosmos DB capabilities for the account"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[doc = "List of Virtual Network ACL rules configured for the Cosmos DB account."] + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[doc = "Enables the account to write in multiple locations"] + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[doc = "Enables the cassandra connector on the Cosmos DB C* account"] + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[doc = "The cassandra connector offer type for the Cosmos DB C* database account."] + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[doc = "Disable write operations on metadata resources (databases, containers, throughput) via account keys"] + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[doc = "The URI of the key vault"] + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[doc = "The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", \"SystemAssignedIdentity\" and more."] + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[doc = "Whether requests from Public Network are allowed"] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Flag to indicate whether Free Tier is enabled."] + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[doc = "Flag to indicate whether to enable storage analytics."] + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[doc = "Analytical storage specific properties."] + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[doc = "The object representing the policy for taking backups on an account."] + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[doc = "The CORS policy for the Cosmos DB database account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[doc = "Indicates what services are allowed to bypass firewall checks."] + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[doc = "An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account."] + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, + #[doc = "Indicates what diagnostic log settings are to be enabled."] + #[serde(rename = "diagnosticLogSettings", default, skip_serializing_if = "Option::is_none")] + pub diagnostic_log_settings: Option, + #[doc = "Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication."] + #[serde(rename = "disableLocalAuth", default, skip_serializing_if = "Option::is_none")] + pub disable_local_auth: Option, + #[doc = "The object that represents all properties related to capacity enforcement on an account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "Flag to indicate whether to enable MaterializedViews on the Cosmos DB account"] + #[serde(rename = "enableMaterializedViews", default, skip_serializing_if = "Option::is_none")] + pub enable_materialized_views: Option, +} +impl DatabaseAccountUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the database accounts and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseAccountsListResult { + #[doc = "List of database account and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl DatabaseAccountsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specific Databases to restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatabaseRestoreResource { + #[doc = "The name of the database available for restore."] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "The names of the collections available for restore."] + #[serde(rename = "collectionNames", default, skip_serializing_if = "Vec::is_empty")] + pub collection_names: Vec, +} +impl DatabaseRestoreResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Indicates what diagnostic log settings are to be enabled."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiagnosticLogSettings { + #[doc = "Describe the level of detail with which queries are to be logged."] + #[serde(rename = "enableFullTextQuery", default, skip_serializing_if = "Option::is_none")] + pub enable_full_text_query: Option, +} +impl DiagnosticLogSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod diagnostic_log_settings { + use super::*; + #[doc = "Describe the level of detail with which queries are to be logged."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnableFullTextQuery { + None, + True, + False, + } +} +#[doc = "Error Response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message indicating why the operation failed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExcludedPath { + #[doc = "The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl ExcludedPath { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedResourceProperties { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "A system generated property that denotes the last updated timestamp of the resource."] + #[serde(rename = "_ts", default, skip_serializing_if = "Option::is_none")] + pub ts: Option, + #[doc = "A system generated property representing the resource etag required for optimistic concurrency control."] + #[serde(rename = "_etag", default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExtendedResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of new failover policies for the failover priority change."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverPolicies { + #[doc = "List of failover policies."] + #[serde(rename = "failoverPolicies")] + pub failover_policies: Vec, +} +impl FailoverPolicies { + pub fn new(failover_policies: Vec) -> Self { + Self { failover_policies } + } +} +#[doc = "The failover policy for a given region of a database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FailoverPolicy { + #[doc = "The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the region in which the database account exists."] + #[serde(rename = "locationName", default, skip_serializing_if = "Option::is_none")] + pub location_name: Option, + #[doc = "The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists."] + #[serde(rename = "failoverPriority", default, skip_serializing_if = "Option::is_none")] + pub failover_priority: Option, +} +impl FailoverPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource for a regional service location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GraphApiComputeRegionalServiceResource { + #[serde(flatten)] + pub regional_service_resource: RegionalServiceResource, + #[doc = "The regional endpoint for GraphAPICompute."] + #[serde(rename = "graphApiComputeEndpoint", default, skip_serializing_if = "Option::is_none")] + pub graph_api_compute_endpoint: Option, +} +impl GraphApiComputeRegionalServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the service response property for GraphAPICompute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GraphApiComputeServiceResource { + #[doc = "Properties for GraphAPIComputeServiceResource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GraphApiComputeServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for GraphAPIComputeServiceResource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GraphApiComputeServiceResourceProperties { + #[serde(flatten)] + pub service_resource_properties: ServiceResourceProperties, + #[doc = "GraphAPICompute endpoint for the service."] + #[serde(rename = "graphApiComputeEndpoint", default, skip_serializing_if = "Option::is_none")] + pub graph_api_compute_endpoint: Option, + #[doc = "An array that contains all of the locations for the service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, +} +impl GraphApiComputeServiceResourceProperties { + pub fn new(service_resource_properties: ServiceResourceProperties) -> Self { + Self { + service_resource_properties, + graph_api_compute_endpoint: None, + locations: Vec::new(), + } + } +} +pub type GraphName = String; +#[doc = "Cosmos DB Graph resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GraphResource { + #[doc = "Name of the Cosmos DB Graph"] + pub id: String, +} +impl GraphResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Parameters to create and update Cosmos DB Graph resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GraphResourceCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Graph resource."] + pub properties: GraphResourceCreateUpdateProperties, +} +impl GraphResourceCreateUpdateParameters { + pub fn new(properties: GraphResourceCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Graph resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GraphResourceCreateUpdateProperties { + #[doc = "Cosmos DB Graph resource object"] + pub resource: GraphResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GraphResourceCreateUpdateProperties { + pub fn new(resource: GraphResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB SQL database"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GraphResourceGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GraphResourceGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Graph resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GraphResourceGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB SQL database"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GraphResourceGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Graph resource and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GraphResourcesListResult { + #[doc = "List of Graph resource and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl GraphResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB Gremlin database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Gremlin database."] + pub properties: GremlinDatabaseCreateUpdateProperties, +} +impl GremlinDatabaseCreateUpdateParameters { + pub fn new(properties: GremlinDatabaseCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Gremlin database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseCreateUpdateProperties { + #[doc = "Cosmos DB Gremlin database resource object"] + pub resource: GremlinDatabaseResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GremlinDatabaseCreateUpdateProperties { + pub fn new(resource: GremlinDatabaseResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB SQL database"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GremlinDatabaseGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Gremlin database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB SQL database"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GremlinDatabaseGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Gremlin databases and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinDatabaseListResult { + #[doc = "List of Gremlin databases and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl GremlinDatabaseListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Gremlin database resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseResource { + #[doc = "Name of the Cosmos DB Gremlin database"] + pub id: String, +} +impl GremlinDatabaseResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Specific Gremlin Databases to restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinDatabaseRestoreResource { + #[doc = "The name of the gremlin database available for restore."] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "The names of the graphs available for restore."] + #[serde(rename = "graphNames", default, skip_serializing_if = "Vec::is_empty")] + pub graph_names: Vec, +} +impl GremlinDatabaseRestoreResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB Gremlin graph."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Gremlin graph."] + pub properties: GremlinGraphCreateUpdateProperties, +} +impl GremlinGraphCreateUpdateParameters { + pub fn new(properties: GremlinGraphCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Gremlin graph."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphCreateUpdateProperties { + #[doc = "Cosmos DB Gremlin graph resource object"] + pub resource: GremlinGraphResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GremlinGraphCreateUpdateProperties { + pub fn new(resource: GremlinGraphResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB Gremlin graph"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinGraphGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl GremlinGraphGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Gremlin graph."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinGraphGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB Gremlin graph"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GremlinGraphGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the graphs and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GremlinGraphListResult { + #[doc = "List of graphs and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl GremlinGraphListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB Gremlin graph resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphResource { + #[doc = "Name of the Cosmos DB Gremlin graph"] + pub id: String, + #[doc = "Cosmos DB indexing policy"] + #[serde(rename = "indexingPolicy", default, skip_serializing_if = "Option::is_none")] + pub indexing_policy: Option, + #[doc = "The configuration of the partition key to be used for partitioning data into multiple partitions"] + #[serde(rename = "partitionKey", default, skip_serializing_if = "Option::is_none")] + pub partition_key: Option, + #[doc = "Default time to live"] + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[doc = "The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service."] + #[serde(rename = "uniqueKeyPolicy", default, skip_serializing_if = "Option::is_none")] + pub unique_key_policy: Option, + #[doc = "The conflict resolution policy for the container."] + #[serde(rename = "conflictResolutionPolicy", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_policy: Option, +} +impl GremlinGraphResource { + pub fn new(id: String) -> Self { + Self { + id, + indexing_policy: None, + partition_key: None, + default_ttl: None, + unique_key_policy: None, + conflict_resolution_policy: None, + } + } +} +pub type IpRules = Vec; +#[doc = "The paths that are included in indexing"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IncludedPath { + #[doc = "The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "List of indexes for this path"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub indexes: Vec, +} +impl IncludedPath { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The indexes for the path."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Indexes { + #[doc = "The datatype for which the indexing behavior is applied to."] + #[serde(rename = "dataType", default, skip_serializing_if = "Option::is_none")] + pub data_type: Option, + #[doc = "The precision of the index. -1 is maximum precision."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub precision: Option, + #[doc = "Indicates the type of index."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, +} +impl Indexes { + pub fn new() -> Self { + Self::default() + } +} +pub mod indexes { + use super::*; + #[doc = "The datatype for which the indexing behavior is applied to."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataType { + String, + Number, + Point, + Polygon, + LineString, + MultiPolygon, + } + impl Default for DataType { + fn default() -> Self { + Self::String + } + } + #[doc = "Indicates the type of index."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Hash, + Range, + Spatial, + } + impl Default for Kind { + fn default() -> Self { + Self::Hash + } + } +} +#[doc = "Cosmos DB indexing policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IndexingPolicy { + #[doc = "Indicates if the indexing policy is automatic"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub automatic: Option, + #[doc = "Indicates the indexing mode."] + #[serde(rename = "indexingMode", default, skip_serializing_if = "Option::is_none")] + pub indexing_mode: Option, + #[doc = "List of paths to include in the indexing"] + #[serde(rename = "includedPaths", default, skip_serializing_if = "Vec::is_empty")] + pub included_paths: Vec, + #[doc = "List of paths to exclude from indexing"] + #[serde(rename = "excludedPaths", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_paths: Vec, + #[doc = "List of composite path list"] + #[serde(rename = "compositeIndexes", default, skip_serializing_if = "Vec::is_empty")] + pub composite_indexes: Vec, + #[doc = "List of spatial specifics"] + #[serde(rename = "spatialIndexes", default, skip_serializing_if = "Vec::is_empty")] + pub spatial_indexes: Vec, +} +impl IndexingPolicy { + pub fn new() -> Self { + Self::default() + } +} +pub mod indexing_policy { + use super::*; + #[doc = "Indicates the indexing mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum IndexingMode { + #[serde(rename = "consistent")] + Consistent, + #[serde(rename = "lazy")] + Lazy, + #[serde(rename = "none")] + None, + } + impl Default for IndexingMode { + fn default() -> Self { + Self::Consistent + } + } +} +#[doc = "IpAddressOrRange object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpAddressOrRange { + #[doc = "A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”."] + #[serde(rename = "ipAddressOrRange", default, skip_serializing_if = "Option::is_none")] + pub ip_address_or_range: Option, +} +impl IpAddressOrRange { + pub fn new() -> Self { + Self::default() + } +} +pub type Key = String; +#[doc = "Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyWrapMetadata { + #[doc = "The name of associated KeyEncryptionKey (aka CustomerManagedKey)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "ProviderName of KeyStoreProvider."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Reference / link to the KeyEncryptionKey."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Algorithm used in wrapping and unwrapping of the data encryption key."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub algorithm: Option, +} +impl KeyWrapMetadata { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of restorable backups for a Cassandra cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListBackups { + #[doc = "Container for array of backups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ListBackups { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of managed Cassandra clusters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListClusters { + #[doc = "Container for the array of clusters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ListClusters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of managed Cassandra data centers and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListDataCenters { + #[doc = "Container for array of data centers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ListDataCenters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A region in which the Azure Cosmos DB database account is deployed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Location { + #[doc = "The unique identifier of the region within the database account. Example: <accountName>-<locationName>."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the region."] + #[serde(rename = "locationName", default, skip_serializing_if = "Option::is_none")] + pub location_name: Option, + #[doc = "The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/"] + #[serde(rename = "documentEndpoint", default, skip_serializing_if = "Option::is_none")] + pub document_endpoint: Option, + #[doc = "The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists."] + #[serde(rename = "failoverPriority", default, skip_serializing_if = "Option::is_none")] + pub failover_priority: Option, + #[doc = "Flag to indicate whether or not this region is an AvailabilityZone region"] + #[serde(rename = "isZoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub is_zone_redundant: Option, +} +impl Location { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB location get result"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocationGetResult { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Cosmos DB location metadata"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LocationGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains Cosmos DB locations and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocationListResult { + #[doc = "List of Cosmos DB locations and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl LocationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB location metadata"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocationProperties { + #[doc = "The current status of location in Azure."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Flag indicating whether the location supports availability zones or not."] + #[serde(rename = "supportsAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub supports_availability_zone: Option, + #[doc = "Flag indicating whether the location is residency sensitive."] + #[serde(rename = "isResidencyRestricted", default, skip_serializing_if = "Option::is_none")] + pub is_residency_restricted: Option, + #[doc = "The properties of available backup storage redundancies."] + #[serde(rename = "backupStorageRedundancies", default, skip_serializing_if = "Vec::is_empty")] + pub backup_storage_redundancies: Vec, +} +impl LocationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The core properties of ARM resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedCassandraArmResourceProperties { + #[doc = "The unique resource identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The location of the resource group to which the resource belongs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with \"defaultExperience\": \"Cassandra\". Current \"defaultExperience\" values also include \"Table\", \"Graph\", \"DocumentDB\", and \"MongoDB\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ManagedCassandraArmResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedCassandraManagedServiceIdentity { + #[doc = "The object id of the identity resource."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant id of the resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ManagedCassandraManagedServiceIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_cassandra_managed_service_identity { + use super::*; + #[doc = "The type of the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + } +} +#[doc = "The state of the node in Cassandra ring."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedCassandraNodeState { + Normal, + Leaving, + Joining, + Moving, + Stopped, +} +#[doc = "Indicates whether the node is functioning or not."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedCassandraNodeStatus { + Up, + Down, +} +#[doc = "The status of the resource at the time the operation was called."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedCassandraProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Failed, + Canceled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedCassandraReaperStatus { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub healthy: Option, + #[serde(rename = "repairRunIds", default, skip_serializing_if = "Option::is_none")] + pub repair_run_ids: Option, + #[serde(rename = "repairSchedules", default, skip_serializing_if = "Option::is_none")] + pub repair_schedules: Option, +} +impl ManagedCassandraReaperStatus { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedServiceIdentity { + #[doc = "The principal id of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant id of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ManagedServiceIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_service_identity { + use super::*; + #[doc = "The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[doc = "Resource for a regional service location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaterializedViewsBuilderRegionalServiceResource { + #[serde(flatten)] + pub regional_service_resource: RegionalServiceResource, +} +impl MaterializedViewsBuilderRegionalServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the service response property for MaterializedViewsBuilder."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MaterializedViewsBuilderServiceResource { + #[doc = "Properties for MaterializedViewsBuilderServiceResource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MaterializedViewsBuilderServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for MaterializedViewsBuilderServiceResource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MaterializedViewsBuilderServiceResourceProperties { + #[serde(flatten)] + pub service_resource_properties: ServiceResourceProperties, + #[doc = "An array that contains all of the locations for the service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, +} +impl MaterializedViewsBuilderServiceResourceProperties { + pub fn new(service_resource_properties: ServiceResourceProperties) -> Self { + Self { + service_resource_properties, + locations: Vec::new(), + } + } +} +#[doc = "The properties of an Azure Cosmos DB merge operations"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MergeParameters { + #[doc = "Specifies whether the operation is a real merge operation or a simulation."] + #[serde(rename = "isDryRun", default, skip_serializing_if = "Option::is_none")] + pub is_dry_run: Option, +} +impl MergeParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metric data"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Metric { + #[doc = "The start time for the metric (ISO-8601 format)."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time for the metric (ISO-8601 format)."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The time grain to be used to summarize the metric values."] + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[doc = "The unit of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "A metric name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The metric values for the specified time window and timestep."] + #[serde(rename = "metricValues", default, skip_serializing_if = "Vec::is_empty")] + pub metric_values: Vec, +} +impl Metric { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The availability of the metric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricAvailability { + #[doc = "The time grain to be used to summarize the metric values."] + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[doc = "The retention for the metric values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retention: Option, +} +impl MetricAvailability { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definition of a metric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricDefinition { + #[doc = "The list of metric availabilities for the account."] + #[serde(rename = "metricAvailabilities", default, skip_serializing_if = "Vec::is_empty")] + pub metric_availabilities: Vec, + #[doc = "The primary aggregation type of the metric."] + #[serde(rename = "primaryAggregationType", default, skip_serializing_if = "Option::is_none")] + pub primary_aggregation_type: Option, + #[doc = "The unit of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "The resource uri of the database."] + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, + #[doc = "A metric name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl MetricDefinition { + pub fn new() -> Self { + Self::default() + } +} +pub mod metric_definition { + use super::*; + #[doc = "The primary aggregation type of the metric."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrimaryAggregationType { + None, + Average, + Total, + Minimum, + Maximum, + Last, + } +} +#[doc = "The response to a list metric definitions request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricDefinitionsListResult { + #[doc = "The list of metric definitions for the account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MetricDefinitionsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response to a list metrics request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricListResult { + #[doc = "The list of metrics for the account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MetricListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A metric name."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricName { + #[doc = "The name of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "The friendly name of the metric."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +impl MetricName { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents metrics values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricValue { + #[doc = "The number of values for the metric."] + #[serde(rename = "_count", default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The average value of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub average: Option, + #[doc = "The max value of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, + #[doc = "The min value of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minimum: Option, + #[doc = "The metric timestamp (ISO-8601 format)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[doc = "The total value of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub total: Option, +} +impl MetricValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update Cosmos DB MongoDB collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB MongoDB collection."] + pub properties: MongoDbCollectionCreateUpdateProperties, +} +impl MongoDbCollectionCreateUpdateParameters { + pub fn new(properties: MongoDbCollectionCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB MongoDB collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionCreateUpdateProperties { + #[doc = "Cosmos DB MongoDB collection resource object"] + pub resource: MongoDbCollectionResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl MongoDbCollectionCreateUpdateProperties { + pub fn new(resource: MongoDbCollectionResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB MongoDB collection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbCollectionGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl MongoDbCollectionGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB MongoDB collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbCollectionGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB MongoDB collection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoDbCollectionGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the MongoDB collections and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbCollectionListResult { + #[doc = "List of MongoDB collections and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MongoDbCollectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB MongoDB collection resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionResource { + #[doc = "Name of the Cosmos DB MongoDB collection"] + pub id: String, + #[doc = "The shard key and partition kind pair, only support \"Hash\" partition kind"] + #[serde(rename = "shardKey", default, skip_serializing_if = "Option::is_none")] + pub shard_key: Option, + #[doc = "List of index keys"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub indexes: Vec, + #[doc = "Analytical TTL."] + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +impl MongoDbCollectionResource { + pub fn new(id: String) -> Self { + Self { + id, + shard_key: None, + indexes: Vec::new(), + analytical_storage_ttl: None, + } + } +} +#[doc = "Parameters to create and update Cosmos DB MongoDB database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB MongoDB database."] + pub properties: MongoDbDatabaseCreateUpdateProperties, +} +impl MongoDbDatabaseCreateUpdateParameters { + pub fn new(properties: MongoDbDatabaseCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB MongoDB database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseCreateUpdateProperties { + #[doc = "Cosmos DB MongoDB database resource object"] + pub resource: MongoDbDatabaseResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl MongoDbDatabaseCreateUpdateProperties { + pub fn new(resource: MongoDbDatabaseResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB MongoDB database"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl MongoDbDatabaseGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB MongoDB database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB MongoDB database"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoDbDatabaseGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the MongoDB databases and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbDatabaseListResult { + #[doc = "List of MongoDB databases and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MongoDbDatabaseListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB MongoDB database resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseResource { + #[doc = "Name of the Cosmos DB MongoDB database"] + pub id: String, +} +impl MongoDbDatabaseResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Cosmos DB MongoDB collection index key"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoIndex { + #[doc = "Cosmos DB MongoDB collection resource object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + #[doc = "Cosmos DB MongoDB collection index options"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl MongoIndex { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB MongoDB collection resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoIndexKeys { + #[doc = "List of keys for each MongoDB collection in the Azure Cosmos DB service"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub keys: Vec, +} +impl MongoIndexKeys { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB MongoDB collection index options"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoIndexOptions { + #[doc = "Expire after seconds"] + #[serde(rename = "expireAfterSeconds", default, skip_serializing_if = "Option::is_none")] + pub expire_after_seconds: Option, + #[doc = "Is unique or not"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unique: Option, +} +impl MongoIndexOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update an Azure Cosmos DB Mongo Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoRoleDefinitionCreateUpdateParameters { + #[doc = "Azure Cosmos DB Mongo Role Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoRoleDefinitionCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Mongo Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoRoleDefinitionGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Azure Cosmos DB Mongo Role Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoRoleDefinitionGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relevant Mongo Role Definitions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoRoleDefinitionListResult { + #[doc = "List of Mongo Role Definitions and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MongoRoleDefinitionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Cosmos DB Mongo Role Definition resource object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoRoleDefinitionResource { + #[doc = "A user-friendly name for the Role Definition. Must be unique for the database account."] + #[serde(rename = "roleName", default, skip_serializing_if = "Option::is_none")] + pub role_name: Option, + #[doc = "Indicates whether the Role Definition was built-in or user created."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The database name for which access is being granted for this Role Definition."] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub privileges: Vec, + #[doc = "The set of roles inherited by this Role Definition."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub roles: Vec, +} +impl MongoRoleDefinitionResource { + pub fn new() -> Self { + Self::default() + } +} +pub mod mongo_role_definition_resource { + use super::*; + #[doc = "Indicates whether the Role Definition was built-in or user created."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BuiltInRole, + CustomRole, + } +} +#[doc = "Parameters to create and update an Azure Cosmos DB Mongo User Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoUserDefinitionCreateUpdateParameters { + #[doc = "Azure Cosmos DB Mongo User Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoUserDefinitionCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB User Definition"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoUserDefinitionGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Azure Cosmos DB Mongo User Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MongoUserDefinitionGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relevant User Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoUserDefinitionListResult { + #[doc = "List of User Definition and their properties"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl MongoUserDefinitionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Cosmos DB Mongo User Definition resource object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoUserDefinitionResource { + #[doc = "The user name for User Definition."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The password for User Definition. Response does not contain user password."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The database name for which access is being granted for this User Definition."] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "A custom definition for the USer Definition."] + #[serde(rename = "customData", default, skip_serializing_if = "Option::is_none")] + pub custom_data: Option, + #[doc = "The set of roles inherited by the User Definition."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub roles: Vec, + #[doc = "The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mechanisms: Option, +} +impl MongoUserDefinitionResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Indicates what services are allowed to bypass firewall checks."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkAclBypass { + None, + AzureServices, +} +#[doc = "A notebook workspace resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookWorkspace { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Properties of a notebook workspace resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NotebookWorkspace { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The connection info for the given notebook workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookWorkspaceConnectionInfoResult { + #[doc = "Specifies auth token used for connecting to Notebook server (uses token-based auth)."] + #[serde(rename = "authToken", default, skip_serializing_if = "Option::is_none")] + pub auth_token: Option, + #[doc = "Specifies the endpoint of Notebook server."] + #[serde(rename = "notebookServerEndpoint", default, skip_serializing_if = "Option::is_none")] + pub notebook_server_endpoint: Option, +} +impl NotebookWorkspaceConnectionInfoResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create a notebook workspace resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookWorkspaceCreateUpdateParameters { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, +} +impl NotebookWorkspaceCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of notebook workspace resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookWorkspaceListResult { + #[doc = "Array of notebook workspace resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl NotebookWorkspaceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a notebook workspace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookWorkspaceProperties { + #[doc = "Specifies the endpoint of Notebook server."] + #[serde(rename = "notebookServerEndpoint", default, skip_serializing_if = "Option::is_none")] + pub notebook_server_endpoint: Option, + #[doc = "Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl NotebookWorkspaceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "REST API operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation name: {provider}/{resource}/{operation}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The object that represents the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "The object that represents the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Service provider: Microsoft.ResourceProvider"] + #[serde(rename = "Provider", default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource on which the operation is performed: Profile, endpoint, etc."] + #[serde(rename = "Resource", default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operation type: Read, write, delete, etc."] + #[serde(rename = "Operation", default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of operation"] + #[serde(rename = "Description", default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the Resource Provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enum to indicate the operation type of the event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperationType { + Create, + Replace, + Delete, + SystemOperation, +} +#[doc = "Cosmos DB options resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OptionsResource { + #[doc = "Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, +} +impl OptionsResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The metric values for a single partition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PartitionMetric { + #[serde(flatten)] + pub metric: Metric, + #[doc = "The partition id (GUID identifier) of the metric values."] + #[serde(rename = "partitionId", default, skip_serializing_if = "Option::is_none")] + pub partition_id: Option, + #[doc = "The partition key range id (integer identifier) of the metric values."] + #[serde(rename = "partitionKeyRangeId", default, skip_serializing_if = "Option::is_none")] + pub partition_key_range_id: Option, +} +impl PartitionMetric { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response to a list partition metrics request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PartitionMetricListResult { + #[doc = "The list of partition-level metrics for the account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PartitionMetricListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The partition level usage data for a usage request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PartitionUsage { + #[serde(flatten)] + pub usage: Usage, + #[doc = "The partition id (GUID identifier) of the usages."] + #[serde(rename = "partitionId", default, skip_serializing_if = "Option::is_none")] + pub partition_id: Option, + #[doc = "The partition key range id (integer identifier) of the usages."] + #[serde(rename = "partitionKeyRangeId", default, skip_serializing_if = "Option::is_none")] + pub partition_key_range_id: Option, +} +impl PartitionUsage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response to a list partition level usage request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PartitionUsagesResult { + #[doc = "The list of partition-level usages for the database. A usage is a point in time metric"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PartitionUsagesResult { + pub fn new() -> Self { + Self::default() + } +} +pub type Path = String; +#[doc = "Percentile Metric data"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PercentileMetric { + #[doc = "The start time for the metric (ISO-8601 format)."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time for the metric (ISO-8601 format)."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The time grain to be used to summarize the metric values."] + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[doc = "The unit of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "A metric name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The percentile metric values for the specified time window and timestep."] + #[serde(rename = "metricValues", default, skip_serializing_if = "Vec::is_empty")] + pub metric_values: Vec, +} +impl PercentileMetric { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response to a list percentile metrics request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PercentileMetricListResult { + #[doc = "The list of percentile metrics for the account."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PercentileMetricListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents percentile metrics values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PercentileMetricValue { + #[serde(flatten)] + pub metric_value: MetricValue, + #[doc = "The 10th percentile value for the metric."] + #[serde(rename = "P10", default, skip_serializing_if = "Option::is_none")] + pub p10: Option, + #[doc = "The 25th percentile value for the metric."] + #[serde(rename = "P25", default, skip_serializing_if = "Option::is_none")] + pub p25: Option, + #[doc = "The 50th percentile value for the metric."] + #[serde(rename = "P50", default, skip_serializing_if = "Option::is_none")] + pub p50: Option, + #[doc = "The 75th percentile value for the metric."] + #[serde(rename = "P75", default, skip_serializing_if = "Option::is_none")] + pub p75: Option, + #[doc = "The 90th percentile value for the metric."] + #[serde(rename = "P90", default, skip_serializing_if = "Option::is_none")] + pub p90: Option, + #[doc = "The 95th percentile value for the metric."] + #[serde(rename = "P95", default, skip_serializing_if = "Option::is_none")] + pub p95: Option, + #[doc = "The 99th percentile value for the metric."] + #[serde(rename = "P99", default, skip_serializing_if = "Option::is_none")] + pub p99: Option, +} +impl PercentileMetricValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The object representing periodic mode backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicModeBackupPolicy { + #[serde(flatten)] + pub backup_policy: BackupPolicy, + #[doc = "Configuration values for periodic mode backup"] + #[serde(rename = "periodicModeProperties", default, skip_serializing_if = "Option::is_none")] + pub periodic_mode_properties: Option, +} +impl PeriodicModeBackupPolicy { + pub fn new(backup_policy: BackupPolicy) -> Self { + Self { + backup_policy, + periodic_mode_properties: None, + } + } +} +#[doc = "Configuration values for periodic mode backup"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeriodicModeProperties { + #[doc = "An integer representing the interval in minutes between two backups"] + #[serde(rename = "backupIntervalInMinutes", default, skip_serializing_if = "Option::is_none")] + pub backup_interval_in_minutes: Option, + #[doc = "An integer representing the time (in hours) that each backup is retained"] + #[serde(rename = "backupRetentionIntervalInHours", default, skip_serializing_if = "Option::is_none")] + pub backup_retention_interval_in_hours: Option, + #[doc = "Enum to indicate type of backup storage redundancy."] + #[serde(rename = "backupStorageRedundancy", default, skip_serializing_if = "Option::is_none")] + pub backup_storage_redundancy: Option, +} +impl PeriodicModeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The set of data plane operations permitted through this Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Permission { + #[doc = "An array of data actions that are allowed."] + #[serde(rename = "dataActions", default, skip_serializing_if = "Vec::is_empty")] + pub data_actions: Vec, + #[doc = "An array of data actions that are denied."] + #[serde(rename = "notDataActions", default, skip_serializing_if = "Vec::is_empty")] + pub not_data_actions: Vec, +} +impl Permission { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PhysicalPartitionId object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhysicalPartitionId { + #[doc = "Id of a physical partition"] + pub id: String, +} +impl PhysicalPartitionId { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "List of physical partitions and their properties returned by a merge operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PhysicalPartitionStorageInfoCollection { + #[doc = "List of physical partitions and their properties."] + #[serde(rename = "physicalPartitionStorageInfoCollection", default, skip_serializing_if = "Vec::is_empty")] + pub physical_partition_storage_info_collection: Vec, +} +impl PhysicalPartitionStorageInfoCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PhysicalPartitionThroughputInfo object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhysicalPartitionThroughputInfoResource { + #[doc = "Id of a physical partition"] + pub id: String, + #[doc = "Throughput of a physical partition"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, +} +impl PhysicalPartitionThroughputInfoResource { + pub fn new(id: String) -> Self { + Self { id, throughput: None } + } +} +#[doc = "A private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private endpoint connections"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "Array of private endpoint connections"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "Private endpoint which the connection belongs to."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "Connection State of the Private Endpoint Connection."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "Group id of the private endpoint."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "Provisioning state of the private endpoint."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private endpoint which the connection belongs to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointProperty { + #[doc = "Resource id of the private endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpointProperty { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Properties of a private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceListResult { + #[doc = "Array of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateLinkResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "The private link resource group id."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private link resource required member names."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource required zone names."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Connection State of the Private Endpoint Connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionStateProperty { + #[doc = "The private link service connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The private link service connection description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Any action that is required beyond basic workflow (approve/ reject/ disconnect)"] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionStateProperty { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The set of data plane operations permitted through this Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Privilege { + #[doc = "An Azure Cosmos DB Mongo DB Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "An array of actions that are allowed."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} +impl Privilege { + pub fn new() -> Self { + Self::default() + } +} +pub mod privilege { + use super::*; + #[doc = "An Azure Cosmos DB Mongo DB Resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "The database name the role is applied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub db: Option, + #[doc = "The collection name the role is applied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collection: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +pub type ProvisioningState = String; +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Whether requests from Public Network are allowed"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PublicNetworkAccess { + Enabled, + Disabled, +} +#[doc = "Cosmos DB redistribute throughput parameters object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedistributeThroughputParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to redistribute throughput for Azure Cosmos DB resource."] + pub properties: RedistributeThroughputProperties, +} +impl RedistributeThroughputParameters { + pub fn new(properties: RedistributeThroughputProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to redistribute throughput for Azure Cosmos DB resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedistributeThroughputProperties { + #[doc = "Resource to redistribute throughput for Azure Cosmos DB resource"] + pub resource: RedistributeThroughputPropertiesResource, +} +impl RedistributeThroughputProperties { + pub fn new(resource: RedistributeThroughputPropertiesResource) -> Self { + Self { resource } + } +} +#[doc = "Resource to redistribute throughput for Azure Cosmos DB resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedistributeThroughputPropertiesResource { + #[doc = "ThroughputPolicy to apply for throughput redistribution"] + #[serde(rename = "throughputPolicy")] + pub throughput_policy: redistribute_throughput_properties_resource::ThroughputPolicy, + #[doc = "Array of PhysicalPartitionThroughputInfoResource objects."] + #[serde(rename = "targetPhysicalPartitionThroughputInfo")] + pub target_physical_partition_throughput_info: Vec, + #[doc = "Array of PhysicalPartitionThroughputInfoResource objects."] + #[serde(rename = "sourcePhysicalPartitionThroughputInfo")] + pub source_physical_partition_throughput_info: Vec, +} +impl RedistributeThroughputPropertiesResource { + pub fn new( + throughput_policy: redistribute_throughput_properties_resource::ThroughputPolicy, + target_physical_partition_throughput_info: Vec, + source_physical_partition_throughput_info: Vec, + ) -> Self { + Self { + throughput_policy, + target_physical_partition_throughput_info, + source_physical_partition_throughput_info, + } + } +} +pub mod redistribute_throughput_properties_resource { + use super::*; + #[doc = "ThroughputPolicy to apply for throughput redistribution"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ThroughputPolicy { + #[serde(rename = "none")] + None, + #[serde(rename = "equal")] + Equal, + #[serde(rename = "custom")] + Custom, + } +} +#[doc = "Cosmos DB region to online or offline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegionForOnlineOffline { + #[doc = "Cosmos DB region, with spaces between words and each word capitalized."] + pub region: String, +} +impl RegionForOnlineOffline { + pub fn new(region: String) -> Self { + Self { region } + } +} +#[doc = "Resource for a regional service location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegionalServiceResource { + #[doc = "The regional service name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The location name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Describes the status of a service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl RegionalServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A Azure Cosmos DB restorable database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableDatabaseAccountGetResult { + #[doc = "The properties of a restorable database account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The location of the resource group to which the resource belongs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl RestorableDatabaseAccountGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a restorable database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableDatabaseAccountProperties { + #[doc = "The name of the global database account"] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "The creation time of the restorable database account (ISO-8601 format)."] + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[doc = "The least recent time at which the database account can be restored to (ISO-8601 format)."] + #[serde(rename = "oldestRestorableTime", default, skip_serializing_if = "Option::is_none")] + pub oldest_restorable_time: Option, + #[doc = "The time at which the restorable database account has been deleted (ISO-8601 format)."] + #[serde(rename = "deletionTime", default, skip_serializing_if = "Option::is_none")] + pub deletion_time: Option, + #[doc = "Enum to indicate the API type of the restorable database account."] + #[serde(rename = "apiType", default, skip_serializing_if = "Option::is_none")] + pub api_type: Option, + #[doc = "List of regions where the of the database account can be restored from."] + #[serde(rename = "restorableLocations", default, skip_serializing_if = "Vec::is_empty")] + pub restorable_locations: Vec, +} +impl RestorableDatabaseAccountProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the restorable database accounts and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableDatabaseAccountsListResult { + #[doc = "List of restorable database accounts and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableDatabaseAccountsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Gremlin database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinDatabaseGetResult { + #[doc = "The properties of an Azure Cosmos DB Gremlin database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableGremlinDatabaseGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB Gremlin database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinDatabaseProperties { + #[doc = "The resource of an Azure Cosmos DB Gremlin database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableGremlinDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_gremlin_database_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB Gremlin database event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this database event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this Gremlin database."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this Gremlin database."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The List operation response, that contains the Gremlin database events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinDatabasesListResult { + #[doc = "List of Gremlin database events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableGremlinDatabasesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Gremlin graph event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinGraphGetResult { + #[doc = "The properties of an Azure Cosmos DB Gremlin graph event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableGremlinGraphGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB Gremlin graph event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinGraphProperties { + #[doc = "The resource of an Azure Cosmos DB Gremlin graph event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableGremlinGraphProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_gremlin_graph_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB Gremlin graph event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this graph event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this Gremlin graph."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this Gremlin graph."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The List operation response, that contains the Gremlin graph events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinGraphsListResult { + #[doc = "List of Gremlin graph events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableGremlinGraphsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the restorable Gremlin resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableGremlinResourcesListResult { + #[doc = "List of restorable Gremlin resources, including the gremlin database and graph names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableGremlinResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the regional restorable account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableLocationResource { + #[doc = "The location of the regional restorable account."] + #[serde(rename = "locationName", default, skip_serializing_if = "Option::is_none")] + pub location_name: Option, + #[doc = "The instance id of the regional restorable account."] + #[serde(rename = "regionalDatabaseAccountInstanceId", default, skip_serializing_if = "Option::is_none")] + pub regional_database_account_instance_id: Option, + #[doc = "The creation time of the regional restorable database account (ISO-8601 format)."] + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[doc = "The time at which the regional restorable database account has been deleted (ISO-8601 format)."] + #[serde(rename = "deletionTime", default, skip_serializing_if = "Option::is_none")] + pub deletion_time: Option, +} +impl RestorableLocationResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB MongoDB collection event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbCollectionGetResult { + #[doc = "The properties of an Azure Cosmos DB MongoDB collection event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableMongodbCollectionGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB MongoDB collection event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbCollectionProperties { + #[doc = "The resource of an Azure Cosmos DB MongoDB collection event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableMongodbCollectionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_mongodb_collection_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB MongoDB collection event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this collection event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this MongoDB collection."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this MongoDB collection."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The List operation response, that contains the MongoDB collection events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbCollectionsListResult { + #[doc = "List of MongoDB collection events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableMongodbCollectionsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB MongoDB database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbDatabaseGetResult { + #[doc = "The properties of an Azure Cosmos DB MongoDB database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableMongodbDatabaseGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB MongoDB database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbDatabaseProperties { + #[doc = "The resource of an Azure Cosmos DB MongoDB database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableMongodbDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_mongodb_database_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB MongoDB database event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this database event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this MongoDB database."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this MongoDB database."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The List operation response, that contains the MongoDB database events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbDatabasesListResult { + #[doc = "List of MongoDB database events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableMongodbDatabasesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the restorable MongoDB resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableMongodbResourcesListResult { + #[doc = "List of restorable MongoDB resources, including the database and collection names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableMongodbResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB SQL container event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlContainerGetResult { + #[doc = "The properties of an Azure Cosmos DB SQL container event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableSqlContainerGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB SQL container event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlContainerProperties { + #[doc = "The resource of an Azure Cosmos DB SQL container event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableSqlContainerProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_sql_container_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB SQL container event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The when this container event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this SQL container."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this SQL container."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + #[doc = "Cosmos DB SQL container resource object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub container: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } + pub mod resource { + use super::*; + #[doc = "Cosmos DB SQL container resource object"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Container { + #[serde(flatten)] + pub sql_container_resource: SqlContainerResource, + #[serde(flatten)] + pub extended_resource_properties: ExtendedResourceProperties, + #[doc = "A system generated property that specifies the addressable path of the container resource."] + #[serde(rename = "_self", default, skip_serializing_if = "Option::is_none")] + pub self_: Option, + } + impl Container { + pub fn new(sql_container_resource: SqlContainerResource) -> Self { + Self { + sql_container_resource, + extended_resource_properties: ExtendedResourceProperties::default(), + self_: None, + } + } + } + } +} +#[doc = "The List operation response, that contains the SQL container events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlContainersListResult { + #[doc = "List of SQL container events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableSqlContainersListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB SQL database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlDatabaseGetResult { + #[doc = "The properties of an Azure Cosmos DB SQL database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableSqlDatabaseGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB SQL database event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlDatabaseProperties { + #[doc = "The resource of an Azure Cosmos DB SQL database event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableSqlDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_sql_database_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB SQL database event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this database event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of the SQL database."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of the SQL database."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + #[doc = "Cosmos DB SQL database resource object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } + pub mod resource { + use super::*; + #[doc = "Cosmos DB SQL database resource object"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Database { + #[serde(flatten)] + pub sql_database_resource: SqlDatabaseResource, + #[serde(flatten)] + pub extended_resource_properties: ExtendedResourceProperties, + #[doc = "A system generated property that specified the addressable path of the collections resource."] + #[serde(rename = "_colls", default, skip_serializing_if = "Option::is_none")] + pub colls: Option, + #[doc = "A system generated property that specifies the addressable path of the users resource."] + #[serde(rename = "_users", default, skip_serializing_if = "Option::is_none")] + pub users: Option, + #[doc = "A system generated property that specifies the addressable path of the database resource."] + #[serde(rename = "_self", default, skip_serializing_if = "Option::is_none")] + pub self_: Option, + } + impl Database { + pub fn new(sql_database_resource: SqlDatabaseResource) -> Self { + Self { + sql_database_resource, + extended_resource_properties: ExtendedResourceProperties::default(), + colls: None, + users: None, + self_: None, + } + } + } + } +} +#[doc = "The List operation response, that contains the SQL database events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlDatabasesListResult { + #[doc = "List of SQL database events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableSqlDatabasesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the restorable SQL resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableSqlResourcesListResult { + #[doc = "List of restorable SQL resources, including the database and collection names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableSqlResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Table event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableTableGetResult { + #[doc = "The properties of an Azure Cosmos DB Table event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The unique resource Identifier of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the ARM resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of Azure resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RestorableTableGetResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB Table event"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableTableProperties { + #[doc = "The resource of an Azure Cosmos DB Table event"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl RestorableTableProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod restorable_table_properties { + use super::*; + #[doc = "The resource of an Azure Cosmos DB Table event"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Resource { + #[doc = "A system generated property. A unique identifier."] + #[serde(rename = "_rid", default, skip_serializing_if = "Option::is_none")] + pub rid: Option, + #[doc = "Enum to indicate the operation type of the event."] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, + #[doc = "The time when this table event happened."] + #[serde(rename = "eventTimestamp", default, skip_serializing_if = "Option::is_none")] + pub event_timestamp: Option, + #[doc = "The name of this Table."] + #[serde(rename = "ownerId", default, skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[doc = "The resource ID of this Table."] + #[serde(rename = "ownerResourceId", default, skip_serializing_if = "Option::is_none")] + pub owner_resource_id: Option, + } + impl Resource { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "List of restorable table names."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableTableResourcesListResult { + #[doc = "List of restorable table names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableTableResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Table events and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestorableTablesListResult { + #[doc = "List of Table events and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RestorableTablesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to indicate the information about the restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestoreParameters { + #[doc = "Describes the mode of the restore."] + #[serde(rename = "restoreMode", default, skip_serializing_if = "Option::is_none")] + pub restore_mode: Option, + #[doc = "The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}"] + #[serde(rename = "restoreSource", default, skip_serializing_if = "Option::is_none")] + pub restore_source: Option, + #[doc = "Time to which the account has to be restored (ISO-8601 format)."] + #[serde(rename = "restoreTimestampInUtc", default, skip_serializing_if = "Option::is_none")] + pub restore_timestamp_in_utc: Option, + #[doc = "List of specific databases available for restore."] + #[serde(rename = "databasesToRestore", default, skip_serializing_if = "Vec::is_empty")] + pub databases_to_restore: Vec, + #[doc = "List of specific gremlin databases available for restore."] + #[serde(rename = "gremlinDatabasesToRestore", default, skip_serializing_if = "Vec::is_empty")] + pub gremlin_databases_to_restore: Vec, + #[doc = "List of specific tables available for restore."] + #[serde(rename = "tablesToRestore", default, skip_serializing_if = "Vec::is_empty")] + pub tables_to_restore: Vec, +} +impl RestoreParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod restore_parameters { + use super::*; + #[doc = "Describes the mode of the restore."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreMode { + PointInTime, + } +} +#[doc = "Cosmos DB retrieve throughput parameters object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetrieveThroughputParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to retrieve throughput for Azure Cosmos DB resource."] + pub properties: RetrieveThroughputProperties, +} +impl RetrieveThroughputParameters { + pub fn new(properties: RetrieveThroughputProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to retrieve throughput for Azure Cosmos DB resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetrieveThroughputProperties { + #[doc = "Resource to retrieve throughput information for Cosmos DB resource"] + pub resource: RetrieveThroughputPropertiesResource, +} +impl RetrieveThroughputProperties { + pub fn new(resource: RetrieveThroughputPropertiesResource) -> Self { + Self { resource } + } +} +#[doc = "Resource to retrieve throughput information for Cosmos DB resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetrieveThroughputPropertiesResource { + #[doc = "Array of PhysicalPartitionId objects."] + #[serde(rename = "physicalPartitionIds")] + pub physical_partition_ids: Vec, +} +impl RetrieveThroughputPropertiesResource { + pub fn new(physical_partition_ids: Vec) -> Self { + Self { physical_partition_ids } + } +} +#[doc = "The set of roles permitted through this Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Role { + #[doc = "The database name the role is applied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub db: Option, + #[doc = "The role name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub role: Option, +} +impl Role { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SeedNode { + #[doc = "IP address of this seed node."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} +impl SeedNode { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for the database account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceResource { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Services response resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for Create or Update Request for ServiceResource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceResourceCreateUpdateParameters { + #[doc = "Properties in ServiceResourceCreateUpdateParameters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ServiceResourceCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties in ServiceResourceCreateUpdateParameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceResourceCreateUpdateProperties { + #[doc = "Instance type for the service."] + #[serde(rename = "instanceSize", default, skip_serializing_if = "Option::is_none")] + pub instance_size: Option, + #[doc = "Instance count for the service."] + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, + #[doc = "ServiceType for the service."] + #[serde(rename = "serviceType", default, skip_serializing_if = "Option::is_none")] + pub service_type: Option, +} +impl ServiceResourceCreateUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Instance type for the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServiceResourceInstanceSize { + #[serde(rename = "Cosmos.D4s")] + CosmosD4s, + #[serde(rename = "Cosmos.D8s")] + CosmosD8s, + #[serde(rename = "Cosmos.D16s")] + CosmosD16s, +} +#[doc = "The List operation response, that contains the Service Resource and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceResourceListResult { + #[doc = "List of Service Resource and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ServiceResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Services response resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceResourceProperties { + #[doc = "Time of the last state change (ISO-8601 format)."] + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[doc = "Instance type for the service."] + #[serde(rename = "instanceSize", default, skip_serializing_if = "Option::is_none")] + pub instance_size: Option, + #[doc = "Instance count for the service."] + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, + #[doc = "ServiceType for the service."] + #[serde(rename = "serviceType")] + pub service_type: ServiceType, + #[doc = "Describes the status of a service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl ServiceResourceProperties { + pub fn new(service_type: ServiceType) -> Self { + Self { + creation_time: None, + instance_size: None, + instance_count: None, + service_type, + status: None, + } + } +} +#[doc = "Describes the status of a service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServiceResourceStatus { + Creating, + Running, + Updating, + Deleting, + Error, + Stopped, +} +#[doc = "ServiceType for the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServiceType { + SqlDedicatedGateway, + DataTransfer, + #[serde(rename = "GraphAPICompute")] + GraphApiCompute, + MaterializedViewsBuilder, +} +#[doc = "The shard key and partition kind pair, only support \"Hash\" partition kind"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ShardKeys {} +impl ShardKeys { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SpatialSpec { + #[doc = "The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "List of path's spatial type"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub types: Vec, +} +impl SpatialSpec { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Indicates the spatial type of index."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SpatialType { + Point, + LineString, + Polygon, + MultiPolygon, +} +#[doc = "Parameters to create and update Cosmos DB container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB container."] + pub properties: SqlContainerCreateUpdateProperties, +} +impl SqlContainerCreateUpdateParameters { + pub fn new(properties: SqlContainerCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerCreateUpdateProperties { + #[doc = "Cosmos DB SQL container resource object"] + pub resource: SqlContainerResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlContainerCreateUpdateProperties { + pub fn new(resource: SqlContainerResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB container"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlContainerGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlContainerGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlContainerGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB container"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlContainerGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the containers and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlContainerListResult { + #[doc = "List of containers and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlContainerListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB SQL container resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerResource { + #[doc = "Name of the Cosmos DB SQL container"] + pub id: String, + #[doc = "Cosmos DB indexing policy"] + #[serde(rename = "indexingPolicy", default, skip_serializing_if = "Option::is_none")] + pub indexing_policy: Option, + #[doc = "The configuration of the partition key to be used for partitioning data into multiple partitions"] + #[serde(rename = "partitionKey", default, skip_serializing_if = "Option::is_none")] + pub partition_key: Option, + #[doc = "Default time to live"] + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[doc = "The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service."] + #[serde(rename = "uniqueKeyPolicy", default, skip_serializing_if = "Option::is_none")] + pub unique_key_policy: Option, + #[doc = "The conflict resolution policy for the container."] + #[serde(rename = "conflictResolutionPolicy", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_policy: Option, + #[doc = "Cosmos DB client encryption policy."] + #[serde(rename = "clientEncryptionPolicy", default, skip_serializing_if = "Option::is_none")] + pub client_encryption_policy: Option, + #[doc = "Analytical TTL."] + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +impl SqlContainerResource { + pub fn new(id: String) -> Self { + Self { + id, + indexing_policy: None, + partition_key: None, + default_ttl: None, + unique_key_policy: None, + conflict_resolution_policy: None, + client_encryption_policy: None, + analytical_storage_ttl: None, + } + } +} +#[doc = "Parameters to create and update Cosmos DB SQL database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB SQL database."] + pub properties: SqlDatabaseCreateUpdateProperties, +} +impl SqlDatabaseCreateUpdateParameters { + pub fn new(properties: SqlDatabaseCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB SQL database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseCreateUpdateProperties { + #[doc = "Cosmos DB SQL database resource object"] + pub resource: SqlDatabaseResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlDatabaseCreateUpdateProperties { + pub fn new(resource: SqlDatabaseResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB SQL database"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlDatabaseGetProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_database_get_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Resource { + #[serde(flatten)] + pub sql_database_resource: SqlDatabaseResource, + #[serde(flatten)] + pub extended_resource_properties: ExtendedResourceProperties, + #[doc = "A system generated property that specified the addressable path of the collections resource."] + #[serde(rename = "_colls", default, skip_serializing_if = "Option::is_none")] + pub colls: Option, + #[doc = "A system generated property that specifies the addressable path of the users resource."] + #[serde(rename = "_users", default, skip_serializing_if = "Option::is_none")] + pub users: Option, + } + impl Resource { + pub fn new(sql_database_resource: SqlDatabaseResource) -> Self { + Self { + sql_database_resource, + extended_resource_properties: ExtendedResourceProperties::default(), + colls: None, + users: None, + } + } + } +} +#[doc = "An Azure Cosmos DB SQL database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB SQL database"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlDatabaseGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the SQL databases and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDatabaseListResult { + #[doc = "List of SQL databases and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlDatabaseListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB SQL database resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseResource { + #[doc = "Name of the Cosmos DB SQL database"] + pub id: String, +} +impl SqlDatabaseResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Resource for a regional service location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDedicatedGatewayRegionalServiceResource { + #[serde(flatten)] + pub regional_service_resource: RegionalServiceResource, + #[doc = "The regional endpoint for SqlDedicatedGateway."] + #[serde(rename = "sqlDedicatedGatewayEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_dedicated_gateway_endpoint: Option, +} +impl SqlDedicatedGatewayRegionalServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the service response property for SqlDedicatedGateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDedicatedGatewayServiceResource { + #[doc = "Properties for SqlDedicatedGatewayServiceResource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlDedicatedGatewayServiceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for SqlDedicatedGatewayServiceResource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDedicatedGatewayServiceResourceProperties { + #[serde(flatten)] + pub service_resource_properties: ServiceResourceProperties, + #[doc = "SqlDedicatedGateway endpoint for the service."] + #[serde(rename = "sqlDedicatedGatewayEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_dedicated_gateway_endpoint: Option, + #[doc = "An array that contains all of the locations for the service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, +} +impl SqlDedicatedGatewayServiceResourceProperties { + pub fn new(service_resource_properties: ServiceResourceProperties) -> Self { + Self { + service_resource_properties, + sql_dedicated_gateway_endpoint: None, + locations: Vec::new(), + } + } +} +#[doc = "Parameters to create and update an Azure Cosmos DB SQL Role Assignment."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleAssignmentCreateUpdateParameters { + #[doc = "Azure Cosmos DB SQL Role Assignment resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlRoleAssignmentCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Role Assignment"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleAssignmentGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Azure Cosmos DB SQL Role Assignment resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlRoleAssignmentGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relevant Role Assignments."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleAssignmentListResult { + #[doc = "List of Role Assignments and their properties"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlRoleAssignmentListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Cosmos DB SQL Role Assignment resource object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleAssignmentResource { + #[doc = "The unique identifier for the associated Role Definition."] + #[serde(rename = "roleDefinitionId", default, skip_serializing_if = "Option::is_none")] + pub role_definition_id: Option, + #[doc = "The data plane resource path for which access is being granted through this Role Assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, +} +impl SqlRoleAssignmentResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to create and update an Azure Cosmos DB SQL Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleDefinitionCreateUpdateParameters { + #[doc = "Azure Cosmos DB SQL Role Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlRoleDefinitionCreateUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB SQL Role Definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleDefinitionGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[doc = "Azure Cosmos DB SQL Role Definition resource object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlRoleDefinitionGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relevant Role Definitions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleDefinitionListResult { + #[doc = "List of Role Definitions and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlRoleDefinitionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Cosmos DB SQL Role Definition resource object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlRoleDefinitionResource { + #[doc = "A user-friendly name for the Role Definition. Must be unique for the database account."] + #[serde(rename = "roleName", default, skip_serializing_if = "Option::is_none")] + pub role_name: Option, + #[doc = "Indicates whether the Role Definition was built-in or user created."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist."] + #[serde(rename = "assignableScopes", default, skip_serializing_if = "Vec::is_empty")] + pub assignable_scopes: Vec, + #[doc = "The set of operations allowed through this Role Definition."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub permissions: Vec, +} +impl SqlRoleDefinitionResource { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_role_definition_resource { + use super::*; + #[doc = "Indicates whether the Role Definition was built-in or user created."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BuiltInRole, + CustomRole, + } +} +#[doc = "Parameters to create and update Cosmos DB storedProcedure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB storedProcedure."] + pub properties: SqlStoredProcedureCreateUpdateProperties, +} +impl SqlStoredProcedureCreateUpdateParameters { + pub fn new(properties: SqlStoredProcedureCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB storedProcedure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureCreateUpdateProperties { + #[doc = "Cosmos DB SQL storedProcedure resource object"] + pub resource: SqlStoredProcedureResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlStoredProcedureCreateUpdateProperties { + pub fn new(resource: SqlStoredProcedureResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB StoredProcedure"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlStoredProcedureGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl SqlStoredProcedureGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB storedProcedure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlStoredProcedureGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB StoredProcedure"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlStoredProcedureGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the storedProcedures and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlStoredProcedureListResult { + #[doc = "List of storedProcedures and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlStoredProcedureListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB SQL storedProcedure resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureResource { + #[doc = "Name of the Cosmos DB SQL storedProcedure"] + pub id: String, + #[doc = "Body of the Stored Procedure"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, +} +impl SqlStoredProcedureResource { + pub fn new(id: String) -> Self { + Self { id, body: None } + } +} +#[doc = "Parameters to create and update Cosmos DB trigger."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB trigger."] + pub properties: SqlTriggerCreateUpdateProperties, +} +impl SqlTriggerCreateUpdateParameters { + pub fn new(properties: SqlTriggerCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB trigger."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerCreateUpdateProperties { + #[doc = "Cosmos DB SQL trigger resource object"] + pub resource: SqlTriggerResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlTriggerCreateUpdateProperties { + pub fn new(resource: SqlTriggerResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB trigger"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlTriggerGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl SqlTriggerGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB trigger."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlTriggerGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB trigger"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlTriggerGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the triggers and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlTriggerListResult { + #[doc = "List of triggers and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlTriggerListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB SQL trigger resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerResource { + #[doc = "Name of the Cosmos DB SQL trigger"] + pub id: String, + #[doc = "Body of the Trigger"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[doc = "Type of the Trigger"] + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[doc = "The operation the trigger is associated with"] + #[serde(rename = "triggerOperation", default, skip_serializing_if = "Option::is_none")] + pub trigger_operation: Option, +} +impl SqlTriggerResource { + pub fn new(id: String) -> Self { + Self { + id, + body: None, + trigger_type: None, + trigger_operation: None, + } + } +} +pub mod sql_trigger_resource { + use super::*; + #[doc = "Type of the Trigger"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerType { + Pre, + Post, + } + #[doc = "The operation the trigger is associated with"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerOperation { + All, + Create, + Update, + Delete, + Replace, + } +} +#[doc = "Parameters to create and update Cosmos DB userDefinedFunction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB userDefinedFunction."] + pub properties: SqlUserDefinedFunctionCreateUpdateProperties, +} +impl SqlUserDefinedFunctionCreateUpdateParameters { + pub fn new(properties: SqlUserDefinedFunctionCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB userDefinedFunction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionCreateUpdateProperties { + #[doc = "Cosmos DB SQL userDefinedFunction resource object"] + pub resource: SqlUserDefinedFunctionResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl SqlUserDefinedFunctionCreateUpdateProperties { + pub fn new(resource: SqlUserDefinedFunctionResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos DB userDefinedFunction"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlUserDefinedFunctionGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl SqlUserDefinedFunctionGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB userDefinedFunction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlUserDefinedFunctionGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB userDefinedFunction"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlUserDefinedFunctionGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the userDefinedFunctions and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlUserDefinedFunctionListResult { + #[doc = "List of userDefinedFunctions and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlUserDefinedFunctionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB SQL userDefinedFunction resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionResource { + #[doc = "Name of the Cosmos DB SQL userDefinedFunction"] + pub id: String, + #[doc = "Body of the User Defined Function"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, +} +impl SqlUserDefinedFunctionResource { + pub fn new(id: String) -> Self { + Self { id, body: None } + } +} +#[doc = "Parameters to create and update Cosmos DB Table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to create and update Azure Cosmos DB Table."] + pub properties: TableCreateUpdateProperties, +} +impl TableCreateUpdateParameters { + pub fn new(properties: TableCreateUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to create and update Azure Cosmos DB Table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableCreateUpdateProperties { + #[doc = "Cosmos DB table resource object"] + pub resource: TableResource, + #[doc = "CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are \"If-Match\", \"If-None-Match\", \"Session-Token\" and \"Throughput\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl TableCreateUpdateProperties { + pub fn new(resource: TableResource) -> Self { + Self { resource, options: None } + } +} +#[doc = "The properties of an Azure Cosmos Table"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TableGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +impl TableGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB Table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TableGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos Table"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TableGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List operation response, that contains the Table and their properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TableListResult { + #[doc = "List of Table and their properties."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl TableListResult { + pub fn new() -> Self { + Self::default() + } +} +pub type TableName = String; +#[doc = "Cosmos DB table resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableResource { + #[doc = "Name of the Cosmos DB table"] + pub id: String, +} +impl TableResource { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with \"defaultExperience\": \"Cassandra\". Current \"defaultExperience\" values also include \"Table\", \"Graph\", \"DocumentDB\", and \"MongoDB\"."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Tags {} +impl Tags { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB resource throughput policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ThroughputPolicyResource { + #[doc = "Determines whether the ThroughputPolicy is active or not"] + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, + #[doc = "Represents the percentage by which throughput can increase every time throughput policy kicks in."] + #[serde(rename = "incrementPercent", default, skip_serializing_if = "Option::is_none")] + pub increment_percent: Option, +} +impl ThroughputPolicyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an Azure Cosmos DB resource throughput"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ThroughputSettingsGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl ThroughputSettingsGetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Cosmos DB resource throughput."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ThroughputSettingsGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "The properties of an Azure Cosmos DB resource throughput"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ThroughputSettingsGetResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ThroughputSettingsResource { + #[doc = "Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[doc = "Cosmos DB provisioned throughput settings object"] + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, + #[doc = "The minimum throughput of the resource"] + #[serde(rename = "minimumThroughput", default, skip_serializing_if = "Option::is_none")] + pub minimum_throughput: Option, + #[doc = "The throughput replace is pending"] + #[serde(rename = "offerReplacePending", default, skip_serializing_if = "Option::is_none")] + pub offer_replace_pending: Option, +} +impl ThroughputSettingsResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to update Cosmos DB resource throughput."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[doc = "Properties to update Azure Cosmos DB resource throughput."] + pub properties: ThroughputSettingsUpdateProperties, +} +impl ThroughputSettingsUpdateParameters { + pub fn new(properties: ThroughputSettingsUpdateProperties) -> Self { + Self { + arm_resource_properties: ArmResourceProperties::default(), + properties, + } + } +} +#[doc = "Properties to update Azure Cosmos DB resource throughput."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsUpdateProperties { + #[doc = "Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both."] + pub resource: ThroughputSettingsResource, +} +impl ThroughputSettingsUpdateProperties { + pub fn new(resource: ThroughputSettingsResource) -> Self { + Self { resource } + } +} +#[doc = "The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UniqueKey { + #[doc = "List of paths must be unique for each document in the Azure Cosmos DB service"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub paths: Vec, +} +impl UniqueKey { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UniqueKeyPolicy { + #[doc = "List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service."] + #[serde(rename = "uniqueKeys", default, skip_serializing_if = "Vec::is_empty")] + pub unique_keys: Vec, +} +impl UniqueKeyPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The unit of the metric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum UnitType { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + Milliseconds, +} +#[doc = "The usage data for a usage request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Usage { + #[doc = "The unit of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "A metric name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The quota period used to summarize the usage values."] + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[doc = "Maximum value for this metric"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "Current value for this metric"] + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, +} +impl Usage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response to a list usage request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UsagesResult { + #[doc = "The list of usages for the database. A usage is a point in time metric"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl UsagesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Network ACL Rule object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkRule { + #[doc = "Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Create firewall rule before the virtual network has vnet service endpoint enabled."] + #[serde(rename = "ignoreMissingVNetServiceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub ignore_missing_v_net_service_endpoint: Option, +} +impl VirtualNetworkRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The storage of a physical partition"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PhysicalPartitionStorageInfo { + #[doc = "The unique identifier of the partition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The storage in KB for the physical partition."] + #[serde(rename = "storageInKB", default, skip_serializing_if = "Option::is_none")] + pub storage_in_kb: Option, +} +impl PhysicalPartitionStorageInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/cosmosdb/src/package_preview_2022_02/operations.rs b/services/mgmt/cosmosdb/src/package_preview_2022_02/operations.rs new file mode 100644 index 0000000000..66a96c53b4 --- /dev/null +++ b/services/mgmt/cosmosdb/src/package_preview_2022_02/operations.rs @@ -0,0 +1,20706 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn cassandra_clusters(&self) -> cassandra_clusters::Client { + cassandra_clusters::Client(self.clone()) + } + pub fn cassandra_data_centers(&self) -> cassandra_data_centers::Client { + cassandra_data_centers::Client(self.clone()) + } + pub fn cassandra_resources(&self) -> cassandra_resources::Client { + cassandra_resources::Client(self.clone()) + } + pub fn collection(&self) -> collection::Client { + collection::Client(self.clone()) + } + pub fn collection_partition(&self) -> collection_partition::Client { + collection_partition::Client(self.clone()) + } + pub fn collection_partition_region(&self) -> collection_partition_region::Client { + collection_partition_region::Client(self.clone()) + } + pub fn collection_region(&self) -> collection_region::Client { + collection_region::Client(self.clone()) + } + pub fn data_transfer_jobs(&self) -> data_transfer_jobs::Client { + data_transfer_jobs::Client(self.clone()) + } + pub fn database(&self) -> database::Client { + database::Client(self.clone()) + } + pub fn database_account_region(&self) -> database_account_region::Client { + database_account_region::Client(self.clone()) + } + pub fn database_accounts(&self) -> database_accounts::Client { + database_accounts::Client(self.clone()) + } + pub fn graph_resources(&self) -> graph_resources::Client { + graph_resources::Client(self.clone()) + } + pub fn gremlin_resources(&self) -> gremlin_resources::Client { + gremlin_resources::Client(self.clone()) + } + pub fn locations(&self) -> locations::Client { + locations::Client(self.clone()) + } + pub fn mongo_db_resources(&self) -> mongo_db_resources::Client { + mongo_db_resources::Client(self.clone()) + } + pub fn notebook_workspaces(&self) -> notebook_workspaces::Client { + notebook_workspaces::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn partition_key_range_id(&self) -> partition_key_range_id::Client { + partition_key_range_id::Client(self.clone()) + } + pub fn partition_key_range_id_region(&self) -> partition_key_range_id_region::Client { + partition_key_range_id_region::Client(self.clone()) + } + pub fn percentile(&self) -> percentile::Client { + percentile::Client(self.clone()) + } + pub fn percentile_source_target(&self) -> percentile_source_target::Client { + percentile_source_target::Client(self.clone()) + } + pub fn percentile_target(&self) -> percentile_target::Client { + percentile_target::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn restorable_database_accounts(&self) -> restorable_database_accounts::Client { + restorable_database_accounts::Client(self.clone()) + } + pub fn restorable_gremlin_databases(&self) -> restorable_gremlin_databases::Client { + restorable_gremlin_databases::Client(self.clone()) + } + pub fn restorable_gremlin_graphs(&self) -> restorable_gremlin_graphs::Client { + restorable_gremlin_graphs::Client(self.clone()) + } + pub fn restorable_gremlin_resources(&self) -> restorable_gremlin_resources::Client { + restorable_gremlin_resources::Client(self.clone()) + } + pub fn restorable_mongodb_collections(&self) -> restorable_mongodb_collections::Client { + restorable_mongodb_collections::Client(self.clone()) + } + pub fn restorable_mongodb_databases(&self) -> restorable_mongodb_databases::Client { + restorable_mongodb_databases::Client(self.clone()) + } + pub fn restorable_mongodb_resources(&self) -> restorable_mongodb_resources::Client { + restorable_mongodb_resources::Client(self.clone()) + } + pub fn restorable_sql_containers(&self) -> restorable_sql_containers::Client { + restorable_sql_containers::Client(self.clone()) + } + pub fn restorable_sql_databases(&self) -> restorable_sql_databases::Client { + restorable_sql_databases::Client(self.clone()) + } + pub fn restorable_sql_resources(&self) -> restorable_sql_resources::Client { + restorable_sql_resources::Client(self.clone()) + } + pub fn restorable_table_resources(&self) -> restorable_table_resources::Client { + restorable_table_resources::Client(self.clone()) + } + pub fn restorable_tables(&self) -> restorable_tables::Client { + restorable_tables::Client(self.clone()) + } + pub fn service(&self) -> service::Client { + service::Client(self.clone()) + } + pub fn sql_resources(&self) -> sql_resources::Client { + sql_resources::Client(self.clone()) + } + pub fn table_resources(&self) -> table_resources::Client { + table_resources::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + DatabaseAccounts_Get(#[from] database_accounts::get::Error), + #[error(transparent)] + DatabaseAccounts_CreateOrUpdate(#[from] database_accounts::create_or_update::Error), + #[error(transparent)] + DatabaseAccounts_Update(#[from] database_accounts::update::Error), + #[error(transparent)] + DatabaseAccounts_Delete(#[from] database_accounts::delete::Error), + #[error(transparent)] + DatabaseAccounts_FailoverPriorityChange(#[from] database_accounts::failover_priority_change::Error), + #[error(transparent)] + DatabaseAccounts_List(#[from] database_accounts::list::Error), + #[error(transparent)] + DatabaseAccounts_ListByResourceGroup(#[from] database_accounts::list_by_resource_group::Error), + #[error(transparent)] + DatabaseAccounts_ListKeys(#[from] database_accounts::list_keys::Error), + #[error(transparent)] + DatabaseAccounts_ListConnectionStrings(#[from] database_accounts::list_connection_strings::Error), + #[error(transparent)] + DatabaseAccounts_OfflineRegion(#[from] database_accounts::offline_region::Error), + #[error(transparent)] + DatabaseAccounts_OnlineRegion(#[from] database_accounts::online_region::Error), + #[error(transparent)] + DatabaseAccounts_GetReadOnlyKeys(#[from] database_accounts::get_read_only_keys::Error), + #[error(transparent)] + DatabaseAccounts_ListReadOnlyKeys(#[from] database_accounts::list_read_only_keys::Error), + #[error(transparent)] + DatabaseAccounts_RegenerateKey(#[from] database_accounts::regenerate_key::Error), + #[error(transparent)] + DatabaseAccounts_CheckNameExists(#[from] database_accounts::check_name_exists::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + DatabaseAccounts_ListMetrics(#[from] database_accounts::list_metrics::Error), + #[error(transparent)] + Database_ListMetrics(#[from] database::list_metrics::Error), + #[error(transparent)] + Collection_ListMetrics(#[from] collection::list_metrics::Error), + #[error(transparent)] + CollectionRegion_ListMetrics(#[from] collection_region::list_metrics::Error), + #[error(transparent)] + DatabaseAccountRegion_ListMetrics(#[from] database_account_region::list_metrics::Error), + #[error(transparent)] + PercentileSourceTarget_ListMetrics(#[from] percentile_source_target::list_metrics::Error), + #[error(transparent)] + PercentileTarget_ListMetrics(#[from] percentile_target::list_metrics::Error), + #[error(transparent)] + Percentile_ListMetrics(#[from] percentile::list_metrics::Error), + #[error(transparent)] + CollectionPartitionRegion_ListMetrics(#[from] collection_partition_region::list_metrics::Error), + #[error(transparent)] + CollectionPartition_ListMetrics(#[from] collection_partition::list_metrics::Error), + #[error(transparent)] + PartitionKeyRangeId_ListMetrics(#[from] partition_key_range_id::list_metrics::Error), + #[error(transparent)] + PartitionKeyRangeIdRegion_ListMetrics(#[from] partition_key_range_id_region::list_metrics::Error), + #[error(transparent)] + DatabaseAccounts_ListUsages(#[from] database_accounts::list_usages::Error), + #[error(transparent)] + Database_ListUsages(#[from] database::list_usages::Error), + #[error(transparent)] + Collection_ListUsages(#[from] collection::list_usages::Error), + #[error(transparent)] + CollectionPartition_ListUsages(#[from] collection_partition::list_usages::Error), + #[error(transparent)] + Database_ListMetricDefinitions(#[from] database::list_metric_definitions::Error), + #[error(transparent)] + Collection_ListMetricDefinitions(#[from] collection::list_metric_definitions::Error), + #[error(transparent)] + DatabaseAccounts_ListMetricDefinitions(#[from] database_accounts::list_metric_definitions::Error), + #[error(transparent)] + GraphResources_ListGraphs(#[from] graph_resources::list_graphs::Error), + #[error(transparent)] + GraphResources_GetGraph(#[from] graph_resources::get_graph::Error), + #[error(transparent)] + GraphResources_CreateUpdateGraph(#[from] graph_resources::create_update_graph::Error), + #[error(transparent)] + GraphResources_DeleteGraphResource(#[from] graph_resources::delete_graph_resource::Error), + #[error(transparent)] + SqlResources_ListSqlDatabases(#[from] sql_resources::list_sql_databases::Error), + #[error(transparent)] + SqlResources_GetSqlDatabase(#[from] sql_resources::get_sql_database::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlDatabase(#[from] sql_resources::create_update_sql_database::Error), + #[error(transparent)] + SqlResources_DeleteSqlDatabase(#[from] sql_resources::delete_sql_database::Error), + #[error(transparent)] + SqlResources_GetSqlDatabaseThroughput(#[from] sql_resources::get_sql_database_throughput::Error), + #[error(transparent)] + SqlResources_UpdateSqlDatabaseThroughput(#[from] sql_resources::update_sql_database_throughput::Error), + #[error(transparent)] + SqlResources_MigrateSqlDatabaseToAutoscale(#[from] sql_resources::migrate_sql_database_to_autoscale::Error), + #[error(transparent)] + SqlResources_MigrateSqlDatabaseToManualThroughput(#[from] sql_resources::migrate_sql_database_to_manual_throughput::Error), + #[error(transparent)] + SqlResources_ListClientEncryptionKeys(#[from] sql_resources::list_client_encryption_keys::Error), + #[error(transparent)] + SqlResources_GetClientEncryptionKey(#[from] sql_resources::get_client_encryption_key::Error), + #[error(transparent)] + SqlResources_CreateUpdateClientEncryptionKey(#[from] sql_resources::create_update_client_encryption_key::Error), + #[error(transparent)] + SqlResources_ListSqlContainers(#[from] sql_resources::list_sql_containers::Error), + #[error(transparent)] + SqlResources_GetSqlContainer(#[from] sql_resources::get_sql_container::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlContainer(#[from] sql_resources::create_update_sql_container::Error), + #[error(transparent)] + SqlResources_DeleteSqlContainer(#[from] sql_resources::delete_sql_container::Error), + #[error(transparent)] + SqlResources_ListSqlContainerPartitionMerge(#[from] sql_resources::list_sql_container_partition_merge::Error), + #[error(transparent)] + SqlResources_GetSqlContainerThroughput(#[from] sql_resources::get_sql_container_throughput::Error), + #[error(transparent)] + SqlResources_UpdateSqlContainerThroughput(#[from] sql_resources::update_sql_container_throughput::Error), + #[error(transparent)] + SqlResources_MigrateSqlContainerToAutoscale(#[from] sql_resources::migrate_sql_container_to_autoscale::Error), + #[error(transparent)] + SqlResources_MigrateSqlContainerToManualThroughput(#[from] sql_resources::migrate_sql_container_to_manual_throughput::Error), + #[error(transparent)] + SqlResources_SqlContainerRetrieveThroughputDistribution(#[from] sql_resources::sql_container_retrieve_throughput_distribution::Error), + #[error(transparent)] + SqlResources_SqlContainerRedistributeThroughput(#[from] sql_resources::sql_container_redistribute_throughput::Error), + #[error(transparent)] + SqlResources_ListSqlStoredProcedures(#[from] sql_resources::list_sql_stored_procedures::Error), + #[error(transparent)] + SqlResources_GetSqlStoredProcedure(#[from] sql_resources::get_sql_stored_procedure::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlStoredProcedure(#[from] sql_resources::create_update_sql_stored_procedure::Error), + #[error(transparent)] + SqlResources_DeleteSqlStoredProcedure(#[from] sql_resources::delete_sql_stored_procedure::Error), + #[error(transparent)] + SqlResources_ListSqlUserDefinedFunctions(#[from] sql_resources::list_sql_user_defined_functions::Error), + #[error(transparent)] + SqlResources_GetSqlUserDefinedFunction(#[from] sql_resources::get_sql_user_defined_function::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlUserDefinedFunction(#[from] sql_resources::create_update_sql_user_defined_function::Error), + #[error(transparent)] + SqlResources_DeleteSqlUserDefinedFunction(#[from] sql_resources::delete_sql_user_defined_function::Error), + #[error(transparent)] + SqlResources_ListSqlTriggers(#[from] sql_resources::list_sql_triggers::Error), + #[error(transparent)] + SqlResources_GetSqlTrigger(#[from] sql_resources::get_sql_trigger::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlTrigger(#[from] sql_resources::create_update_sql_trigger::Error), + #[error(transparent)] + SqlResources_DeleteSqlTrigger(#[from] sql_resources::delete_sql_trigger::Error), + #[error(transparent)] + MongoDbResources_ListMongoDbDatabases(#[from] mongo_db_resources::list_mongo_db_databases::Error), + #[error(transparent)] + MongoDbResources_GetMongoDbDatabase(#[from] mongo_db_resources::get_mongo_db_database::Error), + #[error(transparent)] + MongoDbResources_CreateUpdateMongoDbDatabase(#[from] mongo_db_resources::create_update_mongo_db_database::Error), + #[error(transparent)] + MongoDbResources_DeleteMongoDbDatabase(#[from] mongo_db_resources::delete_mongo_db_database::Error), + #[error(transparent)] + MongoDbResources_GetMongoDbDatabaseThroughput(#[from] mongo_db_resources::get_mongo_db_database_throughput::Error), + #[error(transparent)] + MongoDbResources_UpdateMongoDbDatabaseThroughput(#[from] mongo_db_resources::update_mongo_db_database_throughput::Error), + #[error(transparent)] + MongoDbResources_MigrateMongoDbDatabaseToAutoscale(#[from] mongo_db_resources::migrate_mongo_db_database_to_autoscale::Error), + #[error(transparent)] + MongoDbResources_MigrateMongoDbDatabaseToManualThroughput( + #[from] mongo_db_resources::migrate_mongo_db_database_to_manual_throughput::Error, + ), + #[error(transparent)] + MongoDbResources_SqlContainerRetrieveThroughputDistribution( + #[from] mongo_db_resources::sql_container_retrieve_throughput_distribution::Error, + ), + #[error(transparent)] + MongoDbResources_MongoDbContainerRedistributeThroughput(#[from] mongo_db_resources::mongo_db_container_redistribute_throughput::Error), + #[error(transparent)] + MongoDbResources_ListMongoDbCollections(#[from] mongo_db_resources::list_mongo_db_collections::Error), + #[error(transparent)] + MongoDbResources_GetMongoDbCollection(#[from] mongo_db_resources::get_mongo_db_collection::Error), + #[error(transparent)] + MongoDbResources_CreateUpdateMongoDbCollection(#[from] mongo_db_resources::create_update_mongo_db_collection::Error), + #[error(transparent)] + MongoDbResources_DeleteMongoDbCollection(#[from] mongo_db_resources::delete_mongo_db_collection::Error), + #[error(transparent)] + MongoDbResources_ListMongoDbCollectionPartitionMerge(#[from] mongo_db_resources::list_mongo_db_collection_partition_merge::Error), + #[error(transparent)] + MongoDbResources_GetMongoDbCollectionThroughput(#[from] mongo_db_resources::get_mongo_db_collection_throughput::Error), + #[error(transparent)] + MongoDbResources_UpdateMongoDbCollectionThroughput(#[from] mongo_db_resources::update_mongo_db_collection_throughput::Error), + #[error(transparent)] + MongoDbResources_MigrateMongoDbCollectionToAutoscale(#[from] mongo_db_resources::migrate_mongo_db_collection_to_autoscale::Error), + #[error(transparent)] + MongoDbResources_MigrateMongoDbCollectionToManualThroughput( + #[from] mongo_db_resources::migrate_mongo_db_collection_to_manual_throughput::Error, + ), + #[error(transparent)] + TableResources_ListTables(#[from] table_resources::list_tables::Error), + #[error(transparent)] + TableResources_GetTable(#[from] table_resources::get_table::Error), + #[error(transparent)] + TableResources_CreateUpdateTable(#[from] table_resources::create_update_table::Error), + #[error(transparent)] + TableResources_DeleteTable(#[from] table_resources::delete_table::Error), + #[error(transparent)] + TableResources_GetTableThroughput(#[from] table_resources::get_table_throughput::Error), + #[error(transparent)] + TableResources_UpdateTableThroughput(#[from] table_resources::update_table_throughput::Error), + #[error(transparent)] + TableResources_MigrateTableToAutoscale(#[from] table_resources::migrate_table_to_autoscale::Error), + #[error(transparent)] + TableResources_MigrateTableToManualThroughput(#[from] table_resources::migrate_table_to_manual_throughput::Error), + #[error(transparent)] + CassandraResources_ListCassandraKeyspaces(#[from] cassandra_resources::list_cassandra_keyspaces::Error), + #[error(transparent)] + CassandraResources_GetCassandraKeyspace(#[from] cassandra_resources::get_cassandra_keyspace::Error), + #[error(transparent)] + CassandraResources_CreateUpdateCassandraKeyspace(#[from] cassandra_resources::create_update_cassandra_keyspace::Error), + #[error(transparent)] + CassandraResources_DeleteCassandraKeyspace(#[from] cassandra_resources::delete_cassandra_keyspace::Error), + #[error(transparent)] + CassandraResources_GetCassandraKeyspaceThroughput(#[from] cassandra_resources::get_cassandra_keyspace_throughput::Error), + #[error(transparent)] + CassandraResources_UpdateCassandraKeyspaceThroughput(#[from] cassandra_resources::update_cassandra_keyspace_throughput::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraKeyspaceToAutoscale(#[from] cassandra_resources::migrate_cassandra_keyspace_to_autoscale::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraKeyspaceToManualThroughput( + #[from] cassandra_resources::migrate_cassandra_keyspace_to_manual_throughput::Error, + ), + #[error(transparent)] + CassandraResources_ListCassandraTables(#[from] cassandra_resources::list_cassandra_tables::Error), + #[error(transparent)] + CassandraResources_GetCassandraTable(#[from] cassandra_resources::get_cassandra_table::Error), + #[error(transparent)] + CassandraResources_CreateUpdateCassandraTable(#[from] cassandra_resources::create_update_cassandra_table::Error), + #[error(transparent)] + CassandraResources_DeleteCassandraTable(#[from] cassandra_resources::delete_cassandra_table::Error), + #[error(transparent)] + CassandraResources_GetCassandraTableThroughput(#[from] cassandra_resources::get_cassandra_table_throughput::Error), + #[error(transparent)] + CassandraResources_UpdateCassandraTableThroughput(#[from] cassandra_resources::update_cassandra_table_throughput::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraTableToAutoscale(#[from] cassandra_resources::migrate_cassandra_table_to_autoscale::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraTableToManualThroughput( + #[from] cassandra_resources::migrate_cassandra_table_to_manual_throughput::Error, + ), + #[error(transparent)] + GremlinResources_ListGremlinDatabases(#[from] gremlin_resources::list_gremlin_databases::Error), + #[error(transparent)] + GremlinResources_GetGremlinDatabase(#[from] gremlin_resources::get_gremlin_database::Error), + #[error(transparent)] + GremlinResources_CreateUpdateGremlinDatabase(#[from] gremlin_resources::create_update_gremlin_database::Error), + #[error(transparent)] + GremlinResources_DeleteGremlinDatabase(#[from] gremlin_resources::delete_gremlin_database::Error), + #[error(transparent)] + GremlinResources_GetGremlinDatabaseThroughput(#[from] gremlin_resources::get_gremlin_database_throughput::Error), + #[error(transparent)] + GremlinResources_UpdateGremlinDatabaseThroughput(#[from] gremlin_resources::update_gremlin_database_throughput::Error), + #[error(transparent)] + GremlinResources_MigrateGremlinDatabaseToAutoscale(#[from] gremlin_resources::migrate_gremlin_database_to_autoscale::Error), + #[error(transparent)] + GremlinResources_MigrateGremlinDatabaseToManualThroughput( + #[from] gremlin_resources::migrate_gremlin_database_to_manual_throughput::Error, + ), + #[error(transparent)] + GremlinResources_ListGremlinGraphs(#[from] gremlin_resources::list_gremlin_graphs::Error), + #[error(transparent)] + GremlinResources_GetGremlinGraph(#[from] gremlin_resources::get_gremlin_graph::Error), + #[error(transparent)] + GremlinResources_CreateUpdateGremlinGraph(#[from] gremlin_resources::create_update_gremlin_graph::Error), + #[error(transparent)] + GremlinResources_DeleteGremlinGraph(#[from] gremlin_resources::delete_gremlin_graph::Error), + #[error(transparent)] + GremlinResources_GetGremlinGraphThroughput(#[from] gremlin_resources::get_gremlin_graph_throughput::Error), + #[error(transparent)] + GremlinResources_UpdateGremlinGraphThroughput(#[from] gremlin_resources::update_gremlin_graph_throughput::Error), + #[error(transparent)] + GremlinResources_MigrateGremlinGraphToAutoscale(#[from] gremlin_resources::migrate_gremlin_graph_to_autoscale::Error), + #[error(transparent)] + GremlinResources_MigrateGremlinGraphToManualThroughput(#[from] gremlin_resources::migrate_gremlin_graph_to_manual_throughput::Error), + #[error(transparent)] + Locations_List(#[from] locations::list::Error), + #[error(transparent)] + Locations_Get(#[from] locations::get::Error), + #[error(transparent)] + CassandraResources_ListCassandraViews(#[from] cassandra_resources::list_cassandra_views::Error), + #[error(transparent)] + CassandraResources_GetCassandraView(#[from] cassandra_resources::get_cassandra_view::Error), + #[error(transparent)] + CassandraResources_CreateUpdateCassandraView(#[from] cassandra_resources::create_update_cassandra_view::Error), + #[error(transparent)] + CassandraResources_DeleteCassandraView(#[from] cassandra_resources::delete_cassandra_view::Error), + #[error(transparent)] + CassandraResources_GetCassandraViewThroughput(#[from] cassandra_resources::get_cassandra_view_throughput::Error), + #[error(transparent)] + CassandraResources_UpdateCassandraViewThroughput(#[from] cassandra_resources::update_cassandra_view_throughput::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraViewToAutoscale(#[from] cassandra_resources::migrate_cassandra_view_to_autoscale::Error), + #[error(transparent)] + CassandraResources_MigrateCassandraViewToManualThroughput( + #[from] cassandra_resources::migrate_cassandra_view_to_manual_throughput::Error, + ), + #[error(transparent)] + PrivateEndpointConnections_ListByDatabaseAccount(#[from] private_endpoint_connections::list_by_database_account::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + DataTransferJobs_Get(#[from] data_transfer_jobs::get::Error), + #[error(transparent)] + DataTransferJobs_Create(#[from] data_transfer_jobs::create::Error), + #[error(transparent)] + DataTransferJobs_Pause(#[from] data_transfer_jobs::pause::Error), + #[error(transparent)] + DataTransferJobs_Resume(#[from] data_transfer_jobs::resume::Error), + #[error(transparent)] + DataTransferJobs_Cancel(#[from] data_transfer_jobs::cancel::Error), + #[error(transparent)] + DataTransferJobs_ListByDatabaseAccount(#[from] data_transfer_jobs::list_by_database_account::Error), + #[error(transparent)] + CassandraClusters_ListBySubscription(#[from] cassandra_clusters::list_by_subscription::Error), + #[error(transparent)] + CassandraClusters_ListByResourceGroup(#[from] cassandra_clusters::list_by_resource_group::Error), + #[error(transparent)] + CassandraClusters_Get(#[from] cassandra_clusters::get::Error), + #[error(transparent)] + CassandraClusters_CreateUpdate(#[from] cassandra_clusters::create_update::Error), + #[error(transparent)] + CassandraClusters_Update(#[from] cassandra_clusters::update::Error), + #[error(transparent)] + CassandraClusters_Delete(#[from] cassandra_clusters::delete::Error), + #[error(transparent)] + CassandraClusters_InvokeCommand(#[from] cassandra_clusters::invoke_command::Error), + #[error(transparent)] + CassandraClusters_ListBackups(#[from] cassandra_clusters::list_backups::Error), + #[error(transparent)] + CassandraClusters_GetBackup(#[from] cassandra_clusters::get_backup::Error), + #[error(transparent)] + CassandraDataCenters_List(#[from] cassandra_data_centers::list::Error), + #[error(transparent)] + CassandraDataCenters_Get(#[from] cassandra_data_centers::get::Error), + #[error(transparent)] + CassandraDataCenters_CreateUpdate(#[from] cassandra_data_centers::create_update::Error), + #[error(transparent)] + CassandraDataCenters_Update(#[from] cassandra_data_centers::update::Error), + #[error(transparent)] + CassandraDataCenters_Delete(#[from] cassandra_data_centers::delete::Error), + #[error(transparent)] + CassandraClusters_Deallocate(#[from] cassandra_clusters::deallocate::Error), + #[error(transparent)] + CassandraClusters_Start(#[from] cassandra_clusters::start::Error), + #[error(transparent)] + CassandraClusters_Status(#[from] cassandra_clusters::status::Error), + #[error(transparent)] + MongoDbResources_GetMongoRoleDefinition(#[from] mongo_db_resources::get_mongo_role_definition::Error), + #[error(transparent)] + MongoDbResources_CreateUpdateMongoRoleDefinition(#[from] mongo_db_resources::create_update_mongo_role_definition::Error), + #[error(transparent)] + MongoDbResources_DeleteMongoRoleDefinition(#[from] mongo_db_resources::delete_mongo_role_definition::Error), + #[error(transparent)] + MongoDbResources_ListMongoRoleDefinitions(#[from] mongo_db_resources::list_mongo_role_definitions::Error), + #[error(transparent)] + MongoDbResources_GetMongoUserDefinition(#[from] mongo_db_resources::get_mongo_user_definition::Error), + #[error(transparent)] + MongoDbResources_CreateUpdateMongoUserDefinition(#[from] mongo_db_resources::create_update_mongo_user_definition::Error), + #[error(transparent)] + MongoDbResources_DeleteMongoUserDefinition(#[from] mongo_db_resources::delete_mongo_user_definition::Error), + #[error(transparent)] + MongoDbResources_ListMongoUserDefinitions(#[from] mongo_db_resources::list_mongo_user_definitions::Error), + #[error(transparent)] + NotebookWorkspaces_ListByDatabaseAccount(#[from] notebook_workspaces::list_by_database_account::Error), + #[error(transparent)] + NotebookWorkspaces_Get(#[from] notebook_workspaces::get::Error), + #[error(transparent)] + NotebookWorkspaces_CreateOrUpdate(#[from] notebook_workspaces::create_or_update::Error), + #[error(transparent)] + NotebookWorkspaces_Delete(#[from] notebook_workspaces::delete::Error), + #[error(transparent)] + NotebookWorkspaces_ListConnectionInfo(#[from] notebook_workspaces::list_connection_info::Error), + #[error(transparent)] + NotebookWorkspaces_RegenerateAuthToken(#[from] notebook_workspaces::regenerate_auth_token::Error), + #[error(transparent)] + NotebookWorkspaces_Start(#[from] notebook_workspaces::start::Error), + #[error(transparent)] + PrivateLinkResources_ListByDatabaseAccount(#[from] private_link_resources::list_by_database_account::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + SqlResources_GetSqlRoleDefinition(#[from] sql_resources::get_sql_role_definition::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlRoleDefinition(#[from] sql_resources::create_update_sql_role_definition::Error), + #[error(transparent)] + SqlResources_DeleteSqlRoleDefinition(#[from] sql_resources::delete_sql_role_definition::Error), + #[error(transparent)] + SqlResources_ListSqlRoleDefinitions(#[from] sql_resources::list_sql_role_definitions::Error), + #[error(transparent)] + SqlResources_GetSqlRoleAssignment(#[from] sql_resources::get_sql_role_assignment::Error), + #[error(transparent)] + SqlResources_CreateUpdateSqlRoleAssignment(#[from] sql_resources::create_update_sql_role_assignment::Error), + #[error(transparent)] + SqlResources_DeleteSqlRoleAssignment(#[from] sql_resources::delete_sql_role_assignment::Error), + #[error(transparent)] + SqlResources_ListSqlRoleAssignments(#[from] sql_resources::list_sql_role_assignments::Error), + #[error(transparent)] + RestorableDatabaseAccounts_ListByLocation(#[from] restorable_database_accounts::list_by_location::Error), + #[error(transparent)] + RestorableDatabaseAccounts_List(#[from] restorable_database_accounts::list::Error), + #[error(transparent)] + RestorableDatabaseAccounts_GetByLocation(#[from] restorable_database_accounts::get_by_location::Error), + #[error(transparent)] + SqlResources_RetrieveContinuousBackupInformation(#[from] sql_resources::retrieve_continuous_backup_information::Error), + #[error(transparent)] + RestorableSqlDatabases_List(#[from] restorable_sql_databases::list::Error), + #[error(transparent)] + RestorableSqlContainers_List(#[from] restorable_sql_containers::list::Error), + #[error(transparent)] + RestorableSqlResources_List(#[from] restorable_sql_resources::list::Error), + #[error(transparent)] + MongoDbResources_RetrieveContinuousBackupInformation(#[from] mongo_db_resources::retrieve_continuous_backup_information::Error), + #[error(transparent)] + RestorableMongodbDatabases_List(#[from] restorable_mongodb_databases::list::Error), + #[error(transparent)] + RestorableMongodbCollections_List(#[from] restorable_mongodb_collections::list::Error), + #[error(transparent)] + RestorableMongodbResources_List(#[from] restorable_mongodb_resources::list::Error), + #[error(transparent)] + GremlinResources_RetrieveContinuousBackupInformation(#[from] gremlin_resources::retrieve_continuous_backup_information::Error), + #[error(transparent)] + RestorableGremlinDatabases_List(#[from] restorable_gremlin_databases::list::Error), + #[error(transparent)] + RestorableGremlinGraphs_List(#[from] restorable_gremlin_graphs::list::Error), + #[error(transparent)] + RestorableGremlinResources_List(#[from] restorable_gremlin_resources::list::Error), + #[error(transparent)] + TableResources_RetrieveContinuousBackupInformation(#[from] table_resources::retrieve_continuous_backup_information::Error), + #[error(transparent)] + RestorableTables_List(#[from] restorable_tables::list::Error), + #[error(transparent)] + RestorableTableResources_List(#[from] restorable_table_resources::list::Error), + #[error(transparent)] + Service_List(#[from] service::list::Error), + #[error(transparent)] + Service_Get(#[from] service::get::Error), + #[error(transparent)] + Service_Create(#[from] service::create::Error), + #[error(transparent)] + Service_Delete(#[from] service::delete::Error), +} +pub mod database_accounts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + create_update_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + create_update_parameters: create_update_parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + update_parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + update_parameters: update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn failover_priority_change( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + failover_parameters: impl Into, + ) -> failover_priority_change::Builder { + failover_priority_change::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + failover_parameters: failover_parameters.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_connection_strings( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_connection_strings::Builder { + list_connection_strings::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn offline_region( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region_parameter_for_offline: impl Into, + ) -> offline_region::Builder { + offline_region::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region_parameter_for_offline: region_parameter_for_offline.into(), + } + } + pub fn online_region( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region_parameter_for_online: impl Into, + ) -> online_region::Builder { + online_region::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region_parameter_for_online: region_parameter_for_online.into(), + } + } + pub fn get_read_only_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get_read_only_keys::Builder { + get_read_only_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_read_only_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_read_only_keys::Builder { + list_read_only_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn regenerate_key( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + key_to_regenerate: impl Into, + ) -> regenerate_key::Builder { + regenerate_key::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + key_to_regenerate: key_to_regenerate.into(), + } + } + pub fn check_name_exists(&self, account_name: impl Into) -> check_name_exists::Builder { + check_name_exists::Builder { + client: self.0.clone(), + account_name: account_name.into(), + } + } + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + filter: filter.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + filter: None, + } + } + pub fn list_metric_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_metric_definitions::Builder { + list_metric_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) create_update_parameters: models::DatabaseAccountCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) update_parameters: models::DatabaseAccountUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_priority_change { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) failover_parameters: models::FailoverPolicies, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/failoverPriorityChange", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/databaseAccounts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/listKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountListKeysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_connection_strings { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/listConnectionStrings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountListConnectionStringsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod offline_region { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region_parameter_for_offline: models::RegionForOnlineOffline, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/offlineRegion", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.region_parameter_for_offline).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod online_region { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region_parameter_for_online: models::RegionForOnlineOffline, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/onlineRegion", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.region_parameter_for_online).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_read_only_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/readonlykeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountListReadOnlyKeysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_read_only_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/readonlykeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatabaseAccountListReadOnlyKeysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod regenerate_key { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) key_to_regenerate: models::DatabaseAccountRegenerateKeyParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/regenerateKey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.key_to_regenerate).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod check_name_exists { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.DocumentDB/databaseAccountNames/{}", + self.client.endpoint(), + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/metrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_metric_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/metricDefinitions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricDefinitionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DocumentDB/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod database { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + filter: filter.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + filter: None, + } + } + pub fn list_metric_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + ) -> list_metric_definitions::Builder { + list_metric_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/metrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_rid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_rid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_metric_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/metricDefinitions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricDefinitionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod collection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: filter.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: None, + } + } + pub fn list_metric_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + ) -> list_metric_definitions::Builder { + list_metric_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/usages" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_metric_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/metricDefinitions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricDefinitionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod collection_region { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region: region.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . region , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod database_account_region { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region: region.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/metrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod percentile_source_target { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + source_region: impl Into, + target_region: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + source_region: source_region.into(), + target_region: target_region.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) source_region: String, + pub(crate) target_region: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sourceRegion/{}/targetRegion/{}/percentile/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . source_region , & self . target_region) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PercentileMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod percentile_target { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + target_region: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + target_region: target_region.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) target_region: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/targetRegion/{}/percentile/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . target_region) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PercentileMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod percentile { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/percentile/metrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PercentileMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod collection_partition_region { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region: region.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/partitions/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . region , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PartitionMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod collection_partition { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: filter.into(), + } + } + pub fn list_usages( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + ) -> list_usages::Builder { + list_usages::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + filter: None, + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitions/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PartitionMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_usages { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitions/usages" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PartitionUsagesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod partition_key_range_id { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + partition_key_range_id: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + partition_key_range_id: partition_key_range_id.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) partition_key_range_id: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitionKeyRangeId/{}/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_rid , & self . collection_rid , & self . partition_key_range_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PartitionMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod partition_key_range_id_region { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_metrics( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + region: impl Into, + database_rid: impl Into, + collection_rid: impl Into, + partition_key_range_id: impl Into, + filter: impl Into, + ) -> list_metrics::Builder { + list_metrics::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + region: region.into(), + database_rid: database_rid.into(), + collection_rid: collection_rid.into(), + partition_key_range_id: partition_key_range_id.into(), + filter: filter.into(), + } + } + } + pub mod list_metrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) region: String, + pub(crate) database_rid: String, + pub(crate) collection_rid: String, + pub(crate) partition_key_range_id: String, + pub(crate) filter: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/partitionKeyRangeId/{}/metrics" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . region , & self . database_rid , & self . collection_rid , & self . partition_key_range_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let filter = &self.filter; + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PartitionMetricListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod graph_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_graphs( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_graphs::Builder { + list_graphs::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_graph( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + graph_name: impl Into, + ) -> get_graph::Builder { + get_graph::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + graph_name: graph_name.into(), + } + } + pub fn create_update_graph( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + graph_name: impl Into, + create_update_graph_parameters: impl Into, + ) -> create_update_graph::Builder { + create_update_graph::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + graph_name: graph_name.into(), + create_update_graph_parameters: create_update_graph_parameters.into(), + } + } + pub fn delete_graph_resource( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + graph_name: impl Into, + ) -> delete_graph_resource::Builder { + delete_graph_resource::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + graph_name: graph_name.into(), + } + } + } + pub mod list_graphs { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/graphs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_graph { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/graphs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.graph_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphResourceGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_graph { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::GraphResourceGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) graph_name: String, + pub(crate) create_update_graph_parameters: models::GraphResourceCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/graphs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.graph_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_graph_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GraphResourceGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_graph_resource { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/graphs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.graph_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod sql_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_sql_databases( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_sql_databases::Builder { + list_sql_databases::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_sql_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_sql_database::Builder { + get_sql_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn create_update_sql_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + create_update_sql_database_parameters: impl Into, + ) -> create_update_sql_database::Builder { + create_update_sql_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + create_update_sql_database_parameters: create_update_sql_database_parameters.into(), + } + } + pub fn delete_sql_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> delete_sql_database::Builder { + delete_sql_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_sql_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_sql_database_throughput::Builder { + get_sql_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn update_sql_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_sql_database_throughput::Builder { + update_sql_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_sql_database_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_sql_database_to_autoscale::Builder { + migrate_sql_database_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn migrate_sql_database_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_sql_database_to_manual_throughput::Builder { + migrate_sql_database_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn list_client_encryption_keys( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> list_client_encryption_keys::Builder { + list_client_encryption_keys::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_client_encryption_key( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + client_encryption_key_name: impl Into, + ) -> get_client_encryption_key::Builder { + get_client_encryption_key::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + client_encryption_key_name: client_encryption_key_name.into(), + } + } + pub fn create_update_client_encryption_key( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + client_encryption_key_name: impl Into, + create_update_client_encryption_key_parameters: impl Into, + ) -> create_update_client_encryption_key::Builder { + create_update_client_encryption_key::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + client_encryption_key_name: client_encryption_key_name.into(), + create_update_client_encryption_key_parameters: create_update_client_encryption_key_parameters.into(), + } + } + pub fn list_sql_containers( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> list_sql_containers::Builder { + list_sql_containers::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_sql_container( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> get_sql_container::Builder { + get_sql_container::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn create_update_sql_container( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + create_update_sql_container_parameters: impl Into, + ) -> create_update_sql_container::Builder { + create_update_sql_container::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + create_update_sql_container_parameters: create_update_sql_container_parameters.into(), + } + } + pub fn delete_sql_container( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> delete_sql_container::Builder { + delete_sql_container::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn list_sql_container_partition_merge( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + merge_parameters: impl Into, + ) -> list_sql_container_partition_merge::Builder { + list_sql_container_partition_merge::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + merge_parameters: merge_parameters.into(), + } + } + pub fn get_sql_container_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> get_sql_container_throughput::Builder { + get_sql_container_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn update_sql_container_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_sql_container_throughput::Builder { + update_sql_container_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_sql_container_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> migrate_sql_container_to_autoscale::Builder { + migrate_sql_container_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn migrate_sql_container_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> migrate_sql_container_to_manual_throughput::Builder { + migrate_sql_container_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn sql_container_retrieve_throughput_distribution( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + retrieve_throughput_parameters: impl Into, + ) -> sql_container_retrieve_throughput_distribution::Builder { + sql_container_retrieve_throughput_distribution::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + retrieve_throughput_parameters: retrieve_throughput_parameters.into(), + } + } + pub fn sql_container_redistribute_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + redistribute_throughput_parameters: impl Into, + ) -> sql_container_redistribute_throughput::Builder { + sql_container_redistribute_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + redistribute_throughput_parameters: redistribute_throughput_parameters.into(), + } + } + pub fn list_sql_stored_procedures( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> list_sql_stored_procedures::Builder { + list_sql_stored_procedures::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn get_sql_stored_procedure( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + stored_procedure_name: impl Into, + ) -> get_sql_stored_procedure::Builder { + get_sql_stored_procedure::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + stored_procedure_name: stored_procedure_name.into(), + } + } + pub fn create_update_sql_stored_procedure( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + stored_procedure_name: impl Into, + create_update_sql_stored_procedure_parameters: impl Into, + ) -> create_update_sql_stored_procedure::Builder { + create_update_sql_stored_procedure::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + stored_procedure_name: stored_procedure_name.into(), + create_update_sql_stored_procedure_parameters: create_update_sql_stored_procedure_parameters.into(), + } + } + pub fn delete_sql_stored_procedure( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + stored_procedure_name: impl Into, + ) -> delete_sql_stored_procedure::Builder { + delete_sql_stored_procedure::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + stored_procedure_name: stored_procedure_name.into(), + } + } + pub fn list_sql_user_defined_functions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> list_sql_user_defined_functions::Builder { + list_sql_user_defined_functions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn get_sql_user_defined_function( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + user_defined_function_name: impl Into, + ) -> get_sql_user_defined_function::Builder { + get_sql_user_defined_function::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + user_defined_function_name: user_defined_function_name.into(), + } + } + pub fn create_update_sql_user_defined_function( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + user_defined_function_name: impl Into, + create_update_sql_user_defined_function_parameters: impl Into, + ) -> create_update_sql_user_defined_function::Builder { + create_update_sql_user_defined_function::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + user_defined_function_name: user_defined_function_name.into(), + create_update_sql_user_defined_function_parameters: create_update_sql_user_defined_function_parameters.into(), + } + } + pub fn delete_sql_user_defined_function( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + user_defined_function_name: impl Into, + ) -> delete_sql_user_defined_function::Builder { + delete_sql_user_defined_function::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + user_defined_function_name: user_defined_function_name.into(), + } + } + pub fn list_sql_triggers( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + ) -> list_sql_triggers::Builder { + list_sql_triggers::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + } + } + pub fn get_sql_trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + trigger_name: impl Into, + ) -> get_sql_trigger::Builder { + get_sql_trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + trigger_name: trigger_name.into(), + } + } + pub fn create_update_sql_trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + trigger_name: impl Into, + create_update_sql_trigger_parameters: impl Into, + ) -> create_update_sql_trigger::Builder { + create_update_sql_trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + trigger_name: trigger_name.into(), + create_update_sql_trigger_parameters: create_update_sql_trigger_parameters.into(), + } + } + pub fn delete_sql_trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + trigger_name: impl Into, + ) -> delete_sql_trigger::Builder { + delete_sql_trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + trigger_name: trigger_name.into(), + } + } + pub fn get_sql_role_definition( + &self, + role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get_sql_role_definition::Builder { + get_sql_role_definition::Builder { + client: self.0.clone(), + role_definition_id: role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_update_sql_role_definition( + &self, + role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + create_update_sql_role_definition_parameters: impl Into, + ) -> create_update_sql_role_definition::Builder { + create_update_sql_role_definition::Builder { + client: self.0.clone(), + role_definition_id: role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + create_update_sql_role_definition_parameters: create_update_sql_role_definition_parameters.into(), + } + } + pub fn delete_sql_role_definition( + &self, + role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete_sql_role_definition::Builder { + delete_sql_role_definition::Builder { + client: self.0.clone(), + role_definition_id: role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_sql_role_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_sql_role_definitions::Builder { + list_sql_role_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_sql_role_assignment( + &self, + role_assignment_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get_sql_role_assignment::Builder { + get_sql_role_assignment::Builder { + client: self.0.clone(), + role_assignment_id: role_assignment_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_update_sql_role_assignment( + &self, + role_assignment_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + create_update_sql_role_assignment_parameters: impl Into, + ) -> create_update_sql_role_assignment::Builder { + create_update_sql_role_assignment::Builder { + client: self.0.clone(), + role_assignment_id: role_assignment_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + create_update_sql_role_assignment_parameters: create_update_sql_role_assignment_parameters.into(), + } + } + pub fn delete_sql_role_assignment( + &self, + role_assignment_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete_sql_role_assignment::Builder { + delete_sql_role_assignment::Builder { + client: self.0.clone(), + role_assignment_id: role_assignment_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_sql_role_assignments( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_sql_role_assignments::Builder { + list_sql_role_assignments::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn retrieve_continuous_backup_information( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + container_name: impl Into, + location: impl Into, + ) -> retrieve_continuous_backup_information::Builder { + retrieve_continuous_backup_information::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + container_name: container_name.into(), + location: location.into(), + } + } + } + pub mod list_sql_databases { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlDatabaseListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_sql_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::SqlDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) create_update_sql_database_parameters: models::SqlDatabaseCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_database_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_sql_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_database_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_sql_database_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_sql_database_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_sql_database_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_client_encryption_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/clientEncryptionKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientEncryptionKeysListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_client_encryption_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) client_encryption_key_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/clientEncryptionKeys/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . client_encryption_key_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientEncryptionKeyGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_client_encryption_key { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ClientEncryptionKeyGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) client_encryption_key_name: String, + pub(crate) create_update_client_encryption_key_parameters: models::ClientEncryptionKeyCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/clientEncryptionKeys/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . client_encryption_key_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_client_encryption_key_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientEncryptionKeyGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_sql_containers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlContainerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_container { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlContainerGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_sql_container { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::SqlContainerGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) create_update_sql_container_parameters: models::SqlContainerCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_container_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlContainerGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_sql_container { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_sql_container_partition_merge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PhysicalPartitionStorageInfoCollection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) merge_parameters: models::MergeParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/partitionMerge" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.merge_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PhysicalPartitionStorageInfoCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sql_container_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_sql_container_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_sql_container_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_sql_container_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod sql_container_retrieve_throughput_distribution { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) retrieve_throughput_parameters: models::RetrieveThroughputParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/retrieveThroughputDistribution" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.retrieve_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod sql_container_redistribute_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) redistribute_throughput_parameters: models::RedistributeThroughputParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/redistributeThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.redistribute_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_sql_stored_procedures { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlStoredProcedureListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sql_stored_procedure { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) stored_procedure_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlStoredProcedureGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_sql_stored_procedure { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::SqlStoredProcedureGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) stored_procedure_name: String, + pub(crate) create_update_sql_stored_procedure_parameters: models::SqlStoredProcedureCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_stored_procedure_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlStoredProcedureGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_sql_stored_procedure { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) stored_procedure_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_sql_user_defined_functions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlUserDefinedFunctionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_user_defined_function { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) user_defined_function_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlUserDefinedFunctionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_sql_user_defined_function { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::SqlUserDefinedFunctionGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) user_defined_function_name: String, + pub(crate) create_update_sql_user_defined_function_parameters: models::SqlUserDefinedFunctionCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = + azure_core::to_json(&self.create_update_sql_user_defined_function_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlUserDefinedFunctionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_sql_user_defined_function { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) user_defined_function_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_sql_triggers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlTriggerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlTriggerGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_sql_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::SqlTriggerGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) trigger_name: String, + pub(crate) create_update_sql_trigger_parameters: models::SqlTriggerCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_trigger_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlTriggerGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_sql_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name , & self . trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sql_role_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update_sql_role_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SqlRoleDefinitionGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) create_update_sql_role_definition_parameters: models::SqlRoleDefinitionCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_role_definition_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_sql_role_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_sql_role_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sql_role_assignment { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_assignment_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleAssignmentGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update_sql_role_assignment { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SqlRoleAssignmentGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_assignment_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) create_update_sql_role_assignment_parameters: models::SqlRoleAssignmentCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_sql_role_assignment_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleAssignmentGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_sql_role_assignment { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_assignment_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_sql_role_assignments { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlRoleAssignmentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod retrieve_continuous_backup_information { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInformation), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) container_name: String, + pub(crate) location: models::ContinuousBackupRestoreLocation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/retrieveContinuousBackupInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.location).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod mongo_db_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_mongo_db_databases( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_mongo_db_databases::Builder { + list_mongo_db_databases::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_mongo_db_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_mongo_db_database::Builder { + get_mongo_db_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn create_update_mongo_db_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + create_update_mongo_db_database_parameters: impl Into, + ) -> create_update_mongo_db_database::Builder { + create_update_mongo_db_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + create_update_mongo_db_database_parameters: create_update_mongo_db_database_parameters.into(), + } + } + pub fn delete_mongo_db_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> delete_mongo_db_database::Builder { + delete_mongo_db_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_mongo_db_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_mongo_db_database_throughput::Builder { + get_mongo_db_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn update_mongo_db_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_mongo_db_database_throughput::Builder { + update_mongo_db_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_mongo_db_database_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_mongo_db_database_to_autoscale::Builder { + migrate_mongo_db_database_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn migrate_mongo_db_database_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_mongo_db_database_to_manual_throughput::Builder { + migrate_mongo_db_database_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn sql_container_retrieve_throughput_distribution( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + retrieve_throughput_parameters: impl Into, + ) -> sql_container_retrieve_throughput_distribution::Builder { + sql_container_retrieve_throughput_distribution::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + retrieve_throughput_parameters: retrieve_throughput_parameters.into(), + } + } + pub fn mongo_db_container_redistribute_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + redistribute_throughput_parameters: impl Into, + ) -> mongo_db_container_redistribute_throughput::Builder { + mongo_db_container_redistribute_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + redistribute_throughput_parameters: redistribute_throughput_parameters.into(), + } + } + pub fn list_mongo_db_collections( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> list_mongo_db_collections::Builder { + list_mongo_db_collections::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_mongo_db_collection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + ) -> get_mongo_db_collection::Builder { + get_mongo_db_collection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + } + } + pub fn create_update_mongo_db_collection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + create_update_mongo_db_collection_parameters: impl Into, + ) -> create_update_mongo_db_collection::Builder { + create_update_mongo_db_collection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + create_update_mongo_db_collection_parameters: create_update_mongo_db_collection_parameters.into(), + } + } + pub fn delete_mongo_db_collection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + ) -> delete_mongo_db_collection::Builder { + delete_mongo_db_collection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + } + } + pub fn list_mongo_db_collection_partition_merge( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + merge_parameters: impl Into, + ) -> list_mongo_db_collection_partition_merge::Builder { + list_mongo_db_collection_partition_merge::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + merge_parameters: merge_parameters.into(), + } + } + pub fn get_mongo_db_collection_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + ) -> get_mongo_db_collection_throughput::Builder { + get_mongo_db_collection_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + } + } + pub fn update_mongo_db_collection_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_mongo_db_collection_throughput::Builder { + update_mongo_db_collection_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_mongo_db_collection_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + ) -> migrate_mongo_db_collection_to_autoscale::Builder { + migrate_mongo_db_collection_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + } + } + pub fn migrate_mongo_db_collection_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + ) -> migrate_mongo_db_collection_to_manual_throughput::Builder { + migrate_mongo_db_collection_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + } + } + pub fn get_mongo_role_definition( + &self, + mongo_role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get_mongo_role_definition::Builder { + get_mongo_role_definition::Builder { + client: self.0.clone(), + mongo_role_definition_id: mongo_role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_update_mongo_role_definition( + &self, + mongo_role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + create_update_mongo_role_definition_parameters: impl Into, + ) -> create_update_mongo_role_definition::Builder { + create_update_mongo_role_definition::Builder { + client: self.0.clone(), + mongo_role_definition_id: mongo_role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + create_update_mongo_role_definition_parameters: create_update_mongo_role_definition_parameters.into(), + } + } + pub fn delete_mongo_role_definition( + &self, + mongo_role_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete_mongo_role_definition::Builder { + delete_mongo_role_definition::Builder { + client: self.0.clone(), + mongo_role_definition_id: mongo_role_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_mongo_role_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_mongo_role_definitions::Builder { + list_mongo_role_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_mongo_user_definition( + &self, + mongo_user_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> get_mongo_user_definition::Builder { + get_mongo_user_definition::Builder { + client: self.0.clone(), + mongo_user_definition_id: mongo_user_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn create_update_mongo_user_definition( + &self, + mongo_user_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + create_update_mongo_user_definition_parameters: impl Into, + ) -> create_update_mongo_user_definition::Builder { + create_update_mongo_user_definition::Builder { + client: self.0.clone(), + mongo_user_definition_id: mongo_user_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + create_update_mongo_user_definition_parameters: create_update_mongo_user_definition_parameters.into(), + } + } + pub fn delete_mongo_user_definition( + &self, + mongo_user_definition_id: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> delete_mongo_user_definition::Builder { + delete_mongo_user_definition::Builder { + client: self.0.clone(), + mongo_user_definition_id: mongo_user_definition_id.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn list_mongo_user_definitions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_mongo_user_definitions::Builder { + list_mongo_user_definitions::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn retrieve_continuous_backup_information( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + collection_name: impl Into, + location: impl Into, + ) -> retrieve_continuous_backup_information::Builder { + retrieve_continuous_backup_information::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + collection_name: collection_name.into(), + location: location.into(), + } + } + } + pub mod list_mongo_db_databases { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbDatabaseListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_mongo_db_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_mongo_db_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::MongoDbDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) create_update_mongo_db_database_parameters: models::MongoDbDatabaseCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_mongo_db_database_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_mongo_db_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_mongo_db_database_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_mongo_db_database_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_mongo_db_database_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_mongo_db_database_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod sql_container_retrieve_throughput_distribution { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) retrieve_throughput_parameters: models::RetrieveThroughputParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/retrieveThroughputDistribution" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.retrieve_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod mongo_db_container_redistribute_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) redistribute_throughput_parameters: models::RedistributeThroughputParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/redistributeThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.redistribute_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_mongo_db_collections { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbCollectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_mongo_db_collection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbCollectionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_mongo_db_collection { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::MongoDbCollectionGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) create_update_mongo_db_collection_parameters: models::MongoDbCollectionCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_mongo_db_collection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoDbCollectionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_mongo_db_collection { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_mongo_db_collection_partition_merge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::PhysicalPartitionStorageInfoCollection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) merge_parameters: models::MergeParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/partitionMerge" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.merge_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PhysicalPartitionStorageInfoCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_mongo_db_collection_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_mongo_db_collection_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_mongo_db_collection_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_mongo_db_collection_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_mongo_role_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbRoleDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_role_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoRoleDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update_mongo_role_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MongoRoleDefinitionGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) create_update_mongo_role_definition_parameters: models::MongoRoleDefinitionCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbRoleDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_role_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_mongo_role_definition_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoRoleDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_mongo_role_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_role_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbRoleDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_role_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_mongo_role_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbRoleDefinitions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoRoleDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_mongo_user_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_user_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbUserDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_user_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoUserDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update_mongo_user_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MongoUserDefinitionGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_user_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) create_update_mongo_user_definition_parameters: models::MongoUserDefinitionCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbUserDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_user_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_mongo_user_definition_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoUserDefinitionGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_mongo_user_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) mongo_user_definition_id: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbUserDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . mongo_user_definition_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_mongo_user_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbUserDefinitions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MongoUserDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod retrieve_continuous_backup_information { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInformation), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) collection_name: String, + pub(crate) location: models::ContinuousBackupRestoreLocation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/retrieveContinuousBackupInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.location).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod table_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_tables( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_tables::Builder { + list_tables::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + ) -> get_table::Builder { + get_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + } + } + pub fn create_update_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + create_update_table_parameters: impl Into, + ) -> create_update_table::Builder { + create_update_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + create_update_table_parameters: create_update_table_parameters.into(), + } + } + pub fn delete_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + ) -> delete_table::Builder { + delete_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + } + } + pub fn get_table_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + ) -> get_table_throughput::Builder { + get_table_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + } + } + pub fn update_table_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_table_throughput::Builder { + update_table_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_table_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + ) -> migrate_table_to_autoscale::Builder { + migrate_table_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + } + } + pub fn migrate_table_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + ) -> migrate_table_to_manual_throughput::Builder { + migrate_table_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + } + } + pub fn retrieve_continuous_backup_information( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + table_name: impl Into, + location: impl Into, + ) -> retrieve_continuous_backup_information::Builder { + retrieve_continuous_backup_information::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + table_name: table_name.into(), + location: location.into(), + } + } + } + pub mod list_tables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_table { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::TableGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + pub(crate) create_update_table_parameters: models::TableCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_table_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TableGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_table_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_table_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_table_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_table_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod retrieve_continuous_backup_information { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInformation), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) table_name: String, + pub(crate) location: models::ContinuousBackupRestoreLocation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/retrieveContinuousBackupInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.location).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cassandra_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_cassandra_keyspaces( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_cassandra_keyspaces::Builder { + list_cassandra_keyspaces::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_cassandra_keyspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> get_cassandra_keyspace::Builder { + get_cassandra_keyspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn create_update_cassandra_keyspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + create_update_cassandra_keyspace_parameters: impl Into, + ) -> create_update_cassandra_keyspace::Builder { + create_update_cassandra_keyspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + create_update_cassandra_keyspace_parameters: create_update_cassandra_keyspace_parameters.into(), + } + } + pub fn delete_cassandra_keyspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> delete_cassandra_keyspace::Builder { + delete_cassandra_keyspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn get_cassandra_keyspace_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> get_cassandra_keyspace_throughput::Builder { + get_cassandra_keyspace_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn update_cassandra_keyspace_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_cassandra_keyspace_throughput::Builder { + update_cassandra_keyspace_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_cassandra_keyspace_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> migrate_cassandra_keyspace_to_autoscale::Builder { + migrate_cassandra_keyspace_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn migrate_cassandra_keyspace_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> migrate_cassandra_keyspace_to_manual_throughput::Builder { + migrate_cassandra_keyspace_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn list_cassandra_tables( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> list_cassandra_tables::Builder { + list_cassandra_tables::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn get_cassandra_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + ) -> get_cassandra_table::Builder { + get_cassandra_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + } + } + pub fn create_update_cassandra_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + create_update_cassandra_table_parameters: impl Into, + ) -> create_update_cassandra_table::Builder { + create_update_cassandra_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + create_update_cassandra_table_parameters: create_update_cassandra_table_parameters.into(), + } + } + pub fn delete_cassandra_table( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + ) -> delete_cassandra_table::Builder { + delete_cassandra_table::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + } + } + pub fn get_cassandra_table_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + ) -> get_cassandra_table_throughput::Builder { + get_cassandra_table_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + } + } + pub fn update_cassandra_table_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_cassandra_table_throughput::Builder { + update_cassandra_table_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_cassandra_table_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + ) -> migrate_cassandra_table_to_autoscale::Builder { + migrate_cassandra_table_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + } + } + pub fn migrate_cassandra_table_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + table_name: impl Into, + ) -> migrate_cassandra_table_to_manual_throughput::Builder { + migrate_cassandra_table_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + table_name: table_name.into(), + } + } + pub fn list_cassandra_views( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + ) -> list_cassandra_views::Builder { + list_cassandra_views::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + } + } + pub fn get_cassandra_view( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + ) -> get_cassandra_view::Builder { + get_cassandra_view::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + } + } + pub fn create_update_cassandra_view( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + create_update_cassandra_view_parameters: impl Into, + ) -> create_update_cassandra_view::Builder { + create_update_cassandra_view::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + create_update_cassandra_view_parameters: create_update_cassandra_view_parameters.into(), + } + } + pub fn delete_cassandra_view( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + ) -> delete_cassandra_view::Builder { + delete_cassandra_view::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + } + } + pub fn get_cassandra_view_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + ) -> get_cassandra_view_throughput::Builder { + get_cassandra_view_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + } + } + pub fn update_cassandra_view_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_cassandra_view_throughput::Builder { + update_cassandra_view_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_cassandra_view_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + ) -> migrate_cassandra_view_to_autoscale::Builder { + migrate_cassandra_view_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + } + } + pub fn migrate_cassandra_view_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + keyspace_name: impl Into, + view_name: impl Into, + ) -> migrate_cassandra_view_to_manual_throughput::Builder { + migrate_cassandra_view_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + keyspace_name: keyspace_name.into(), + view_name: view_name.into(), + } + } + } + pub mod list_cassandra_keyspaces { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraKeyspaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_keyspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraKeyspaceGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_cassandra_keyspace { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::CassandraKeyspaceGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) create_update_cassandra_keyspace_parameters: models::CassandraKeyspaceCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_cassandra_keyspace_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraKeyspaceGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_cassandra_keyspace { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_keyspace_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_cassandra_keyspace_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_keyspace_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_keyspace_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cassandra_tables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_table { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraTableGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_cassandra_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::CassandraTableGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + pub(crate) create_update_cassandra_table_parameters: models::CassandraTableCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_cassandra_table_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraTableGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_cassandra_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_table_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_cassandra_table_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_table_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_table_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . table_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cassandra_views { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraViewListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_view { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraViewGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_cassandra_view { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::CassandraViewGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + pub(crate) create_update_cassandra_view_parameters: models::CassandraViewCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_cassandra_view_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraViewGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_cassandra_view { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_cassandra_view_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_cassandra_view_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_view_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_cassandra_view_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) keyspace_name: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/views/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . keyspace_name , & self . view_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod gremlin_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_gremlin_databases( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_gremlin_databases::Builder { + list_gremlin_databases::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get_gremlin_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_gremlin_database::Builder { + get_gremlin_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn create_update_gremlin_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + create_update_gremlin_database_parameters: impl Into, + ) -> create_update_gremlin_database::Builder { + create_update_gremlin_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + create_update_gremlin_database_parameters: create_update_gremlin_database_parameters.into(), + } + } + pub fn delete_gremlin_database( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> delete_gremlin_database::Builder { + delete_gremlin_database::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_gremlin_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> get_gremlin_database_throughput::Builder { + get_gremlin_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn update_gremlin_database_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_gremlin_database_throughput::Builder { + update_gremlin_database_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_gremlin_database_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_gremlin_database_to_autoscale::Builder { + migrate_gremlin_database_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn migrate_gremlin_database_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> migrate_gremlin_database_to_manual_throughput::Builder { + migrate_gremlin_database_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn list_gremlin_graphs( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + ) -> list_gremlin_graphs::Builder { + list_gremlin_graphs::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + } + } + pub fn get_gremlin_graph( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + ) -> get_gremlin_graph::Builder { + get_gremlin_graph::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + } + } + pub fn create_update_gremlin_graph( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + create_update_gremlin_graph_parameters: impl Into, + ) -> create_update_gremlin_graph::Builder { + create_update_gremlin_graph::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + create_update_gremlin_graph_parameters: create_update_gremlin_graph_parameters.into(), + } + } + pub fn delete_gremlin_graph( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + ) -> delete_gremlin_graph::Builder { + delete_gremlin_graph::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + } + } + pub fn get_gremlin_graph_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + ) -> get_gremlin_graph_throughput::Builder { + get_gremlin_graph_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + } + } + pub fn update_gremlin_graph_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + update_throughput_parameters: impl Into, + ) -> update_gremlin_graph_throughput::Builder { + update_gremlin_graph_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + update_throughput_parameters: update_throughput_parameters.into(), + } + } + pub fn migrate_gremlin_graph_to_autoscale( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + ) -> migrate_gremlin_graph_to_autoscale::Builder { + migrate_gremlin_graph_to_autoscale::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + } + } + pub fn migrate_gremlin_graph_to_manual_throughput( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + ) -> migrate_gremlin_graph_to_manual_throughput::Builder { + migrate_gremlin_graph_to_manual_throughput::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + } + } + pub fn retrieve_continuous_backup_information( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + database_name: impl Into, + graph_name: impl Into, + location: impl Into, + ) -> retrieve_continuous_backup_information::Builder { + retrieve_continuous_backup_information::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + database_name: database_name.into(), + graph_name: graph_name.into(), + location: location.into(), + } + } + } + pub mod list_gremlin_databases { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinDatabaseListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_gremlin_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_gremlin_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::GremlinDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) create_update_gremlin_database_parameters: models::GremlinDatabaseCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_gremlin_database_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinDatabaseGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_gremlin_database { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_gremlin_database_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_gremlin_database_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_gremlin_database_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_gremlin_database_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_gremlin_graphs { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinGraphListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_gremlin_graph { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinGraphGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_update_gremlin_graph { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::GremlinGraphGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + pub(crate) create_update_gremlin_graph_parameters: models::GremlinGraphCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_gremlin_graph_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GremlinGraphGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_gremlin_graph { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_gremlin_graph_throughput { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_gremlin_graph_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + pub(crate) update_throughput_parameters: models::ThroughputSettingsUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_throughput_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_gremlin_graph_to_autoscale { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default/migrateToAutoscale" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod migrate_gremlin_graph_to_manual_throughput { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default/migrateToManualThroughput" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ThroughputSettingsGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod retrieve_continuous_backup_information { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInformation), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) database_name: String, + pub(crate) graph_name: String, + pub(crate) location: models::ContinuousBackupRestoreLocation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/retrieveContinuousBackupInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . database_name , & self . graph_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.location).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod locations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get(&self, subscription_id: impl Into, location: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocationGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_database_account( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_by_database_account::Builder { + list_by_database_account::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list_by_database_account { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_transfer_jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + job_name: job_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + job_name: impl Into, + job_create_parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + job_name: job_name.into(), + job_create_parameters: job_create_parameters.into(), + } + } + pub fn pause( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + job_name: impl Into, + ) -> pause::Builder { + pause::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + job_name: job_name.into(), + } + } + pub fn resume( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + job_name: impl Into, + ) -> resume::Builder { + resume::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + job_name: job_name.into(), + } + } + pub fn cancel( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + job_name: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + job_name: job_name.into(), + } + } + pub fn list_by_database_account( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_by_database_account::Builder { + list_by_database_account::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) job_name: String, + pub(crate) job_create_parameters: models::CreateJobRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.job_create_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod pause { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs/{}/pause" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . job_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs/{}/resume" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . job_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs/{}/cancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . job_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobGetResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_database_account { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/dataTransferJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataTransferJobFeedResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cassandra_clusters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn create_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + body: impl Into, + ) -> create_update::Builder { + create_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + body: body.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + body: body.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn invoke_command( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + body: impl Into, + ) -> invoke_command::Builder { + invoke_command::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + body: body.into(), + } + } + pub fn list_backups( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> list_backups::Builder { + list_backups::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn get_backup( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + backup_id: impl Into, + ) -> get_backup::Builder { + get_backup::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + backup_id: backup_id.into(), + } + } + pub fn deallocate( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> deallocate::Builder { + deallocate::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> status::Builder { + status::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/cassandraClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListClusters = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListClusters = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClusterResource), + Created201(models::ClusterResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) body: models::ClusterResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202(models::ClusterResource), + Ok200(models::ClusterResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) body: models::ClusterResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClusterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod invoke_command { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) body: models::CommandPostBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/invokeCommand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CommandOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_backups { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/backups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListBackups = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) backup_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/backups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.backup_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod deallocate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/deallocate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/status", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CassandraClusterPublicStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cassandra_data_centers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + data_center_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + data_center_name: data_center_name.into(), + } + } + pub fn create_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + data_center_name: impl Into, + body: impl Into, + ) -> create_update::Builder { + create_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + data_center_name: data_center_name.into(), + body: body.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + data_center_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + data_center_name: data_center_name.into(), + body: body.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_name: impl Into, + data_center_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_name: cluster_name.into(), + data_center_name: data_center_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/dataCenters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListDataCenters = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) data_center_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/dataCenters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.data_center_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataCenterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DataCenterResource), + Ok200(models::DataCenterResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) data_center_name: String, + pub(crate) body: models::DataCenterResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/dataCenters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.data_center_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataCenterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataCenterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202(models::DataCenterResource), + Ok200(models::DataCenterResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) data_center_name: String, + pub(crate) body: models::DataCenterResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/dataCenters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.data_center_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataCenterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataCenterResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_name: String, + pub(crate) data_center_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/cassandraClusters/{}/dataCenters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_name, + &self.data_center_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notebook_workspaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_database_account( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_by_database_account::Builder { + list_by_database_account::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + notebook_create_update_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + notebook_create_update_parameters: notebook_create_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + } + } + pub fn list_connection_info( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + ) -> list_connection_info::Builder { + list_connection_info::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + } + } + pub fn regenerate_auth_token( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + ) -> regenerate_auth_token::Builder { + regenerate_auth_token::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + } + } + pub fn start( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + notebook_workspace_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + notebook_workspace_name: notebook_workspace_name.into(), + } + } + } + pub mod list_by_database_account { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookWorkspaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + pub(crate) notebook_create_update_parameters: models::NotebookWorkspaceCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.notebook_create_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_connection_info { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/listConnectionInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . notebook_workspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookWorkspaceConnectionInfoResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_auth_token { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/regenerateAuthToken" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . notebook_workspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) notebook_workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/start" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . account_name , & self . notebook_workspace_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_database_account( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list_by_database_account::Builder { + list_by_database_account::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + group_name: group_name.into(), + } + } + } + pub mod list_by_database_account { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod restorable_database_accounts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_location(&self, subscription_id: impl Into, location: impl Into) -> list_by_location::Builder { + list_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_by_location( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> get_by_location::Builder { + get_by_location::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + } + } + } + pub mod list_by_location { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableDatabaseAccountsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableDatabaseAccountsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_location { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableDatabaseAccountGetResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_sql_databases { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableSqlDatabases" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableSqlDatabasesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_sql_containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restorable_sql_database_rid: None, + start_time: None, + end_time: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restorable_sql_database_rid: Option, + pub(crate) start_time: Option, + pub(crate) end_time: Option, + } + impl Builder { + pub fn restorable_sql_database_rid(mut self, restorable_sql_database_rid: impl Into) -> Self { + self.restorable_sql_database_rid = Some(restorable_sql_database_rid.into()); + self + } + pub fn start_time(mut self, start_time: impl Into) -> Self { + self.start_time = Some(start_time.into()); + self + } + pub fn end_time(mut self, end_time: impl Into) -> Self { + self.end_time = Some(end_time.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableSqlContainers" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restorable_sql_database_rid) = &self.restorable_sql_database_rid { + url.query_pairs_mut() + .append_pair("restorableSqlDatabaseRid", restorable_sql_database_rid); + } + if let Some(start_time) = &self.start_time { + url.query_pairs_mut().append_pair("startTime", start_time); + } + if let Some(end_time) = &self.end_time { + url.query_pairs_mut().append_pair("endTime", end_time); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableSqlContainersListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_sql_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restore_location: None, + restore_timestamp_in_utc: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restore_location: Option, + pub(crate) restore_timestamp_in_utc: Option, + } + impl Builder { + pub fn restore_location(mut self, restore_location: impl Into) -> Self { + self.restore_location = Some(restore_location.into()); + self + } + pub fn restore_timestamp_in_utc(mut self, restore_timestamp_in_utc: impl Into) -> Self { + self.restore_timestamp_in_utc = Some(restore_timestamp_in_utc.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableSqlResources" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restore_location) = &self.restore_location { + url.query_pairs_mut().append_pair("restoreLocation", restore_location); + } + if let Some(restore_timestamp_in_utc) = &self.restore_timestamp_in_utc { + url.query_pairs_mut().append_pair("restoreTimestampInUtc", restore_timestamp_in_utc); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableSqlResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_mongodb_databases { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableMongodbDatabases" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableMongodbDatabasesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_mongodb_collections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restorable_mongodb_database_rid: None, + start_time: None, + end_time: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restorable_mongodb_database_rid: Option, + pub(crate) start_time: Option, + pub(crate) end_time: Option, + } + impl Builder { + pub fn restorable_mongodb_database_rid(mut self, restorable_mongodb_database_rid: impl Into) -> Self { + self.restorable_mongodb_database_rid = Some(restorable_mongodb_database_rid.into()); + self + } + pub fn start_time(mut self, start_time: impl Into) -> Self { + self.start_time = Some(start_time.into()); + self + } + pub fn end_time(mut self, end_time: impl Into) -> Self { + self.end_time = Some(end_time.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableMongodbCollections" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restorable_mongodb_database_rid) = &self.restorable_mongodb_database_rid { + url.query_pairs_mut() + .append_pair("restorableMongodbDatabaseRid", restorable_mongodb_database_rid); + } + if let Some(start_time) = &self.start_time { + url.query_pairs_mut().append_pair("startTime", start_time); + } + if let Some(end_time) = &self.end_time { + url.query_pairs_mut().append_pair("endTime", end_time); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableMongodbCollectionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_mongodb_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restore_location: None, + restore_timestamp_in_utc: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restore_location: Option, + pub(crate) restore_timestamp_in_utc: Option, + } + impl Builder { + pub fn restore_location(mut self, restore_location: impl Into) -> Self { + self.restore_location = Some(restore_location.into()); + self + } + pub fn restore_timestamp_in_utc(mut self, restore_timestamp_in_utc: impl Into) -> Self { + self.restore_timestamp_in_utc = Some(restore_timestamp_in_utc.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableMongodbResources" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restore_location) = &self.restore_location { + url.query_pairs_mut().append_pair("restoreLocation", restore_location); + } + if let Some(restore_timestamp_in_utc) = &self.restore_timestamp_in_utc { + url.query_pairs_mut().append_pair("restoreTimestampInUtc", restore_timestamp_in_utc); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableMongodbResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_gremlin_databases { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableGremlinDatabases" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableGremlinDatabasesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_gremlin_graphs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restorable_gremlin_database_rid: None, + start_time: None, + end_time: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restorable_gremlin_database_rid: Option, + pub(crate) start_time: Option, + pub(crate) end_time: Option, + } + impl Builder { + pub fn restorable_gremlin_database_rid(mut self, restorable_gremlin_database_rid: impl Into) -> Self { + self.restorable_gremlin_database_rid = Some(restorable_gremlin_database_rid.into()); + self + } + pub fn start_time(mut self, start_time: impl Into) -> Self { + self.start_time = Some(start_time.into()); + self + } + pub fn end_time(mut self, end_time: impl Into) -> Self { + self.end_time = Some(end_time.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableGraphs", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restorable_gremlin_database_rid) = &self.restorable_gremlin_database_rid { + url.query_pairs_mut() + .append_pair("restorableGremlinDatabaseRid", restorable_gremlin_database_rid); + } + if let Some(start_time) = &self.start_time { + url.query_pairs_mut().append_pair("startTime", start_time); + } + if let Some(end_time) = &self.end_time { + url.query_pairs_mut().append_pair("endTime", end_time); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableGremlinGraphsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_gremlin_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restore_location: None, + restore_timestamp_in_utc: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restore_location: Option, + pub(crate) restore_timestamp_in_utc: Option, + } + impl Builder { + pub fn restore_location(mut self, restore_location: impl Into) -> Self { + self.restore_location = Some(restore_location.into()); + self + } + pub fn restore_timestamp_in_utc(mut self, restore_timestamp_in_utc: impl Into) -> Self { + self.restore_timestamp_in_utc = Some(restore_timestamp_in_utc.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableGremlinResources" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restore_location) = &self.restore_location { + url.query_pairs_mut().append_pair("restoreLocation", restore_location); + } + if let Some(restore_timestamp_in_utc) = &self.restore_timestamp_in_utc { + url.query_pairs_mut().append_pair("restoreTimestampInUtc", restore_timestamp_in_utc); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableGremlinResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_tables { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + start_time: None, + end_time: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) start_time: Option, + pub(crate) end_time: Option, + } + impl Builder { + pub fn start_time(mut self, start_time: impl Into) -> Self { + self.start_time = Some(start_time.into()); + self + } + pub fn end_time(mut self, end_time: impl Into) -> Self { + self.end_time = Some(end_time.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableTables", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.instance_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(start_time) = &self.start_time { + url.query_pairs_mut().append_pair("startTime", start_time); + } + if let Some(end_time) = &self.end_time { + url.query_pairs_mut().append_pair("endTime", end_time); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableTablesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_table_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + instance_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + instance_id: instance_id.into(), + restore_location: None, + restore_timestamp_in_utc: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) instance_id: String, + pub(crate) restore_location: Option, + pub(crate) restore_timestamp_in_utc: Option, + } + impl Builder { + pub fn restore_location(mut self, restore_location: impl Into) -> Self { + self.restore_location = Some(restore_location.into()); + self + } + pub fn restore_timestamp_in_utc(mut self, restore_timestamp_in_utc: impl Into) -> Self { + self.restore_timestamp_in_utc = Some(restore_timestamp_in_utc.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.DocumentDB/locations/{}/restorableDatabaseAccounts/{}/restorableTableResources" , self . client . endpoint () , & self . subscription_id , & self . location , & self . instance_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + if let Some(restore_location) = &self.restore_location { + url.query_pairs_mut().append_pair("restoreLocation", restore_location); + } + if let Some(restore_timestamp_in_utc) = &self.restore_timestamp_in_utc { + url.query_pairs_mut().append_pair("restoreTimestampInUtc", restore_timestamp_in_utc); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RestorableTableResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + service_name: service_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + service_name: impl Into, + create_update_parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + service_name: service_name.into(), + create_update_parameters: create_update_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + account_name: impl Into, + service_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + account_name: account_name.into(), + service_name: service_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/services", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) service_name: String, + pub(crate) create_update_parameters: models::ServiceResourceCreateUpdateParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.create_update_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) account_name: String, + pub(crate) service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.account_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/costmanagement/Cargo.toml b/services/mgmt/costmanagement/Cargo.toml index 6169babc3e..c2f1be745a 100644 --- a/services/mgmt/costmanagement/Cargo.toml +++ b/services/mgmt/costmanagement/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_costmanagement" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,7 +24,7 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2022-02", "package-2021-01", "package-preview-2020-12", "package-preview-2020-03"] +features = ["no-default-tag", "package-preview-2022-02", "package-preview-2022-04", "package-2021-01", "package-preview-2020-12"] [features] default = ["package-2021-10", "enable_reqwest"] @@ -32,6 +32,7 @@ enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-preview-2022-02" = [] +"package-preview-2022-04" = [] "package-2021-10" = [] "package-2021-01" = [] "package-preview-2020-12" = [] diff --git a/services/mgmt/costmanagement/README.md b/services/mgmt/costmanagement/README.md index 9409ad4f01..fb67a0348f 100644 --- a/services/mgmt/costmanagement/README.md +++ b/services/mgmt/costmanagement/README.md @@ -11,6 +11,7 @@ The default tag is `package-2021-10`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: - `package-preview-2022-02` has 3 operations from 1 API versions: `2022-02-01-preview`. Use crate feature `package-preview-2022-02` to enable. The operations will be in the `package_preview_2022_02` module. +- `package-preview-2022-04` has 39 operations from 2 API versions: `2021-10-01`, `2022-04-01-preview`. Use crate feature `package-preview-2022-04` to enable. The operations will be in the `package_preview_2022_04` module. - `package-2021-10` has 30 operations from 1 API versions: `2021-10-01`. Use crate feature `package-2021-10` to enable. The operations will be in the `package_2021_10` module. - `package-2021-01` has 28 operations from 2 API versions: `2020-06-01`, `2021-01-01`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. - `package-preview-2020-12` has 28 operations from 2 API versions: `2020-06-01`, `2020-12-01-preview`. Use crate feature `package-preview-2020-12` to enable. The operations will be in the `package_preview_2020_12` module. diff --git a/services/mgmt/costmanagement/src/lib.rs b/services/mgmt/costmanagement/src/lib.rs index e7031b7cac..189e7cee97 100644 --- a/services/mgmt/costmanagement/src/lib.rs +++ b/services/mgmt/costmanagement/src/lib.rs @@ -7,6 +7,10 @@ pub mod package_preview_2022_02; #[cfg(all(feature = "package-preview-2022-02", not(feature = "no-default-tag")))] pub use package_preview_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-preview-2022-04")] +pub mod package_preview_2022_04; +#[cfg(all(feature = "package-preview-2022-04", not(feature = "no-default-tag")))] +pub use package_preview_2022_04::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-10")] pub mod package_2021_10; #[cfg(all(feature = "package-2021-10", not(feature = "no-default-tag")))] diff --git a/services/mgmt/costmanagement/src/package_2021_10/models.rs b/services/mgmt/costmanagement/src/package_2021_10/models.rs index 72dddc1e0a..c73b56b8e5 100644 --- a/services/mgmt/costmanagement/src/package_2021_10/models.rs +++ b/services/mgmt/costmanagement/src/package_2021_10/models.rs @@ -1505,9 +1505,9 @@ impl ReportConfigTimePeriod { #[doc = "The URL to download the generated report."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct ReportUrl { - #[doc = "The URL to download the generated report."] + #[doc = "The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity"] #[serde(rename = "reportUrl", default, skip_serializing_if = "Option::is_none")] - pub report_url: Option, + pub report_url: Option, #[doc = "The time at which report URL becomes invalid."] #[serde(rename = "validUntil", default, skip_serializing_if = "Option::is_none")] pub valid_until: Option, @@ -1517,6 +1517,21 @@ impl ReportUrl { Self::default() } } +#[doc = "The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ReservationReportSchema { + InstanceFlexibilityGroup, + InstanceFlexibilityRatio, + InstanceId, + Kind, + ReservationId, + ReservationOrderId, + ReservedHours, + SkuName, + TotalReservedQuantity, + UsageDate, + UsedHours, +} #[doc = "The Resource model definition."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct Resource { @@ -1529,6 +1544,15 @@ pub struct Resource { #[doc = "Resource type."] #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] pub type_: Option, + #[doc = "Location of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "SKU of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "ETag of the resource."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, #[doc = "Resource tags."] #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option, diff --git a/services/mgmt/costmanagement/src/package_preview_2022_04/mod.rs b/services/mgmt/costmanagement/src/package_preview_2022_04/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/costmanagement/src/package_preview_2022_04/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/costmanagement/src/package_preview_2022_04/models.rs b/services/mgmt/costmanagement/src/package_preview_2022_04/models.rs new file mode 100644 index 0000000000..f912421824 --- /dev/null +++ b/services/mgmt/costmanagement/src/package_preview_2022_04/models.rs @@ -0,0 +1,1842 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "An individual alert."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Alert { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Alert properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Alert { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Alert properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertProperties { + #[doc = "defines the type of alert"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub definition: Option, + #[doc = "Alert description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Source of alert"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "Alert details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, + #[doc = "related budget"] + #[serde(rename = "costEntityId", default, skip_serializing_if = "Option::is_none")] + pub cost_entity_id: Option, + #[doc = "alert status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "dateTime in which alert was created"] + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[doc = "dateTime in which alert was closed"] + #[serde(rename = "closeTime", default, skip_serializing_if = "Option::is_none")] + pub close_time: Option, + #[doc = "dateTime in which alert was last modified"] + #[serde(rename = "modificationTime", default, skip_serializing_if = "Option::is_none")] + pub modification_time: Option, + #[doc = "User who last modified the alert"] + #[serde(rename = "statusModificationUserName", default, skip_serializing_if = "Option::is_none")] + pub status_modification_user_name: Option, + #[doc = "dateTime in which the alert status was last modified"] + #[serde(rename = "statusModificationTime", default, skip_serializing_if = "Option::is_none")] + pub status_modification_time: Option, +} +impl AlertProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod alert_properties { + use super::*; + #[doc = "defines the type of alert"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Definition { + #[doc = "type of alert"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Alert category"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "Criteria that triggered alert"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub criteria: Option, + } + impl Definition { + pub fn new() -> Self { + Self::default() + } + } + pub mod definition { + use super::*; + #[doc = "type of alert"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Budget, + Invoice, + Credit, + Quota, + General, + #[serde(rename = "xCloud")] + XCloud, + BudgetForecast, + } + #[doc = "Alert category"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Category { + Cost, + Usage, + Billing, + System, + } + #[doc = "Criteria that triggered alert"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Criteria { + CostThresholdExceeded, + UsageThresholdExceeded, + CreditThresholdApproaching, + CreditThresholdReached, + QuotaThresholdApproaching, + QuotaThresholdReached, + MultiCurrency, + ForecastCostThresholdExceeded, + ForecastUsageThresholdExceeded, + InvoiceDueDateApproaching, + InvoiceDueDateReached, + CrossCloudNewDataAvailable, + CrossCloudCollectionError, + GeneralThresholdError, + } + } + #[doc = "Source of alert"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Source { + Preset, + User, + } + #[doc = "Alert details"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Details { + #[doc = "Type of timegrain cadence"] + #[serde(rename = "timeGrainType", default, skip_serializing_if = "Option::is_none")] + pub time_grain_type: Option, + #[doc = "datetime of periodStartDate"] + #[serde(rename = "periodStartDate", default, skip_serializing_if = "Option::is_none")] + pub period_start_date: Option, + #[doc = "notificationId that triggered this alert"] + #[serde(rename = "triggeredBy", default, skip_serializing_if = "Option::is_none")] + pub triggered_by: Option, + #[doc = "array of resourceGroups to filter by"] + #[serde(rename = "resourceGroupFilter", default, skip_serializing_if = "Vec::is_empty")] + pub resource_group_filter: Vec, + #[doc = "array of resources to filter by"] + #[serde(rename = "resourceFilter", default, skip_serializing_if = "Vec::is_empty")] + pub resource_filter: Vec, + #[doc = "array of meters to filter by"] + #[serde(rename = "meterFilter", default, skip_serializing_if = "Vec::is_empty")] + pub meter_filter: Vec, + #[doc = "tags to filter by"] + #[serde(rename = "tagFilter", default, skip_serializing_if = "Option::is_none")] + pub tag_filter: Option, + #[doc = "notification threshold percentage as a decimal which activated this alert"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub threshold: Option, + #[doc = "operator used to compare currentSpend with amount"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operator: Option, + #[doc = "budget threshold amount"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub amount: Option, + #[doc = "unit of currency being used"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "current spend"] + #[serde(rename = "currentSpend", default, skip_serializing_if = "Option::is_none")] + pub current_spend: Option, + #[doc = "list of emails to contact"] + #[serde(rename = "contactEmails", default, skip_serializing_if = "Vec::is_empty")] + pub contact_emails: Vec, + #[doc = "list of action groups to broadcast to"] + #[serde(rename = "contactGroups", default, skip_serializing_if = "Vec::is_empty")] + pub contact_groups: Vec, + #[doc = "list of contact roles"] + #[serde(rename = "contactRoles", default, skip_serializing_if = "Vec::is_empty")] + pub contact_roles: Vec, + #[doc = "overriding alert"] + #[serde(rename = "overridingAlert", default, skip_serializing_if = "Option::is_none")] + pub overriding_alert: Option, + #[doc = "department name"] + #[serde(rename = "departmentName", default, skip_serializing_if = "Option::is_none")] + pub department_name: Option, + #[doc = "company name"] + #[serde(rename = "companyName", default, skip_serializing_if = "Option::is_none")] + pub company_name: Option, + #[doc = "enrollment number"] + #[serde(rename = "enrollmentNumber", default, skip_serializing_if = "Option::is_none")] + pub enrollment_number: Option, + #[doc = "datetime of enrollmentStartDate"] + #[serde(rename = "enrollmentStartDate", default, skip_serializing_if = "Option::is_none")] + pub enrollment_start_date: Option, + #[doc = "datetime of enrollmentEndDate"] + #[serde(rename = "enrollmentEndDate", default, skip_serializing_if = "Option::is_none")] + pub enrollment_end_date: Option, + #[doc = "invoicing threshold"] + #[serde(rename = "invoicingThreshold", default, skip_serializing_if = "Option::is_none")] + pub invoicing_threshold: Option, + } + impl Details { + pub fn new() -> Self { + Self::default() + } + } + pub mod details { + use super::*; + #[doc = "Type of timegrain cadence"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TimeGrainType { + None, + Monthly, + Quarterly, + Annually, + BillingMonth, + BillingQuarter, + BillingAnnual, + } + #[doc = "operator used to compare currentSpend with amount"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + None, + EqualTo, + GreaterThan, + GreaterThanOrEqualTo, + LessThan, + LessThanOrEqualTo, + } + } + #[doc = "alert status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + None, + Active, + Overridden, + Resolved, + Dismissed, + } +} +#[doc = "Result of alerts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertsResult { + #[doc = "List of alerts."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of alerts results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AlertsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The check availability request body."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityRequest { + #[doc = "The name of the resource for which availability needs to be checked."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CheckNameAvailabilityRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The check availability result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResponse { + #[doc = "Indicates if the resource name is available."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "The reason why the given name is not available."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[doc = "Detailed reason why the given name is available."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl CheckNameAvailabilityResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod check_name_availability_response { + use super::*; + #[doc = "The reason why the given name is not available."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Invalid, + AlreadyExists, + } +} +#[doc = "The common properties of the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonExportProperties { + #[doc = "The format of the export being delivered. Currently only 'Csv' is supported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The delivery information associated with a export."] + #[serde(rename = "deliveryInfo")] + pub delivery_info: ExportDeliveryInfo, + #[doc = "The definition of an export."] + pub definition: ExportDefinition, + #[doc = "Result of listing the execution history of an export."] + #[serde(rename = "runHistory", default, skip_serializing_if = "Option::is_none")] + pub run_history: Option, + #[doc = "If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for modern commerce scopes."] + #[serde(rename = "partitionData", default, skip_serializing_if = "Option::is_none")] + pub partition_data: Option, + #[doc = "If the export has an active schedule, provides an estimate of the next execution time."] + #[serde(rename = "nextRunTimeEstimate", default, skip_serializing_if = "Option::is_none")] + pub next_run_time_estimate: Option, +} +impl CommonExportProperties { + pub fn new(delivery_info: ExportDeliveryInfo, definition: ExportDefinition) -> Self { + Self { + format: None, + delivery_info, + definition, + run_history: None, + partition_data: None, + next_run_time_estimate: None, + } + } +} +pub mod common_export_properties { + use super::*; + #[doc = "The format of the export being delivered. Currently only 'Csv' is supported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Format { + Csv, + } +} +#[doc = "Days of Week."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DaysOfWeek { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday, +} +#[doc = "List of Dimension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Dimension { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Dimension properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Dimension { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dimension properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DimensionProperties { + #[doc = "Dimension description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Filter enabled."] + #[serde(rename = "filterEnabled", default, skip_serializing_if = "Option::is_none")] + pub filter_enabled: Option, + #[doc = "Grouping enabled."] + #[serde(rename = "groupingEnabled", default, skip_serializing_if = "Option::is_none")] + pub grouping_enabled: Option, + #[doc = "Dimension data."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub data: Vec, + #[doc = "Total number of data for the dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub total: Option, + #[doc = "Dimension category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "Usage start."] + #[serde(rename = "usageStart", default, skip_serializing_if = "Option::is_none")] + pub usage_start: Option, + #[doc = "Usage end."] + #[serde(rename = "usageEnd", default, skip_serializing_if = "Option::is_none")] + pub usage_end: Option, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DimensionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of listing dimensions. It contains a list of available dimensions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DimensionsListResult { + #[doc = "The list of dimensions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl DimensionsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The request payload to update an alert"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DismissAlertPayload { + #[doc = "Alert properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DismissAlertPayload { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The details of the error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetails { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message indicating why the operation failed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the \"x-ms-ratelimit-microsoft.consumption-retry-after\" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the \"Retry-After\" header."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The details of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An export resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Export { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "The properties of the export."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Export { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definition for data in the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportDataset { + #[doc = "The granularity of rows in the export. Currently only 'Daily' is supported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[doc = "The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, +} +impl ExportDataset { + pub fn new() -> Self { + Self::default() + } +} +pub mod export_dataset { + use super::*; + #[doc = "The granularity of rows in the export. Currently only 'Daily' is supported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + Daily, + } +} +#[doc = "The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportDatasetConfiguration { + #[doc = "Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples)."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, +} +impl ExportDatasetConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definition of an export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportDefinition { + #[doc = "The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations."] + #[serde(rename = "type")] + pub type_: export_definition::Type, + #[doc = "The time frame for pulling data for the export. If custom, then a specific time period must be provided."] + pub timeframe: export_definition::Timeframe, + #[doc = "The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months."] + #[serde(rename = "timePeriod", default, skip_serializing_if = "Option::is_none")] + pub time_period: Option, + #[doc = "The definition for data in the export."] + #[serde(rename = "dataSet", default, skip_serializing_if = "Option::is_none")] + pub data_set: Option, +} +impl ExportDefinition { + pub fn new(type_: export_definition::Type, timeframe: export_definition::Timeframe) -> Self { + Self { + type_, + timeframe, + time_period: None, + data_set: None, + } + } +} +pub mod export_definition { + use super::*; + #[doc = "The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Usage, + ActualCost, + AmortizedCost, + } + #[doc = "The time frame for pulling data for the export. If custom, then a specific time period must be provided."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Timeframe { + MonthToDate, + BillingMonthToDate, + TheLastMonth, + TheLastBillingMonth, + WeekToDate, + Custom, + } +} +#[doc = "This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Azure Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key )."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportDeliveryDestination { + #[doc = "The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The name of the container where exports will be uploaded. If the container does not exist it will be created."] + pub container: String, + #[doc = "The name of the directory where exports will be uploaded."] + #[serde(rename = "rootFolderPath", default, skip_serializing_if = "Option::is_none")] + pub root_folder_path: Option, + #[doc = "A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified instead of resourceId. Note: the value returned by the API for this property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. To update this value a new SAS token must be specified."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, + #[doc = "The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken can be specified instead of resourceId."] + #[serde(rename = "storageAccount", default, skip_serializing_if = "Option::is_none")] + pub storage_account: Option, +} +impl ExportDeliveryDestination { + pub fn new(container: String) -> Self { + Self { + resource_id: None, + container, + root_folder_path: None, + sas_token: None, + storage_account: None, + } + } +} +#[doc = "The delivery information associated with a export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportDeliveryInfo { + #[doc = "This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Azure Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key )."] + pub destination: ExportDeliveryDestination, +} +impl ExportDeliveryInfo { + pub fn new(destination: ExportDeliveryDestination) -> Self { + Self { destination } + } +} +#[doc = "An export execution."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportExecution { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "The properties of the export execution."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ExportExecution { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of listing the execution history of an export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportExecutionListResult { + #[doc = "A list of export executions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ExportExecutionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the export execution."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportExecutionProperties { + #[doc = "The type of the export execution."] + #[serde(rename = "executionType", default, skip_serializing_if = "Option::is_none")] + pub execution_type: Option, + #[doc = "The last known status of the export execution."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The identifier for the entity that executed the export. For OnDemand executions it is the user email. For scheduled executions it is 'System'."] + #[serde(rename = "submittedBy", default, skip_serializing_if = "Option::is_none")] + pub submitted_by: Option, + #[doc = "The time when export was queued to be executed."] + #[serde(rename = "submittedTime", default, skip_serializing_if = "Option::is_none")] + pub submitted_time: Option, + #[doc = "The time when export was picked up to be executed."] + #[serde(rename = "processingStartTime", default, skip_serializing_if = "Option::is_none")] + pub processing_start_time: Option, + #[doc = "The time when the export execution finished."] + #[serde(rename = "processingEndTime", default, skip_serializing_if = "Option::is_none")] + pub processing_end_time: Option, + #[doc = "The name of the exported file."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, + #[doc = "The common properties of the export."] + #[serde(rename = "runSettings", default, skip_serializing_if = "Option::is_none")] + pub run_settings: Option, + #[doc = "The details of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ExportExecutionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod export_execution_properties { + use super::*; + #[doc = "The type of the export execution."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ExecutionType { + OnDemand, + Scheduled, + } + #[doc = "The last known status of the export execution."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Queued, + InProgress, + Completed, + Failed, + Timeout, + NewDataNotAvailable, + DataNotAvailable, + } +} +#[doc = "Result of listing exports. It contains a list of available exports in the scope provided."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportListResult { + #[doc = "The list of exports."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ExportListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportProperties { + #[serde(flatten)] + pub common_export_properties: CommonExportProperties, + #[doc = "The schedule associated with the export."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, +} +impl ExportProperties { + pub fn new(common_export_properties: CommonExportProperties) -> Self { + Self { + common_export_properties, + schedule: None, + } + } +} +#[doc = "The start and end date for recurrence schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportRecurrencePeriod { + #[doc = "The start date of recurrence."] + pub from: String, + #[doc = "The end date of recurrence."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub to: Option, +} +impl ExportRecurrencePeriod { + pub fn new(from: String) -> Self { + Self { from, to: None } + } +} +#[doc = "The schedule associated with the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportSchedule { + #[doc = "The status of the export's schedule. If 'Inactive', the export's schedule is paused."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The schedule recurrence."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recurrence: Option, + #[doc = "The start and end date for recurrence schedule."] + #[serde(rename = "recurrencePeriod", default, skip_serializing_if = "Option::is_none")] + pub recurrence_period: Option, +} +impl ExportSchedule { + pub fn new() -> Self { + Self::default() + } +} +pub mod export_schedule { + use super::*; + #[doc = "The status of the export's schedule. If 'Inactive', the export's schedule is paused."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Active, + Inactive, + } + #[doc = "The schedule recurrence."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Recurrence { + Daily, + Weekly, + Monthly, + Annually, + } +} +#[doc = "The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportTimePeriod { + #[doc = "The start date for export data."] + pub from: String, + #[doc = "The end date for export data."] + pub to: String, +} +impl ExportTimePeriod { + pub fn new(from: String, to: String) -> Self { + Self { from, to } + } +} +#[doc = "Destination of the view data. Currently only csv format is supported."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FileDestination { + #[doc = "Destination of the view data. Currently only csv format is supported."] + #[serde(rename = "fileFormats", default, skip_serializing_if = "Vec::is_empty")] + pub file_formats: Vec, +} +impl FileDestination { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Destination of the view data. Currently only csv format is supported."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FileFormat { + Csv, +} +#[doc = "The definition of data present in the forecast."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ForecastDataset { + #[doc = "The granularity of rows in the forecast."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[doc = "The configuration of dataset in the query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, + #[doc = "Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub aggregation: Option, + #[doc = "The filter expression to be used in the export."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl ForecastDataset { + pub fn new() -> Self { + Self::default() + } +} +pub mod forecast_dataset { + use super::*; + #[doc = "The granularity of rows in the forecast."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + Daily, + } +} +#[doc = "The definition of a forecast."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ForecastDefinition { + #[doc = "The type of the forecast."] + #[serde(rename = "type")] + pub type_: forecast_definition::Type, + #[doc = "The time frame for pulling data for the forecast. If custom, then a specific time period must be provided."] + pub timeframe: forecast_definition::Timeframe, + #[doc = "The start and end date for pulling data for the query."] + #[serde(rename = "timePeriod", default, skip_serializing_if = "Option::is_none")] + pub time_period: Option, + #[doc = "The definition of data present in the forecast."] + pub dataset: ForecastDataset, + #[doc = "a boolean determining if actualCost will be included"] + #[serde(rename = "includeActualCost", default, skip_serializing_if = "Option::is_none")] + pub include_actual_cost: Option, + #[doc = "a boolean determining if FreshPartialCost will be included"] + #[serde(rename = "includeFreshPartialCost", default, skip_serializing_if = "Option::is_none")] + pub include_fresh_partial_cost: Option, +} +impl ForecastDefinition { + pub fn new(type_: forecast_definition::Type, timeframe: forecast_definition::Timeframe, dataset: ForecastDataset) -> Self { + Self { + type_, + timeframe, + time_period: None, + dataset, + include_actual_cost: None, + include_fresh_partial_cost: None, + } + } +} +pub mod forecast_definition { + use super::*; + #[doc = "The type of the forecast."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Usage, + ActualCost, + AmortizedCost, + } + #[doc = "The time frame for pulling data for the forecast. If custom, then a specific time period must be provided."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Timeframe { + MonthToDate, + BillingMonthToDate, + TheLastMonth, + TheLastBillingMonth, + WeekToDate, + Custom, + } +} +#[doc = "Each KPI must contain a 'type' and 'enabled' key."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KpiProperties { + #[doc = "KPI type (Forecast, Budget)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "ID of resource related to metric (budget)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "show the KPI in the UI?"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl KpiProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod kpi_properties { + use super::*; + #[doc = "KPI type (Forecast, Budget)."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Forecast, + Budget, + } +} +#[doc = "The properties of the scheduled action notification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationProperties { + #[doc = "Array of email addresses."] + pub to: Vec, + #[doc = "Optional message to be added in the email. Length is limited to 250 characters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Subject of the email. Length is limited to 70 characters."] + pub subject: String, +} +impl NotificationProperties { + pub fn new(to: Vec, subject: String) -> Self { + Self { + to, + message: None, + subject, + } + } +} +#[doc = "A Cost management REST API operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation id: {provider}/{resource}/{operation}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Operation name: {provider}/{resource}/{operation}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The object that represents the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "The object that represents the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Service provider: Microsoft.CostManagement."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource on which the operation is performed: Dimensions, Query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operation type: Read, write, delete, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Operation description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of cost management operations supported by the Microsoft.CostManagement resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of the long running operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationStatus { + #[doc = "The status of the long running operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The URL to download the generated report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_status { + use super::*; + #[doc = "The status of the long running operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Running, + Completed, + Failed, + } +} +#[doc = "Each pivot must contain a 'type' and 'name'."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PivotProperties { + #[doc = "Data type to show in view."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Data field to show in view."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl PivotProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod pivot_properties { + use super::*; + #[doc = "Data type to show in view."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Dimension, + TagKey, + } +} +#[doc = "The Resource model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[doc = "Resource Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The aggregation expression to be used in the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryAggregation { + #[doc = "The name of the column to aggregate."] + pub name: String, + #[doc = "The name of the aggregation function to use."] + pub function: query_aggregation::Function, +} +impl QueryAggregation { + pub fn new(name: String, function: query_aggregation::Function) -> Self { + Self { name, function } + } +} +pub mod query_aggregation { + use super::*; + #[doc = "The name of the aggregation function to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Function { + Sum, + } +} +#[doc = "QueryColumn properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryColumn { + #[doc = "The name of column."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of column."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl QueryColumn { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of the column in the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum QueryColumnType { + Tag, + Dimension, +} +#[doc = "The comparison expression to be used in the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryComparisonExpression { + #[doc = "The name of the column to use in comparison."] + pub name: String, + #[doc = "The operator to use for comparison."] + pub operator: query_comparison_expression::Operator, + #[doc = "Array of values to use for comparison"] + pub values: Vec, +} +impl QueryComparisonExpression { + pub fn new(name: String, operator: query_comparison_expression::Operator, values: Vec) -> Self { + Self { name, operator, values } + } +} +pub mod query_comparison_expression { + use super::*; + #[doc = "The operator to use for comparison."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + In, + } +} +#[doc = "The definition of data present in the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryDataset { + #[doc = "The granularity of rows in the query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[doc = "The configuration of dataset in the query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, + #[doc = "Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub aggregation: Option, + #[doc = "Array of group by expression to use in the query. Query can have up to 2 group by clauses."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub grouping: Vec, + #[doc = "The filter expression to be used in the export."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl QueryDataset { + pub fn new() -> Self { + Self::default() + } +} +pub mod query_dataset { + use super::*; + #[doc = "The granularity of rows in the query."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + Daily, + } +} +#[doc = "The configuration of dataset in the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryDatasetConfiguration { + #[doc = "Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, +} +impl QueryDatasetConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definition of a query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryDefinition { + #[doc = "The type of the query."] + #[serde(rename = "type")] + pub type_: query_definition::Type, + #[doc = "The time frame for pulling data for the query. If custom, then a specific time period must be provided."] + pub timeframe: query_definition::Timeframe, + #[doc = "The start and end date for pulling data for the query."] + #[serde(rename = "timePeriod", default, skip_serializing_if = "Option::is_none")] + pub time_period: Option, + #[doc = "The definition of data present in the query."] + pub dataset: QueryDataset, +} +impl QueryDefinition { + pub fn new(type_: query_definition::Type, timeframe: query_definition::Timeframe, dataset: QueryDataset) -> Self { + Self { + type_, + timeframe, + time_period: None, + dataset, + } + } +} +pub mod query_definition { + use super::*; + #[doc = "The type of the query."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Usage, + ActualCost, + AmortizedCost, + } + #[doc = "The time frame for pulling data for the query. If custom, then a specific time period must be provided."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Timeframe { + MonthToDate, + BillingMonthToDate, + TheLastMonth, + TheLastBillingMonth, + WeekToDate, + Custom, + } +} +#[doc = "The filter expression to be used in the export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryFilter { + #[doc = "The logical \"AND\" expression. Must have at least 2 items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub and: Vec, + #[doc = "The logical \"OR\" expression. Must have at least 2 items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub or: Vec, + #[doc = "The comparison expression to be used in the query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dimensions: Option, + #[doc = "The comparison expression to be used in the query."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl QueryFilter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The group by expression to be used in the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryGrouping { + #[doc = "The type of the column in the export."] + #[serde(rename = "type")] + pub type_: QueryColumnType, + #[doc = "The name of the column to group."] + pub name: String, +} +impl QueryGrouping { + pub fn new(type_: QueryColumnType, name: String) -> Self { + Self { type_, name } + } +} +#[doc = "Query properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryProperties { + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "Array of columns"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, + #[doc = "Array of rows"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rows: Vec>, +} +impl QueryProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of query. It contains all columns listed under groupings and aggregation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryResult { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Query properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl QueryResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The start and end date for pulling data for the query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryTimePeriod { + #[doc = "The start date to pull data from."] + pub from: String, + #[doc = "The end date to pull data to."] + pub to: String, +} +impl QueryTimePeriod { + pub fn new(from: String, to: String) -> Self { + Self { from, to } + } +} +#[doc = "The aggregation expression to be used in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigAggregation { + #[doc = "The name of the column to aggregate."] + pub name: String, + #[doc = "The name of the aggregation function to use."] + pub function: report_config_aggregation::Function, +} +impl ReportConfigAggregation { + pub fn new(name: String, function: report_config_aggregation::Function) -> Self { + Self { name, function } + } +} +pub mod report_config_aggregation { + use super::*; + #[doc = "The name of the aggregation function to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Function { + Sum, + } +} +#[doc = "The type of the column in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ReportConfigColumnType { + Tag, + Dimension, +} +#[doc = "The comparison expression to be used in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigComparisonExpression { + #[doc = "The name of the column to use in comparison."] + pub name: String, + #[doc = "The operator to use for comparison."] + pub operator: report_config_comparison_expression::Operator, + #[doc = "Array of values to use for comparison"] + pub values: Vec, +} +impl ReportConfigComparisonExpression { + pub fn new(name: String, operator: report_config_comparison_expression::Operator, values: Vec) -> Self { + Self { name, operator, values } + } +} +pub mod report_config_comparison_expression { + use super::*; + #[doc = "The operator to use for comparison."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + In, + Contains, + } +} +#[doc = "The definition of data present in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportConfigDataset { + #[doc = "The granularity of rows in the report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub granularity: Option, + #[doc = "The configuration of dataset in the report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, + #[doc = "Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the aggregated column. Report can have up to 2 aggregation clauses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub aggregation: Option, + #[doc = "Array of group by expression to use in the report. Report can have up to 2 group by clauses."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub grouping: Vec, + #[doc = "Array of order by expression to use in the report."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sorting: Vec, + #[doc = "The filter expression to be used in the report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl ReportConfigDataset { + pub fn new() -> Self { + Self::default() + } +} +pub mod report_config_dataset { + use super::*; + #[doc = "The granularity of rows in the report."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Granularity { + Daily, + Monthly, + } +} +#[doc = "The configuration of dataset in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportConfigDatasetConfiguration { + #[doc = "Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, +} +impl ReportConfigDatasetConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definition of a report config."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigDefinition { + #[doc = "The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates."] + #[serde(rename = "type")] + pub type_: report_config_definition::Type, + #[doc = "The time frame for pulling data for the report. If custom, then a specific time period must be provided."] + pub timeframe: report_config_definition::Timeframe, + #[doc = "The start and end date for pulling data for the report."] + #[serde(rename = "timePeriod", default, skip_serializing_if = "Option::is_none")] + pub time_period: Option, + #[doc = "The definition of data present in the report."] + #[serde(rename = "dataSet", default, skip_serializing_if = "Option::is_none")] + pub data_set: Option, + #[doc = "If true, report includes monetary commitment."] + #[serde(rename = "includeMonetaryCommitment", default, skip_serializing_if = "Option::is_none")] + pub include_monetary_commitment: Option, +} +impl ReportConfigDefinition { + pub fn new(type_: report_config_definition::Type, timeframe: report_config_definition::Timeframe) -> Self { + Self { + type_, + timeframe, + time_period: None, + data_set: None, + include_monetary_commitment: None, + } + } +} +pub mod report_config_definition { + use super::*; + #[doc = "The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Usage, + } + #[doc = "The time frame for pulling data for the report. If custom, then a specific time period must be provided."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Timeframe { + WeekToDate, + MonthToDate, + YearToDate, + Custom, + } +} +#[doc = "The filter expression to be used in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportConfigFilter { + #[doc = "The logical \"AND\" expression. Must have at least 2 items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub and: Vec, + #[doc = "The logical \"OR\" expression. Must have at least 2 items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub or: Vec, + #[doc = "The comparison expression to be used in the report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dimensions: Option, + #[doc = "The comparison expression to be used in the report."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ReportConfigFilter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The group by expression to be used in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigGrouping { + #[doc = "The type of the column in the report."] + #[serde(rename = "type")] + pub type_: ReportConfigColumnType, + #[doc = "The name of the column to group. This version supports subscription lowest possible grain."] + pub name: String, +} +impl ReportConfigGrouping { + pub fn new(type_: ReportConfigColumnType, name: String) -> Self { + Self { type_, name } + } +} +#[doc = "The order by expression to be used in the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigSorting { + #[doc = "Direction of sort."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, + #[doc = "The name of the column to sort."] + pub name: String, +} +impl ReportConfigSorting { + pub fn new(name: String) -> Self { + Self { direction: None, name } + } +} +pub mod report_config_sorting { + use super::*; + #[doc = "Direction of sort."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + Ascending, + Descending, + } +} +#[doc = "The start and end date for pulling data for the report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReportConfigTimePeriod { + #[doc = "The start date to pull data from."] + pub from: String, + #[doc = "The end date to pull data to."] + pub to: String, +} +impl ReportConfigTimePeriod { + pub fn new(from: String, to: String) -> Self { + Self { from, to } + } +} +#[doc = "The URL to download the generated report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReportUrl { + #[doc = "The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity"] + #[serde(rename = "reportUrl", default, skip_serializing_if = "Option::is_none")] + pub report_url: Option, + #[doc = "The time at which report URL becomes invalid."] + #[serde(rename = "validUntil", default, skip_serializing_if = "Option::is_none")] + pub valid_until: Option, +} +impl ReportUrl { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ReservationReportSchema { + InstanceFlexibilityGroup, + InstanceFlexibilityRatio, + InstanceId, + Kind, + ReservationId, + ReservationOrderId, + ReservedHours, + SkuName, + TotalReservedQuantity, + UsageDate, + UsedHours, +} +#[doc = "The Resource model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Location of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "SKU of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "ETag of the resource."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Frequency of the schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScheduleFrequency { + Daily, + Weekly, + Monthly, +} +#[doc = "The properties of the schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleProperties { + #[doc = "Frequency of the schedule."] + pub frequency: ScheduleFrequency, + #[doc = "UTC time at which cost analysis data will be emailed."] + #[serde(rename = "hourOfDay", default, skip_serializing_if = "Option::is_none")] + pub hour_of_day: Option, + #[doc = "Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly."] + #[serde(rename = "daysOfWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_week: Vec, + #[doc = "Weeks in which cost analysis data will be emailed. This property is applicable when frequency is Monthly and used in combination with daysOfWeek."] + #[serde(rename = "weeksOfMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_month: Vec, + #[doc = "UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency is Monthly and overrides weeksOfMonth or daysOfWeek."] + #[serde(rename = "dayOfMonth", default, skip_serializing_if = "Option::is_none")] + pub day_of_month: Option, + #[doc = "The start date and time of the scheduled action (UTC)."] + #[serde(rename = "startDate")] + pub start_date: String, + #[doc = "The end date and time of the scheduled action (UTC)."] + #[serde(rename = "endDate")] + pub end_date: String, +} +impl ScheduleProperties { + pub fn new(frequency: ScheduleFrequency, start_date: String, end_date: String) -> Self { + Self { + frequency, + hour_of_day: None, + days_of_week: Vec::new(), + weeks_of_month: Vec::new(), + day_of_month: None, + start_date, + end_date, + } + } +} +#[doc = "Scheduled action definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScheduledAction { + #[serde(flatten)] + pub scheduled_action_proxy_resource: ScheduledActionProxyResource, + #[doc = "The properties of the scheduled action."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ScheduledAction { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Kind of the scheduled action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScheduledActionKind { + Email, +} +#[doc = "Scheduled actions list result. It contains a list of scheduled actions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScheduledActionListResult { + #[doc = "The list of scheduled actions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ScheduledActionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the scheduled action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduledActionProperties { + #[doc = "Scheduled action name."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Destination of the view data. Currently only csv format is supported."] + #[serde(rename = "fileDestination", default, skip_serializing_if = "Option::is_none")] + pub file_destination: Option, + #[doc = "The properties of the scheduled action notification."] + pub notification: NotificationProperties, + #[doc = "The properties of the schedule."] + pub schedule: ScheduleProperties, + #[doc = "Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Status of the scheduled action."] + pub status: ScheduledActionStatus, + #[doc = "Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'"] + #[serde(rename = "viewId")] + pub view_id: String, +} +impl ScheduledActionProperties { + pub fn new( + display_name: String, + notification: NotificationProperties, + schedule: ScheduleProperties, + status: ScheduledActionStatus, + view_id: String, + ) -> Self { + Self { + display_name, + file_destination: None, + notification, + schedule, + scope: None, + status, + view_id, + } + } +} +#[doc = "The Resource model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScheduledActionProxyResource { + #[doc = "Resource Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Etag."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Kind of the scheduled action."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl ScheduledActionProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Status of the scheduled action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScheduledActionStatus { + Enabled, + Disabled, +} +#[doc = "States and configurations of Cost Analysis."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct View { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "The properties of the view."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl View { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of listing views. It contains a list of available views."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ViewListResult { + #[doc = "The list of views."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ViewListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the view."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ViewProperties { + #[doc = "User input name of the view. Required."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Date the user created this view."] + #[serde(rename = "createdOn", default, skip_serializing_if = "Option::is_none")] + pub created_on: Option, + #[doc = "Date when the user last modified this view."] + #[serde(rename = "modifiedOn", default, skip_serializing_if = "Option::is_none")] + pub modified_on: Option, + #[doc = "Date range of the current view."] + #[serde(rename = "dateRange", default, skip_serializing_if = "Option::is_none")] + pub date_range: Option, + #[doc = "Currency of the current view."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub currency: Option, + #[doc = "The definition of a report config."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Chart type of the main view in Cost Analysis. Required."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub chart: Option, + #[doc = "Show costs accumulated over time."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub accumulated: Option, + #[doc = "Metric to use when displaying costs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metric: Option, + #[doc = "List of KPIs to show in Cost Analysis UI."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub kpis: Vec, + #[doc = "Configuration of 3 sub-views in the Cost Analysis UI."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pivots: Vec, +} +impl ViewProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod view_properties { + use super::*; + #[doc = "Chart type of the main view in Cost Analysis. Required."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Chart { + Area, + Line, + StackedColumn, + GroupedColumn, + Table, + } + #[doc = "Show costs accumulated over time."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Accumulated { + #[serde(rename = "true")] + True, + #[serde(rename = "false")] + False, + } + #[doc = "Metric to use when displaying costs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Metric { + ActualCost, + AmortizedCost, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Weeks of month."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WeeksOfMonth { + First, + Second, + Third, + Fourth, + Last, +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/costmanagement/src/package_preview_2022_04/operations.rs b/services/mgmt/costmanagement/src/package_preview_2022_04/operations.rs new file mode 100644 index 0000000000..bcf1c6043e --- /dev/null +++ b/services/mgmt/costmanagement/src/package_preview_2022_04/operations.rs @@ -0,0 +1,3661 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn alerts(&self) -> alerts::Client { + alerts::Client(self.clone()) + } + pub fn dimensions(&self) -> dimensions::Client { + dimensions::Client(self.clone()) + } + pub fn exports(&self) -> exports::Client { + exports::Client(self.clone()) + } + pub fn forecast(&self) -> forecast::Client { + forecast::Client(self.clone()) + } + pub fn generate_reservation_details_report(&self) -> generate_reservation_details_report::Client { + generate_reservation_details_report::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn query(&self) -> query::Client { + query::Client(self.clone()) + } + pub fn scheduled_actions(&self) -> scheduled_actions::Client { + scheduled_actions::Client(self.clone()) + } + pub fn views(&self) -> views::Client { + views::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ScheduledActions_List(#[from] scheduled_actions::list::Error), + #[error(transparent)] + ScheduledActions_ListByScope(#[from] scheduled_actions::list_by_scope::Error), + #[error(transparent)] + ScheduledActions_Get(#[from] scheduled_actions::get::Error), + #[error(transparent)] + ScheduledActions_CreateOrUpdate(#[from] scheduled_actions::create_or_update::Error), + #[error(transparent)] + ScheduledActions_Delete(#[from] scheduled_actions::delete::Error), + #[error(transparent)] + ScheduledActions_GetByScope(#[from] scheduled_actions::get_by_scope::Error), + #[error(transparent)] + ScheduledActions_CreateOrUpdateByScope(#[from] scheduled_actions::create_or_update_by_scope::Error), + #[error(transparent)] + ScheduledActions_DeleteByScope(#[from] scheduled_actions::delete_by_scope::Error), + #[error(transparent)] + ScheduledActions_Execute(#[from] scheduled_actions::execute::Error), + #[error(transparent)] + ScheduledActions_ExecuteByScope(#[from] scheduled_actions::execute_by_scope::Error), + #[error(transparent)] + ScheduledActions_CheckNameAvailability(#[from] scheduled_actions::check_name_availability::Error), + #[error(transparent)] + ScheduledActions_CheckNameAvailabilityByScope(#[from] scheduled_actions::check_name_availability_by_scope::Error), + #[error(transparent)] + Views_List(#[from] views::list::Error), + #[error(transparent)] + Views_ListByScope(#[from] views::list_by_scope::Error), + #[error(transparent)] + Views_Get(#[from] views::get::Error), + #[error(transparent)] + Views_CreateOrUpdate(#[from] views::create_or_update::Error), + #[error(transparent)] + Views_Delete(#[from] views::delete::Error), + #[error(transparent)] + Views_GetByScope(#[from] views::get_by_scope::Error), + #[error(transparent)] + Views_CreateOrUpdateByScope(#[from] views::create_or_update_by_scope::Error), + #[error(transparent)] + Views_DeleteByScope(#[from] views::delete_by_scope::Error), + #[error(transparent)] + Alerts_List(#[from] alerts::list::Error), + #[error(transparent)] + Alerts_Get(#[from] alerts::get::Error), + #[error(transparent)] + Alerts_Dismiss(#[from] alerts::dismiss::Error), + #[error(transparent)] + Alerts_ListExternal(#[from] alerts::list_external::Error), + #[error(transparent)] + Forecast_Usage(#[from] forecast::usage::Error), + #[error(transparent)] + Forecast_ExternalCloudProviderUsage(#[from] forecast::external_cloud_provider_usage::Error), + #[error(transparent)] + Dimensions_List(#[from] dimensions::list::Error), + #[error(transparent)] + Dimensions_ByExternalCloudProviderType(#[from] dimensions::by_external_cloud_provider_type::Error), + #[error(transparent)] + Query_Usage(#[from] query::usage::Error), + #[error(transparent)] + Query_UsageByExternalCloudProviderType(#[from] query::usage_by_external_cloud_provider_type::Error), + #[error(transparent)] + GenerateReservationDetailsReport_ByBillingAccountId(#[from] generate_reservation_details_report::by_billing_account_id::Error), + #[error(transparent)] + GenerateReservationDetailsReport_ByBillingProfileId(#[from] generate_reservation_details_report::by_billing_profile_id::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Exports_List(#[from] exports::list::Error), + #[error(transparent)] + Exports_Get(#[from] exports::get::Error), + #[error(transparent)] + Exports_CreateOrUpdate(#[from] exports::create_or_update::Error), + #[error(transparent)] + Exports_Delete(#[from] exports::delete::Error), + #[error(transparent)] + Exports_Execute(#[from] exports::execute::Error), + #[error(transparent)] + Exports_GetExecutionHistory(#[from] exports::get_execution_history::Error), +} +pub mod scheduled_actions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + filter: None, + } + } + pub fn list_by_scope(&self, scope: impl Into) -> list_by_scope::Builder { + list_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + } + } + pub fn get(&self, name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn create_or_update( + &self, + name: impl Into, + scheduled_action: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + name: name.into(), + scheduled_action: scheduled_action.into(), + } + } + pub fn delete(&self, name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_by_scope(&self, scope: impl Into, name: impl Into) -> get_by_scope::Builder { + get_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + name: name.into(), + } + } + pub fn create_or_update_by_scope( + &self, + scope: impl Into, + name: impl Into, + scheduled_action: impl Into, + ) -> create_or_update_by_scope::Builder { + create_or_update_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + name: name.into(), + scheduled_action: scheduled_action.into(), + } + } + pub fn delete_by_scope(&self, scope: impl Into, name: impl Into) -> delete_by_scope::Builder { + delete_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + name: name.into(), + } + } + pub fn execute(&self, name: impl Into) -> execute::Builder { + execute::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn execute_by_scope(&self, scope: impl Into, name: impl Into) -> execute_by_scope::Builder { + execute_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + name: name.into(), + } + } + pub fn check_name_availability( + &self, + check_name_availability_request: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + check_name_availability_request: check_name_availability_request.into(), + } + } + pub fn check_name_availability_by_scope( + &self, + scope: impl Into, + check_name_availability_request: impl Into, + ) -> check_name_availability_by_scope::Builder { + check_name_availability_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + check_name_availability_request: check_name_availability_request.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.CostManagement/scheduledActions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledActionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/scheduledActions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledActionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScheduledAction), + Created201(models::ScheduledAction), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) scheduled_action: models::ScheduledAction, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.scheduled_action).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.scope, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_by_scope { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScheduledAction), + Created201(models::ScheduledAction), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) name: String, + pub(crate) scheduled_action: models::ScheduledAction, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.scope, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.scheduled_action).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScheduledAction = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_scope { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/scheduledActions/{}", + self.client.endpoint(), + &self.scope, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod execute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/scheduledActions/{}/execute", + self.client.endpoint(), + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod execute_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/scheduledActions/{}/execute", + self.client.endpoint(), + &self.scope, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) check_name_availability_request: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/checkNameAvailability", + self.client.endpoint(), + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) check_name_availability_request: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/checkNameAvailability", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod views { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn list_by_scope(&self, scope: impl Into) -> list_by_scope::Builder { + list_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + } + } + pub fn get(&self, view_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + view_name: view_name.into(), + } + } + pub fn create_or_update(&self, view_name: impl Into, parameters: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + view_name: view_name.into(), + parameters: parameters.into(), + } + } + pub fn delete(&self, view_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + view_name: view_name.into(), + } + } + pub fn get_by_scope(&self, scope: impl Into, view_name: impl Into) -> get_by_scope::Builder { + get_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + view_name: view_name.into(), + } + } + pub fn create_or_update_by_scope( + &self, + scope: impl Into, + view_name: impl Into, + parameters: impl Into, + ) -> create_or_update_by_scope::Builder { + create_or_update_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + view_name: view_name.into(), + parameters: parameters.into(), + } + } + pub fn delete_by_scope(&self, scope: impl Into, view_name: impl Into) -> delete_by_scope::Builder { + delete_by_scope::Builder { + client: self.0.clone(), + scope: scope.into(), + view_name: view_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.CostManagement/views", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ViewListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/views", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ViewListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::View), + Created201(models::View), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) view_name: String, + pub(crate) parameters: models::View, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.scope, + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_by_scope { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::View), + Created201(models::View), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) view_name: String, + pub(crate) parameters: models::View, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.scope, + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::View = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_scope { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) view_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/views/{}", + self.client.endpoint(), + &self.scope, + &self.view_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod alerts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + } + } + pub fn get(&self, scope: impl Into, alert_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + alert_id: alert_id.into(), + } + } + pub fn dismiss( + &self, + scope: impl Into, + alert_id: impl Into, + parameters: impl Into, + ) -> dismiss::Builder { + dismiss::Builder { + client: self.0.clone(), + scope: scope.into(), + alert_id: alert_id.into(), + parameters: parameters.into(), + } + } + pub fn list_external( + &self, + external_cloud_provider_type: impl Into, + external_cloud_provider_id: impl Into, + ) -> list_external::Builder { + list_external::Builder { + client: self.0.clone(), + external_cloud_provider_type: external_cloud_provider_type.into(), + external_cloud_provider_id: external_cloud_provider_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/alerts", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) alert_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/alerts/{}", + self.client.endpoint(), + &self.scope, + &self.alert_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod dismiss { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) alert_id: String, + pub(crate) parameters: models::DismissAlertPayload, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/alerts/{}", + self.client.endpoint(), + &self.scope, + &self.alert_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_external { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) external_cloud_provider_type: String, + pub(crate) external_cloud_provider_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/{}/{}/alerts", + self.client.endpoint(), + &self.external_cloud_provider_type, + &self.external_cloud_provider_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod forecast { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn usage(&self, scope: impl Into, parameters: impl Into) -> usage::Builder { + usage::Builder { + client: self.0.clone(), + scope: scope.into(), + parameters: parameters.into(), + filter: None, + } + } + pub fn external_cloud_provider_usage( + &self, + external_cloud_provider_type: impl Into, + external_cloud_provider_id: impl Into, + parameters: impl Into, + ) -> external_cloud_provider_usage::Builder { + external_cloud_provider_usage::Builder { + client: self.0.clone(), + external_cloud_provider_type: external_cloud_provider_type.into(), + external_cloud_provider_id: external_cloud_provider_id.into(), + parameters: parameters.into(), + filter: None, + } + } + } + pub mod usage { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::QueryResult), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) parameters: models::ForecastDefinition, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/forecast", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod external_cloud_provider_usage { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) external_cloud_provider_type: String, + pub(crate) external_cloud_provider_id: String, + pub(crate) parameters: models::ForecastDefinition, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/{}/{}/forecast", + self.client.endpoint(), + &self.external_cloud_provider_type, + &self.external_cloud_provider_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod dimensions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + filter: None, + expand: None, + skiptoken: None, + top: None, + } + } + pub fn by_external_cloud_provider_type( + &self, + external_cloud_provider_type: impl Into, + external_cloud_provider_id: impl Into, + ) -> by_external_cloud_provider_type::Builder { + by_external_cloud_provider_type::Builder { + client: self.0.clone(), + external_cloud_provider_type: external_cloud_provider_type.into(), + external_cloud_provider_id: external_cloud_provider_id.into(), + filter: None, + expand: None, + skiptoken: None, + top: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DimensionsListResult), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) filter: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + pub(crate) top: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/dimensions", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DimensionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod by_external_cloud_provider_type { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) external_cloud_provider_type: String, + pub(crate) external_cloud_provider_id: String, + pub(crate) filter: Option, + pub(crate) expand: Option, + pub(crate) skiptoken: Option, + pub(crate) top: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn top(mut self, top: i32) -> Self { + self.top = Some(top); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/{}/{}/dimensions", + self.client.endpoint(), + &self.external_cloud_provider_type, + &self.external_cloud_provider_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DimensionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod query { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn usage(&self, scope: impl Into, parameters: impl Into) -> usage::Builder { + usage::Builder { + client: self.0.clone(), + scope: scope.into(), + parameters: parameters.into(), + } + } + pub fn usage_by_external_cloud_provider_type( + &self, + external_cloud_provider_type: impl Into, + external_cloud_provider_id: impl Into, + parameters: impl Into, + ) -> usage_by_external_cloud_provider_type::Builder { + usage_by_external_cloud_provider_type::Builder { + client: self.0.clone(), + external_cloud_provider_type: external_cloud_provider_type.into(), + external_cloud_provider_id: external_cloud_provider_id.into(), + parameters: parameters.into(), + } + } + } + pub mod usage { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::QueryResult), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) parameters: models::QueryDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/query", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod usage_by_external_cloud_provider_type { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) external_cloud_provider_type: String, + pub(crate) external_cloud_provider_id: String, + pub(crate) parameters: models::QueryDefinition, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.CostManagement/{}/{}/query", + self.client.endpoint(), + &self.external_cloud_provider_type, + &self.external_cloud_provider_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod generate_reservation_details_report { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn by_billing_account_id( + &self, + billing_account_id: impl Into, + start_date: impl Into, + end_date: impl Into, + ) -> by_billing_account_id::Builder { + by_billing_account_id::Builder { + client: self.0.clone(), + billing_account_id: billing_account_id.into(), + start_date: start_date.into(), + end_date: end_date.into(), + } + } + pub fn by_billing_profile_id( + &self, + billing_account_id: impl Into, + billing_profile_id: impl Into, + start_date: impl Into, + end_date: impl Into, + ) -> by_billing_profile_id::Builder { + by_billing_profile_id::Builder { + client: self.0.clone(), + billing_account_id: billing_account_id.into(), + billing_profile_id: billing_profile_id.into(), + start_date: start_date.into(), + end_date: end_date.into(), + } + } + } + pub mod by_billing_account_id { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_id: String, + pub(crate) start_date: String, + pub(crate) end_date: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/providers/Microsoft.CostManagement/generateReservationDetailsReport" , self . client . endpoint () , & self . billing_account_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let start_date = &self.start_date; + url.query_pairs_mut().append_pair("startDate", start_date); + let end_date = &self.end_date; + url.query_pairs_mut().append_pair("endDate", end_date); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod by_billing_profile_id { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_id: String, + pub(crate) billing_profile_id: String, + pub(crate) start_date: String, + pub(crate) end_date: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/providers/Microsoft.CostManagement/generateReservationDetailsReport" , self . client . endpoint () , & self . billing_account_id , & self . billing_profile_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let start_date = &self.start_date; + url.query_pairs_mut().append_pair("startDate", start_date); + let end_date = &self.end_date; + url.query_pairs_mut().append_pair("endDate", end_date); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.CostManagement/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod exports { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, scope: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + scope: scope.into(), + expand: None, + } + } + pub fn get(&self, scope: impl Into, export_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scope: scope.into(), + export_name: export_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + scope: impl Into, + export_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scope: scope.into(), + export_name: export_name.into(), + parameters: parameters.into(), + } + } + pub fn delete(&self, scope: impl Into, export_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scope: scope.into(), + export_name: export_name.into(), + } + } + pub fn execute(&self, scope: impl Into, export_name: impl Into) -> execute::Builder { + execute::Builder { + client: self.0.clone(), + scope: scope.into(), + export_name: export_name.into(), + } + } + pub fn get_execution_history(&self, scope: impl Into, export_name: impl Into) -> get_execution_history::Builder { + get_execution_history::Builder { + client: self.0.clone(), + scope: scope.into(), + export_name: export_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports", + self.client.endpoint(), + &self.scope + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) export_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports/{}", + self.client.endpoint(), + &self.scope, + &self.export_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Export), + Created201(models::Export), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) export_name: String, + pub(crate) parameters: models::Export, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports/{}", + self.client.endpoint(), + &self.scope, + &self.export_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) export_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports/{}", + self.client.endpoint(), + &self.scope, + &self.export_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod execute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) export_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports/{}/run", + self.client.endpoint(), + &self.scope, + &self.export_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_execution_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scope: String, + pub(crate) export_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.CostManagement/exports/{}/runHistory", + self.client.endpoint(), + &self.scope, + &self.export_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportExecutionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/cpim/Cargo.toml b/services/mgmt/cpim/Cargo.toml index ae2abc439a..ff32c73357 100644 --- a/services/mgmt/cpim/Cargo.toml +++ b/services/mgmt/cpim/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_cpim" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/customerinsights/Cargo.toml b/services/mgmt/customerinsights/Cargo.toml index 7a9cd82fa7..c8abfac669 100644 --- a/services/mgmt/customerinsights/Cargo.toml +++ b/services/mgmt/customerinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_customerinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/customerlockbox/Cargo.toml b/services/mgmt/customerlockbox/Cargo.toml index 9284d967a4..515350c048 100644 --- a/services/mgmt/customerlockbox/Cargo.toml +++ b/services/mgmt/customerlockbox/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_customerlockbox" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/customproviders/Cargo.toml b/services/mgmt/customproviders/Cargo.toml index 127b75027a..57010c1bed 100644 --- a/services/mgmt/customproviders/Cargo.toml +++ b/services/mgmt/customproviders/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_customproviders" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dashboard/Cargo.toml b/services/mgmt/dashboard/Cargo.toml index 0a5e70f046..3d58fb594f 100644 --- a/services/mgmt/dashboard/Cargo.toml +++ b/services/mgmt/dashboard/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_dashboard" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dashboard/src/package_2021_09_01_preview/models.rs b/services/mgmt/dashboard/src/package_2021_09_01_preview/models.rs index 1751866cd8..8418e85515 100644 --- a/services/mgmt/dashboard/src/package_2021_09_01_preview/models.rs +++ b/services/mgmt/dashboard/src/package_2021_09_01_preview/models.rs @@ -7,6 +7,10 @@ use serde::{Deserialize, Serialize}; pub enum ActionType { Internal, } +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AutoGeneratedDomainNameLabelScope { + TenantReuse, +} #[doc = "The type of identity that created the resource."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum CreatedByType { @@ -132,6 +136,8 @@ pub struct ManagedGrafanaProperties { pub endpoint: Option, #[serde(rename = "zoneRedundancy", default, skip_serializing_if = "Option::is_none")] pub zone_redundancy: Option, + #[serde(rename = "autoGeneratedDomainNameLabelScope", default, skip_serializing_if = "Option::is_none")] + pub auto_generated_domain_name_label_scope: Option, } impl ManagedGrafanaProperties { pub fn new() -> Self { diff --git a/services/mgmt/data/Cargo.toml b/services/mgmt/data/Cargo.toml index 64fffa7d2a..c67a28a1af 100644 --- a/services/mgmt/data/Cargo.toml +++ b/services/mgmt/data/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_data" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/databox/Cargo.toml b/services/mgmt/databox/Cargo.toml index 6b66318f77..ffd7928aa7 100644 --- a/services/mgmt/databox/Cargo.toml +++ b/services/mgmt/databox/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_databox" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-08-preview", "package-2021-05", "package-2021-03", "package-2020-11"] +features = ["no-default-tag", "package-2021-12", "package-2021-08-preview", "package-2021-05", "package-2021-03"] [features] -default = ["package-2021-12", "enable_reqwest"] +default = ["package-2022-02", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-02" = [] "package-2021-12" = [] "package-2021-08-preview" = [] "package-2021-05" = [] diff --git a/services/mgmt/databox/README.md b/services/mgmt/databox/README.md index 04bca60690..eaa39a3d4f 100644 --- a/services/mgmt/databox/README.md +++ b/services/mgmt/databox/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/databox/re To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2021-12`. +The default tag is `package-2022-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-02` has 18 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. - `package-2021-12` has 18 operations from 1 API versions: `2021-12-01`. Use crate feature `package-2021-12` to enable. The operations will be in the `package_2021_12` module. - `package-2021-08-preview` has 18 operations from 1 API versions: `2021-08-01-preview`. Use crate feature `package-2021-08-preview` to enable. The operations will be in the `package_2021_08_preview` module. - `package-2021-05` has 17 operations from 1 API versions: `2021-05-01`. Use crate feature `package-2021-05` to enable. The operations will be in the `package_2021_05` module. diff --git a/services/mgmt/databox/src/lib.rs b/services/mgmt/databox/src/lib.rs index d262f77ab7..d5ac13c690 100644 --- a/services/mgmt/databox/src/lib.rs +++ b/services/mgmt/databox/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-02")] +pub mod package_2022_02; +#[cfg(all(feature = "package-2022-02", not(feature = "no-default-tag")))] +pub use package_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-12")] pub mod package_2021_12; #[cfg(all(feature = "package-2021-12", not(feature = "no-default-tag")))] diff --git a/services/mgmt/databox/src/package_2022_02/mod.rs b/services/mgmt/databox/src/package_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/databox/src/package_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/databox/src/package_2022_02/models.rs b/services/mgmt/databox/src/package_2022_02/models.rs new file mode 100644 index 0000000000..4d76c841b9 --- /dev/null +++ b/services/mgmt/databox/src/package_2022_02/models.rs @@ -0,0 +1,3510 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Credential details of the account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccountCredentialDetails { + #[doc = "Name of the account."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "Type of the account."] + #[serde(rename = "dataAccountType", default, skip_serializing_if = "Option::is_none")] + pub data_account_type: Option, + #[doc = "Connection string of the account endpoint to use the account as a storage endpoint on the device."] + #[serde(rename = "accountConnectionString", default, skip_serializing_if = "Option::is_none")] + pub account_connection_string: Option, + #[doc = "Per share level unencrypted access credentials."] + #[serde(rename = "shareCredentialDetails", default, skip_serializing_if = "Vec::is_empty")] + pub share_credential_details: Vec, +} +impl AccountCredentialDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod account_credential_details { + use super::*; + #[doc = "Type of the account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } +} +#[doc = "This class represents additional info which Resource Providers pass when an error occurs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdditionalErrorInfo { + #[doc = "Additional information of the type of error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "Type of error (e.g. CustomerIntervention, PolicyViolation, SecurityViolation)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AdditionalErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Output of the address validation api."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddressValidationOutput { + #[doc = "The address validation output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AddressValidationOutput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The address validation output."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddressValidationProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "The address validation status."] + #[serde(rename = "validationStatus", default, skip_serializing_if = "Option::is_none")] + pub validation_status: Option, + #[doc = "List of alternate addresses."] + #[serde(rename = "alternateAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub alternate_addresses: Vec, +} +impl AddressValidationProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + validation_status: None, + alternate_addresses: Vec::new(), + } + } +} +pub mod address_validation_properties { + use super::*; + #[doc = "The address validation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationStatus { + Valid, + Invalid, + Ambiguous, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiError { + pub error: ErrorDetail, +} +impl ApiError { + pub fn new(error: ErrorDetail) -> Self { + Self { error } + } +} +#[doc = "The Network Adapter configuration of a DataBox."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplianceNetworkConfiguration { + #[doc = "Name of the network."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Mac Address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, +} +impl ApplianceNetworkConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for all objects under resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArmBaseObject { + #[doc = "Name of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Id of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ArmBaseObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The filters for showing the available skus."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableSkuRequest { + #[doc = "Type of the transfer."] + #[serde(rename = "transferType")] + pub transfer_type: available_sku_request::TransferType, + #[doc = "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"] + pub country: String, + #[doc = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01"] + pub location: String, + #[doc = "Sku Names to filter for available skus"] + #[serde(rename = "skuNames", default, skip_serializing_if = "Vec::is_empty")] + pub sku_names: Vec, +} +impl AvailableSkuRequest { + pub fn new(transfer_type: available_sku_request::TransferType, country: String, location: String) -> Self { + Self { + transfer_type, + country, + location, + sku_names: Vec::new(), + } + } +} +pub mod available_sku_request { + use super::*; + #[doc = "Type of the transfer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } +} +#[doc = "The available skus operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableSkusResult { + #[doc = "List of available skus."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link for the next set of skus."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailableSkusResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Filter details to transfer Azure files"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileFilterDetails { + #[doc = "Prefix list of the Azure files to be transferred."] + #[serde(rename = "filePrefixList", default, skip_serializing_if = "Vec::is_empty")] + pub file_prefix_list: Vec, + #[doc = "List of full path of the files to be transferred."] + #[serde(rename = "filePathList", default, skip_serializing_if = "Vec::is_empty")] + pub file_path_list: Vec, + #[doc = "List of file shares to be transferred."] + #[serde(rename = "fileShareList", default, skip_serializing_if = "Vec::is_empty")] + pub file_share_list: Vec, +} +impl AzureFileFilterDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Filter details to transfer Azure Blobs"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BlobFilterDetails { + #[doc = "Prefix list of the Azure blobs to be transferred."] + #[serde(rename = "blobPrefixList", default, skip_serializing_if = "Vec::is_empty")] + pub blob_prefix_list: Vec, + #[doc = "List of full path of the blobs to be transferred."] + #[serde(rename = "blobPathList", default, skip_serializing_if = "Vec::is_empty")] + pub blob_path_list: Vec, + #[doc = "List of blob containers to be transferred."] + #[serde(rename = "containerList", default, skip_serializing_if = "Vec::is_empty")] + pub container_list: Vec, +} +impl BlobFilterDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reason for cancellation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CancellationReason { + #[doc = "Reason for cancellation."] + pub reason: String, +} +impl CancellationReason { + pub fn new(reason: String) -> Self { + Self { reason } + } +} +#[doc = "Provides additional information about an http error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "Gets or sets additional error info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Gets or sets details for the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error message parsed from the body of the http error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Gets or sets the target of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contact Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactDetails { + #[doc = "Contact name of the person."] + #[serde(rename = "contactName")] + pub contact_name: String, + #[doc = "Phone number of the contact person."] + pub phone: String, + #[doc = "Phone extension number of the contact person."] + #[serde(rename = "phoneExtension", default, skip_serializing_if = "Option::is_none")] + pub phone_extension: Option, + #[doc = "Mobile number of the contact person."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mobile: Option, + #[doc = "List of Email-ids to be notified about job progress."] + #[serde(rename = "emailList")] + pub email_list: Vec, + #[doc = "Notification preference for a job stage."] + #[serde(rename = "notificationPreference", default, skip_serializing_if = "Vec::is_empty")] + pub notification_preference: Vec, +} +impl ContactDetails { + pub fn new(contact_name: String, phone: String, email_list: Vec) -> Self { + Self { + contact_name, + phone, + phone_extension: None, + mobile: None, + email_list, + notification_preference: Vec::new(), + } + } +} +#[doc = "Details for log generated during copy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyLogDetails { + #[doc = "Indicates the type of job details."] + #[serde(rename = "copyLogDetailsType")] + pub copy_log_details_type: copy_log_details::CopyLogDetailsType, +} +impl CopyLogDetails { + pub fn new(copy_log_details_type: copy_log_details::CopyLogDetailsType) -> Self { + Self { copy_log_details_type } + } +} +pub mod copy_log_details { + use super::*; + #[doc = "Indicates the type of job details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyLogDetailsType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Copy progress."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CopyProgress { + #[doc = "Name of the storage account. This will be empty for data account types other than storage account."] + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[doc = "Transfer type of data"] + #[serde(rename = "transferType", default, skip_serializing_if = "Option::is_none")] + pub transfer_type: Option, + #[doc = "Data Account Type."] + #[serde(rename = "dataAccountType", default, skip_serializing_if = "Option::is_none")] + pub data_account_type: Option, + #[doc = "Id of the account where the data needs to be uploaded."] + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[doc = "To indicate bytes transferred."] + #[serde(rename = "bytesProcessed", default, skip_serializing_if = "Option::is_none")] + pub bytes_processed: Option, + #[doc = "Total amount of data to be processed by the job."] + #[serde(rename = "totalBytesToProcess", default, skip_serializing_if = "Option::is_none")] + pub total_bytes_to_process: Option, + #[doc = "Number of files processed"] + #[serde(rename = "filesProcessed", default, skip_serializing_if = "Option::is_none")] + pub files_processed: Option, + #[doc = "Total files to process"] + #[serde(rename = "totalFilesToProcess", default, skip_serializing_if = "Option::is_none")] + pub total_files_to_process: Option, + #[doc = "Number of files not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "invalidFilesProcessed", default, skip_serializing_if = "Option::is_none")] + pub invalid_files_processed: Option, + #[doc = "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "invalidFileBytesUploaded", default, skip_serializing_if = "Option::is_none")] + pub invalid_file_bytes_uploaded: Option, + #[doc = "Number of folders not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "renamedContainerCount", default, skip_serializing_if = "Option::is_none")] + pub renamed_container_count: Option, + #[doc = "Number of files which could not be copied"] + #[serde(rename = "filesErroredOut", default, skip_serializing_if = "Option::is_none")] + pub files_errored_out: Option, + #[doc = "To indicate directories errored out in the job."] + #[serde(rename = "directoriesErroredOut", default, skip_serializing_if = "Option::is_none")] + pub directories_errored_out: Option, + #[doc = "To indicate directories renamed"] + #[serde(rename = "invalidDirectoriesProcessed", default, skip_serializing_if = "Option::is_none")] + pub invalid_directories_processed: Option, + #[doc = "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid."] + #[serde(rename = "isEnumerationInProgress", default, skip_serializing_if = "Option::is_none")] + pub is_enumeration_in_progress: Option, +} +impl CopyProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod copy_progress { + use super::*; + #[doc = "Transfer type of data"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } + #[doc = "Data Account Type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } +} +#[doc = "It does all pre-job creation validations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateJobValidations { + #[serde(flatten)] + pub validation_request: ValidationRequest, +} +impl CreateJobValidations { + pub fn new(validation_request: ValidationRequest) -> Self { + Self { validation_request } + } +} +#[doc = "Request to validate create order limit for current subscription."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateOrderLimitForSubscriptionValidationRequest { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, + #[doc = "Device type to be used for the job."] + #[serde(rename = "deviceType")] + pub device_type: create_order_limit_for_subscription_validation_request::DeviceType, +} +impl CreateOrderLimitForSubscriptionValidationRequest { + pub fn new( + validation_input_request: ValidationInputRequest, + device_type: create_order_limit_for_subscription_validation_request::DeviceType, + ) -> Self { + Self { + validation_input_request, + device_type, + } + } +} +pub mod create_order_limit_for_subscription_validation_request { + use super::*; + #[doc = "Device type to be used for the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Properties of create order limit for subscription validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateOrderLimitForSubscriptionValidationResponseProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "Create order limit validation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl CreateOrderLimitForSubscriptionValidationResponseProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + status: None, + } + } +} +pub mod create_order_limit_for_subscription_validation_response_properties { + use super::*; + #[doc = "Create order limit validation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + Skipped, + } +} +#[doc = "The secrets related to customer disk job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomerDiskJobSecrets { + #[serde(flatten)] + pub job_secrets: JobSecrets, + #[doc = "Contains the list of secrets object for that device."] + #[serde(rename = "diskSecrets", default, skip_serializing_if = "Vec::is_empty")] + pub disk_secrets: Vec, + #[doc = "Carrier Account Number of the customer"] + #[serde(rename = "carrierAccountNumber", default, skip_serializing_if = "Option::is_none")] + pub carrier_account_number: Option, +} +impl CustomerDiskJobSecrets { + pub fn new(job_secrets: JobSecrets) -> Self { + Self { + job_secrets, + disk_secrets: Vec::new(), + carrier_account_number: None, + } + } +} +#[doc = "Account details of the data to be transferred"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataAccountDetails { + #[doc = "Account Type of the data to be transferred."] + #[serde(rename = "dataAccountType")] + pub data_account_type: data_account_details::DataAccountType, + #[doc = "Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+"] + #[serde(rename = "sharePassword", default, skip_serializing_if = "Option::is_none")] + pub share_password: Option, +} +impl DataAccountDetails { + pub fn new(data_account_type: data_account_details::DataAccountType) -> Self { + Self { + data_account_type, + share_password: None, + } + } +} +pub mod data_account_details { + use super::*; + #[doc = "Account Type of the data to be transferred."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } + impl Default for DataAccountType { + fn default() -> Self { + Self::StorageAccount + } + } +} +#[doc = "Copy log details for a storage account of a DataBox job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxAccountCopyLogDetails { + #[serde(flatten)] + pub copy_log_details: CopyLogDetails, + #[doc = "Account name."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "Link for copy logs."] + #[serde(rename = "copyLogLink", default, skip_serializing_if = "Option::is_none")] + pub copy_log_link: Option, + #[doc = "Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose."] + #[serde(rename = "copyVerboseLogLink", default, skip_serializing_if = "Option::is_none")] + pub copy_verbose_log_link: Option, +} +impl DataBoxAccountCopyLogDetails { + pub fn new(copy_log_details: CopyLogDetails) -> Self { + Self { + copy_log_details, + account_name: None, + copy_log_link: None, + copy_verbose_log_link: None, + } + } +} +#[doc = "Copy Log Details for customer disk"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxCustomerDiskCopyLogDetails { + #[serde(flatten)] + pub copy_log_details: CopyLogDetails, + #[doc = "Disk Serial Number."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "Link for copy error logs."] + #[serde(rename = "errorLogLink", default, skip_serializing_if = "Option::is_none")] + pub error_log_link: Option, + #[doc = "Link for copy verbose logs."] + #[serde(rename = "verboseLogLink", default, skip_serializing_if = "Option::is_none")] + pub verbose_log_link: Option, +} +impl DataBoxCustomerDiskCopyLogDetails { + pub fn new(copy_log_details: CopyLogDetails) -> Self { + Self { + copy_log_details, + serial_number: None, + error_log_link: None, + verbose_log_link: None, + } + } +} +#[doc = "DataBox CustomerDisk Copy Progress"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxCustomerDiskCopyProgress { + #[serde(flatten)] + pub copy_progress: CopyProgress, + #[doc = "Disk Serial Number."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "The Status of the copy"] + #[serde(rename = "copyStatus", default, skip_serializing_if = "Option::is_none")] + pub copy_status: Option, +} +impl DataBoxCustomerDiskCopyProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_customer_disk_copy_progress { + use super::*; + #[doc = "The Status of the copy"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyStatus { + NotStarted, + InProgress, + Completed, + CompletedWithErrors, + Failed, + NotReturned, + HardwareError, + DeviceFormatted, + DeviceMetadataModified, + StorageAccountNotAccessible, + UnsupportedData, + DriveNotReceived, + UnsupportedDrive, + OtherServiceError, + OtherUserError, + DriveNotDetected, + DriveCorrupted, + MetadataFilesModifiedOrRemoved, + } +} +#[doc = "Customer disk job details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxCustomerDiskJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "Contains the map of disk serial number to the disk details for import jobs."] + #[serde(rename = "importDiskDetailsCollection", default, skip_serializing_if = "Option::is_none")] + pub import_disk_details_collection: Option, + #[doc = "Contains the map of disk serial number to the disk details for export jobs."] + #[serde(rename = "exportDiskDetailsCollection", default, skip_serializing_if = "Option::is_none")] + pub export_disk_details_collection: Option, + #[doc = "Copy progress per disk."] + #[serde(rename = "copyProgress", default, skip_serializing_if = "Vec::is_empty")] + pub copy_progress: Vec, + #[doc = "package carrier info"] + #[serde(rename = "deliverToDcPackageDetails", default, skip_serializing_if = "Option::is_none")] + pub deliver_to_dc_package_details: Option, + #[doc = "Package carrier details."] + #[serde(rename = "returnToCustomerPackageDetails")] + pub return_to_customer_package_details: PackageCarrierDetails, + #[doc = "Flag to indicate if disk manifest should be backed-up in the Storage Account."] + #[serde(rename = "enableManifestBackup", default, skip_serializing_if = "Option::is_none")] + pub enable_manifest_backup: Option, +} +impl DataBoxCustomerDiskJobDetails { + pub fn new(job_details: JobDetails, return_to_customer_package_details: PackageCarrierDetails) -> Self { + Self { + job_details, + import_disk_details_collection: None, + export_disk_details_collection: None, + copy_progress: Vec::new(), + deliver_to_dc_package_details: None, + return_to_customer_package_details, + enable_manifest_backup: None, + } + } +} +#[doc = "Copy Log Details for a disk"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxDiskCopyLogDetails { + #[serde(flatten)] + pub copy_log_details: CopyLogDetails, + #[doc = "Disk Serial Number."] + #[serde(rename = "diskSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub disk_serial_number: Option, + #[doc = "Link for copy error logs."] + #[serde(rename = "errorLogLink", default, skip_serializing_if = "Option::is_none")] + pub error_log_link: Option, + #[doc = "Link for copy verbose logs."] + #[serde(rename = "verboseLogLink", default, skip_serializing_if = "Option::is_none")] + pub verbose_log_link: Option, +} +impl DataBoxDiskCopyLogDetails { + pub fn new(copy_log_details: CopyLogDetails) -> Self { + Self { + copy_log_details, + disk_serial_number: None, + error_log_link: None, + verbose_log_link: None, + } + } +} +#[doc = "DataBox Disk Copy Progress"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxDiskCopyProgress { + #[doc = "The serial number of the disk"] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "Bytes copied during the copy of disk."] + #[serde(rename = "bytesCopied", default, skip_serializing_if = "Option::is_none")] + pub bytes_copied: Option, + #[doc = "Indicates the percentage completed for the copy of the disk."] + #[serde(rename = "percentComplete", default, skip_serializing_if = "Option::is_none")] + pub percent_complete: Option, + #[doc = "The Status of the copy"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl DataBoxDiskCopyProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_disk_copy_progress { + use super::*; + #[doc = "The Status of the copy"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + NotStarted, + InProgress, + Completed, + CompletedWithErrors, + Failed, + NotReturned, + HardwareError, + DeviceFormatted, + DeviceMetadataModified, + StorageAccountNotAccessible, + UnsupportedData, + DriveNotReceived, + UnsupportedDrive, + OtherServiceError, + OtherUserError, + DriveNotDetected, + DriveCorrupted, + MetadataFilesModifiedOrRemoved, + } +} +#[doc = "Granular Copy Log Details for customer disk"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxDiskGranularCopyLogDetails { + #[serde(flatten)] + pub granular_copy_log_details: GranularCopyLogDetails, + #[doc = "Disk Serial Number."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "Account name."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "Link for copy error logs."] + #[serde(rename = "errorLogLink", default, skip_serializing_if = "Option::is_none")] + pub error_log_link: Option, + #[doc = "Link for copy verbose logs."] + #[serde(rename = "verboseLogLink", default, skip_serializing_if = "Option::is_none")] + pub verbose_log_link: Option, +} +impl DataBoxDiskGranularCopyLogDetails { + pub fn new(granular_copy_log_details: GranularCopyLogDetails) -> Self { + Self { + granular_copy_log_details, + serial_number: None, + account_name: None, + error_log_link: None, + verbose_log_link: None, + } + } +} +#[doc = "DataBox Disk Granular Copy Progress"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxDiskGranularCopyProgress { + #[serde(flatten)] + pub granular_copy_progress: GranularCopyProgress, + #[doc = "Disk Serial Number."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "The Status of the copy"] + #[serde(rename = "copyStatus", default, skip_serializing_if = "Option::is_none")] + pub copy_status: Option, +} +impl DataBoxDiskGranularCopyProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_disk_granular_copy_progress { + use super::*; + #[doc = "The Status of the copy"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyStatus { + NotStarted, + InProgress, + Completed, + CompletedWithErrors, + Failed, + NotReturned, + HardwareError, + DeviceFormatted, + DeviceMetadataModified, + StorageAccountNotAccessible, + UnsupportedData, + DriveNotReceived, + UnsupportedDrive, + OtherServiceError, + OtherUserError, + DriveNotDetected, + DriveCorrupted, + MetadataFilesModifiedOrRemoved, + } +} +#[doc = "DataBox Disk Job Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxDiskJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int."] + #[serde(rename = "preferredDisks", default, skip_serializing_if = "Option::is_none")] + pub preferred_disks: Option, + #[doc = "Copy progress per disk."] + #[serde(rename = "copyProgress", default, skip_serializing_if = "Vec::is_empty")] + pub copy_progress: Vec, + #[doc = "Copy progress per disk."] + #[serde(rename = "granularCopyProgress", default, skip_serializing_if = "Vec::is_empty")] + pub granular_copy_progress: Vec, + #[doc = "Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer."] + #[serde(rename = "disksAndSizeDetails", default, skip_serializing_if = "Option::is_none")] + pub disks_and_size_details: Option, + #[doc = "User entered passkey for DataBox Disk job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub passkey: Option, +} +impl DataBoxDiskJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + preferred_disks: None, + copy_progress: Vec::new(), + granular_copy_progress: Vec::new(), + disks_and_size_details: None, + passkey: None, + } + } +} +#[doc = "The secrets related to disk job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxDiskJobSecrets { + #[serde(flatten)] + pub job_secrets: JobSecrets, + #[doc = "Contains the list of secrets object for that device."] + #[serde(rename = "diskSecrets", default, skip_serializing_if = "Vec::is_empty")] + pub disk_secrets: Vec, + #[doc = "PassKey for the disk Job."] + #[serde(rename = "passKey", default, skip_serializing_if = "Option::is_none")] + pub pass_key: Option, + #[doc = "Whether passkey was provided by user."] + #[serde(rename = "isPasskeyUserDefined", default, skip_serializing_if = "Option::is_none")] + pub is_passkey_user_defined: Option, +} +impl DataBoxDiskJobSecrets { + pub fn new(job_secrets: JobSecrets) -> Self { + Self { + job_secrets, + disk_secrets: Vec::new(), + pass_key: None, + is_passkey_user_defined: None, + } + } +} +#[doc = "Copy log details for a storage account for Databox heavy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxHeavyAccountCopyLogDetails { + #[serde(flatten)] + pub copy_log_details: CopyLogDetails, + #[doc = "Account name."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "Link for copy logs."] + #[serde(rename = "copyLogLink", default, skip_serializing_if = "Vec::is_empty")] + pub copy_log_link: Vec, + #[doc = "Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose."] + #[serde(rename = "copyVerboseLogLink", default, skip_serializing_if = "Vec::is_empty")] + pub copy_verbose_log_link: Vec, +} +impl DataBoxHeavyAccountCopyLogDetails { + pub fn new(copy_log_details: CopyLogDetails) -> Self { + Self { + copy_log_details, + account_name: None, + copy_log_link: Vec::new(), + copy_verbose_log_link: Vec::new(), + } + } +} +#[doc = "Databox Heavy Device Job Details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxHeavyJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "Copy progress per account."] + #[serde(rename = "copyProgress", default, skip_serializing_if = "Vec::is_empty")] + pub copy_progress: Vec, + #[doc = "Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+"] + #[serde(rename = "devicePassword", default, skip_serializing_if = "Option::is_none")] + pub device_password: Option, +} +impl DataBoxHeavyJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + copy_progress: Vec::new(), + device_password: None, + } + } +} +#[doc = "The secrets related to a databox heavy job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxHeavyJobSecrets { + #[serde(flatten)] + pub job_secrets: JobSecrets, + #[doc = "Contains the list of secret objects for a databox heavy job."] + #[serde(rename = "cabinetPodSecrets", default, skip_serializing_if = "Vec::is_empty")] + pub cabinet_pod_secrets: Vec, +} +impl DataBoxHeavyJobSecrets { + pub fn new(job_secrets: JobSecrets) -> Self { + Self { + job_secrets, + cabinet_pod_secrets: Vec::new(), + } + } +} +#[doc = "The secrets related to a databox heavy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxHeavySecret { + #[doc = "Serial number of the assigned device."] + #[serde(rename = "deviceSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub device_serial_number: Option, + #[doc = "Password for out of the box experience on device."] + #[serde(rename = "devicePassword", default, skip_serializing_if = "Option::is_none")] + pub device_password: Option, + #[doc = "Network configuration of the appliance."] + #[serde(rename = "networkConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_configurations: Vec, + #[doc = "The base 64 encoded public key to authenticate with the device"] + #[serde(rename = "encodedValidationCertPubKey", default, skip_serializing_if = "Option::is_none")] + pub encoded_validation_cert_pub_key: Option, + #[doc = "Per account level access credentials."] + #[serde(rename = "accountCredentialDetails", default, skip_serializing_if = "Vec::is_empty")] + pub account_credential_details: Vec, +} +impl DataBoxHeavySecret { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Databox Job Details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "Copy progress per storage account."] + #[serde(rename = "copyProgress", default, skip_serializing_if = "Vec::is_empty")] + pub copy_progress: Vec, + #[doc = "Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\\-$%^!+=;:_()]+"] + #[serde(rename = "devicePassword", default, skip_serializing_if = "Option::is_none")] + pub device_password: Option, +} +impl DataBoxJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + copy_progress: Vec::new(), + device_password: None, + } + } +} +#[doc = "Request body to get the availability for scheduling data box orders orders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxScheduleAvailabilityRequest { + #[serde(flatten)] + pub schedule_availability_request: ScheduleAvailabilityRequest, +} +impl DataBoxScheduleAvailabilityRequest { + pub fn new(schedule_availability_request: ScheduleAvailabilityRequest) -> Self { + Self { + schedule_availability_request, + } + } +} +#[doc = "The secrets related to a DataBox."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxSecret { + #[doc = "Serial number of the assigned device."] + #[serde(rename = "deviceSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub device_serial_number: Option, + #[doc = "Password for out of the box experience on device."] + #[serde(rename = "devicePassword", default, skip_serializing_if = "Option::is_none")] + pub device_password: Option, + #[doc = "Network configuration of the appliance."] + #[serde(rename = "networkConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_configurations: Vec, + #[doc = "The base 64 encoded public key to authenticate with the device"] + #[serde(rename = "encodedValidationCertPubKey", default, skip_serializing_if = "Option::is_none")] + pub encoded_validation_cert_pub_key: Option, + #[doc = "Per account level access credentials."] + #[serde(rename = "accountCredentialDetails", default, skip_serializing_if = "Vec::is_empty")] + pub account_credential_details: Vec, +} +impl DataBoxSecret { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of the data to be used for exporting data from azure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataExportDetails { + #[doc = "Configuration for defining the transfer of data."] + #[serde(rename = "transferConfiguration")] + pub transfer_configuration: TransferConfiguration, + #[doc = "Level of the logs to be collected."] + #[serde(rename = "logCollectionLevel", default, skip_serializing_if = "Option::is_none")] + pub log_collection_level: Option, + #[doc = "Account details of the data to be transferred"] + #[serde(rename = "accountDetails")] + pub account_details: DataAccountDetails, +} +impl DataExportDetails { + pub fn new(transfer_configuration: TransferConfiguration, account_details: DataAccountDetails) -> Self { + Self { + transfer_configuration, + log_collection_level: None, + account_details, + } + } +} +pub mod data_export_details { + use super::*; + #[doc = "Level of the logs to be collected."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LogCollectionLevel { + Error, + Verbose, + } + impl Default for LogCollectionLevel { + fn default() -> Self { + Self::Error + } + } +} +#[doc = "Details of the data to be used for importing data to azure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataImportDetails { + #[doc = "Account details of the data to be transferred"] + #[serde(rename = "accountDetails")] + pub account_details: DataAccountDetails, + #[doc = "Level of the logs to be collected."] + #[serde(rename = "logCollectionLevel", default, skip_serializing_if = "Option::is_none")] + pub log_collection_level: Option, +} +impl DataImportDetails { + pub fn new(account_details: DataAccountDetails) -> Self { + Self { + account_details, + log_collection_level: None, + } + } +} +pub mod data_import_details { + use super::*; + #[doc = "Level of the logs to be collected."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LogCollectionLevel { + Error, + Verbose, + } + impl Default for LogCollectionLevel { + fn default() -> Self { + Self::Error + } + } +} +#[doc = "Map of data location to service location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataLocationToServiceLocationMap { + #[doc = "Location of the data."] + #[serde(rename = "dataLocation", default, skip_serializing_if = "Option::is_none")] + pub data_location: Option, + #[doc = "Location of the service."] + #[serde(rename = "serviceLocation", default, skip_serializing_if = "Option::is_none")] + pub service_location: Option, +} +impl DataLocationToServiceLocationMap { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request to validate export and import data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataTransferDetailsValidationRequest { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, + #[doc = "List of DataTransfer details to be used to export data from azure."] + #[serde(rename = "dataExportDetails", default, skip_serializing_if = "Vec::is_empty")] + pub data_export_details: Vec, + #[doc = "List of DataTransfer details to be used to import data to azure."] + #[serde(rename = "dataImportDetails", default, skip_serializing_if = "Vec::is_empty")] + pub data_import_details: Vec, + #[doc = "Device type."] + #[serde(rename = "deviceType")] + pub device_type: data_transfer_details_validation_request::DeviceType, + #[doc = "Type of the transfer."] + #[serde(rename = "transferType")] + pub transfer_type: data_transfer_details_validation_request::TransferType, +} +impl DataTransferDetailsValidationRequest { + pub fn new( + validation_input_request: ValidationInputRequest, + device_type: data_transfer_details_validation_request::DeviceType, + transfer_type: data_transfer_details_validation_request::TransferType, + ) -> Self { + Self { + validation_input_request, + data_export_details: Vec::new(), + data_import_details: Vec::new(), + device_type, + transfer_type, + } + } +} +pub mod data_transfer_details_validation_request { + use super::*; + #[doc = "Device type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } + #[doc = "Type of the transfer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } +} +#[doc = "Properties of data transfer details validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataTransferDetailsValidationResponseProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "Data transfer details validation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl DataTransferDetailsValidationResponseProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + status: None, + } + } +} +pub mod data_transfer_details_validation_response_properties { + use super::*; + #[doc = "Data transfer details validation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + Skipped, + } +} +#[doc = "The secrets related to a databox job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataboxJobSecrets { + #[serde(flatten)] + pub job_secrets: JobSecrets, + #[doc = "Contains the list of secret objects for a job."] + #[serde(rename = "podSecrets", default, skip_serializing_if = "Vec::is_empty")] + pub pod_secrets: Vec, +} +impl DataboxJobSecrets { + pub fn new(job_secrets: JobSecrets) -> Self { + Self { + job_secrets, + pod_secrets: Vec::new(), + } + } +} +#[doc = "Datacenter instruction for given storage location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatacenterAddressInstructionResponse { + #[serde(flatten)] + pub datacenter_address_response: DatacenterAddressResponse, + #[doc = "Data center communication instruction"] + #[serde(rename = "communicationInstruction", default, skip_serializing_if = "Option::is_none")] + pub communication_instruction: Option, +} +impl DatacenterAddressInstructionResponse { + pub fn new(datacenter_address_response: DatacenterAddressResponse) -> Self { + Self { + datacenter_address_response, + communication_instruction: None, + } + } +} +#[doc = "Datacenter address for given storage location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatacenterAddressLocationResponse { + #[serde(flatten)] + pub datacenter_address_response: DatacenterAddressResponse, + #[doc = "Contact person name"] + #[serde(rename = "contactPersonName", default, skip_serializing_if = "Option::is_none")] + pub contact_person_name: Option, + #[doc = "Company name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub company: Option, + #[doc = "Street address line 1"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub street1: Option, + #[doc = "Street address line 2"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub street2: Option, + #[doc = "Street address line 3"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub street3: Option, + #[doc = "City name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "name of the state"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "Zip code"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub zip: Option, + #[doc = "name of the country"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, + #[doc = "Phone number"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub phone: Option, + #[doc = "Phone extension"] + #[serde(rename = "phoneExtension", default, skip_serializing_if = "Option::is_none")] + pub phone_extension: Option, + #[doc = "Address type"] + #[serde(rename = "addressType", default, skip_serializing_if = "Option::is_none")] + pub address_type: Option, + #[doc = "Special instruction for shipping"] + #[serde(rename = "additionalShippingInformation", default, skip_serializing_if = "Option::is_none")] + pub additional_shipping_information: Option, +} +impl DatacenterAddressLocationResponse { + pub fn new(datacenter_address_response: DatacenterAddressResponse) -> Self { + Self { + datacenter_address_response, + contact_person_name: None, + company: None, + street1: None, + street2: None, + street3: None, + city: None, + state: None, + zip: None, + country: None, + phone: None, + phone_extension: None, + address_type: None, + additional_shipping_information: None, + } + } +} +#[doc = "Request body to get the datacenter address."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatacenterAddressRequest { + #[doc = "Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01"] + #[serde(rename = "storageLocation")] + pub storage_location: String, + #[doc = "Sku Name for which the data center address requested."] + #[serde(rename = "skuName")] + pub sku_name: datacenter_address_request::SkuName, +} +impl DatacenterAddressRequest { + pub fn new(storage_location: String, sku_name: datacenter_address_request::SkuName) -> Self { + Self { + storage_location, + sku_name, + } + } +} +pub mod datacenter_address_request { + use super::*; + #[doc = "Sku Name for which the data center address requested."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SkuName { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Datacenter address for given storage location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatacenterAddressResponse { + #[doc = "Data center address type"] + #[serde(rename = "datacenterAddressType")] + pub datacenter_address_type: datacenter_address_response::DatacenterAddressType, + #[doc = "List of supported carriers for return shipment."] + #[serde(rename = "supportedCarriersForReturnShipment", default, skip_serializing_if = "Vec::is_empty")] + pub supported_carriers_for_return_shipment: Vec, + #[doc = "Azure Location where the Data Center serves primarily."] + #[serde(rename = "dataCenterAzureLocation", default, skip_serializing_if = "Option::is_none")] + pub data_center_azure_location: Option, +} +impl DatacenterAddressResponse { + pub fn new(datacenter_address_type: datacenter_address_response::DatacenterAddressType) -> Self { + Self { + datacenter_address_type, + supported_carriers_for_return_shipment: Vec::new(), + data_center_azure_location: None, + } + } +} +pub mod datacenter_address_response { + use super::*; + #[doc = "Data center address type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DatacenterAddressType { + DatacenterAddressLocation, + DatacenterAddressInstruction, + } +} +#[doc = "Dc access security code"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DcAccessSecurityCode { + #[doc = "Reverse Dc access security code."] + #[serde(rename = "reverseDCAccessCode", default, skip_serializing_if = "Option::is_none")] + pub reverse_dc_access_code: Option, + #[doc = "Forward Dc access security code."] + #[serde(rename = "forwardDCAccessCode", default, skip_serializing_if = "Option::is_none")] + pub forward_dc_access_code: Option, +} +impl DcAccessSecurityCode { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Details { + pub code: String, + pub message: String, +} +impl Details { + pub fn new(code: String, message: String) -> Self { + Self { code, message } + } +} +#[doc = "Device erasure details with erasure completion status and erasureordestructionlog sas key"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceErasureDetails { + #[doc = "Holds the device erasure completion status"] + #[serde(rename = "deviceErasureStatus", default, skip_serializing_if = "Option::is_none")] + pub device_erasure_status: Option, + #[doc = "Shared access key to download cleanup or destruction certificate for device"] + #[serde(rename = "erasureOrDestructionCertificateSasKey", default, skip_serializing_if = "Option::is_none")] + pub erasure_or_destruction_certificate_sas_key: Option, +} +impl DeviceErasureDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod device_erasure_details { + use super::*; + #[doc = "Holds the device erasure completion status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceErasureStatus { + None, + InProgress, + Succeeded, + Failed, + Cancelled, + Cancelling, + SucceededWithErrors, + WaitingForCustomerAction, + SucceededWithWarnings, + WaitingForCustomerActionForKek, + WaitingForCustomerActionForCleanUp, + CustomerActionPerformedForCleanUp, + CustomerActionPerformed, + } +} +#[doc = "Request body to get the availability for scheduling disk orders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiskScheduleAvailabilityRequest { + #[serde(flatten)] + pub schedule_availability_request: ScheduleAvailabilityRequest, + #[doc = "The expected size of the data, which needs to be transferred in this job, in terabytes."] + #[serde(rename = "expectedDataSizeInTeraBytes")] + pub expected_data_size_in_tera_bytes: i32, +} +impl DiskScheduleAvailabilityRequest { + pub fn new(schedule_availability_request: ScheduleAvailabilityRequest, expected_data_size_in_tera_bytes: i32) -> Self { + Self { + schedule_availability_request, + expected_data_size_in_tera_bytes, + } + } +} +#[doc = "Contains all the secrets of a Disk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskSecret { + #[doc = "Serial number of the assigned disk."] + #[serde(rename = "diskSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub disk_serial_number: Option, + #[doc = "Bit Locker key of the disk which can be used to unlock the disk to copy data."] + #[serde(rename = "bitLockerKey", default, skip_serializing_if = "Option::is_none")] + pub bit_locker_key: Option, +} +impl DiskSecret { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Preferences related to the Encryption."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EncryptionPreferences { + #[doc = "Defines secondary layer of software-based encryption enablement."] + #[serde(rename = "doubleEncryption", default, skip_serializing_if = "Option::is_none")] + pub double_encryption: Option, +} +impl EncryptionPreferences { + pub fn new() -> Self { + Self::default() + } +} +pub mod encryption_preferences { + use super::*; + #[doc = "Defines secondary layer of software-based encryption enablement."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DoubleEncryption { + Enabled, + Disabled, + } + impl Default for DoubleEncryption { + fn default() -> Self { + Self::Disabled + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + pub code: String, + pub message: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl ErrorDetail { + pub fn new(code: String, message: String) -> Self { + Self { + code, + message, + details: Vec::new(), + target: None, + } + } +} +#[doc = "Export disk details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportDiskDetails { + #[doc = "The relative path of the manifest file on the disk."] + #[serde(rename = "manifestFile", default, skip_serializing_if = "Option::is_none")] + pub manifest_file: Option, + #[doc = "The Base16-encoded MD5 hash of the manifest file on the disk."] + #[serde(rename = "manifestHash", default, skip_serializing_if = "Option::is_none")] + pub manifest_hash: Option, + #[doc = "Path to backed up manifest, only returned if enableManifestBackup is true."] + #[serde(rename = "backupManifestCloudPath", default, skip_serializing_if = "Option::is_none")] + pub backup_manifest_cloud_path: Option, +} +impl ExportDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of the filter files to be used for data transfer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilterFileDetails { + #[doc = "Type of the filter file."] + #[serde(rename = "filterFileType")] + pub filter_file_type: filter_file_details::FilterFileType, + #[doc = "Path of the file that contains the details of all items to transfer."] + #[serde(rename = "filterFilePath")] + pub filter_file_path: String, +} +impl FilterFileDetails { + pub fn new(filter_file_type: filter_file_details::FilterFileType, filter_file_path: String) -> Self { + Self { + filter_file_type, + filter_file_path, + } + } +} +pub mod filter_file_details { + use super::*; + #[doc = "Type of the filter file."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FilterFileType { + AzureBlob, + AzureFile, + } +} +#[doc = "Granular Details for log generated during copy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GranularCopyLogDetails { + #[doc = "Indicates the type of job details."] + #[serde(rename = "copyLogDetailsType")] + pub copy_log_details_type: granular_copy_log_details::CopyLogDetailsType, +} +impl GranularCopyLogDetails { + pub fn new(copy_log_details_type: granular_copy_log_details::CopyLogDetailsType) -> Self { + Self { copy_log_details_type } + } +} +pub mod granular_copy_log_details { + use super::*; + #[doc = "Indicates the type of job details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyLogDetailsType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Granular Copy progress."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GranularCopyProgress { + #[doc = "Name of the storage account. This will be empty for data account types other than storage account."] + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[doc = "Transfer type of data"] + #[serde(rename = "transferType", default, skip_serializing_if = "Option::is_none")] + pub transfer_type: Option, + #[doc = "Data Account Type."] + #[serde(rename = "dataAccountType", default, skip_serializing_if = "Option::is_none")] + pub data_account_type: Option, + #[doc = "Id of the account where the data needs to be uploaded."] + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[doc = "To indicate bytes transferred."] + #[serde(rename = "bytesProcessed", default, skip_serializing_if = "Option::is_none")] + pub bytes_processed: Option, + #[doc = "Total amount of data to be processed by the job."] + #[serde(rename = "totalBytesToProcess", default, skip_serializing_if = "Option::is_none")] + pub total_bytes_to_process: Option, + #[doc = "Number of files processed"] + #[serde(rename = "filesProcessed", default, skip_serializing_if = "Option::is_none")] + pub files_processed: Option, + #[doc = "Total files to process"] + #[serde(rename = "totalFilesToProcess", default, skip_serializing_if = "Option::is_none")] + pub total_files_to_process: Option, + #[doc = "Number of files not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "invalidFilesProcessed", default, skip_serializing_if = "Option::is_none")] + pub invalid_files_processed: Option, + #[doc = "Total amount of data not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "invalidFileBytesUploaded", default, skip_serializing_if = "Option::is_none")] + pub invalid_file_bytes_uploaded: Option, + #[doc = "Number of folders not adhering to azure naming conventions which were processed by automatic renaming"] + #[serde(rename = "renamedContainerCount", default, skip_serializing_if = "Option::is_none")] + pub renamed_container_count: Option, + #[doc = "Number of files which could not be copied"] + #[serde(rename = "filesErroredOut", default, skip_serializing_if = "Option::is_none")] + pub files_errored_out: Option, + #[doc = "To indicate directories errored out in the job."] + #[serde(rename = "directoriesErroredOut", default, skip_serializing_if = "Option::is_none")] + pub directories_errored_out: Option, + #[doc = "To indicate directories renamed"] + #[serde(rename = "invalidDirectoriesProcessed", default, skip_serializing_if = "Option::is_none")] + pub invalid_directories_processed: Option, + #[doc = "To indicate if enumeration of data is in progress. \r\nUntil this is true, the TotalBytesToProcess may not be valid."] + #[serde(rename = "isEnumerationInProgress", default, skip_serializing_if = "Option::is_none")] + pub is_enumeration_in_progress: Option, +} +impl GranularCopyProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod granular_copy_progress { + use super::*; + #[doc = "Transfer type of data"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } + #[doc = "Data Account Type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } +} +#[doc = "Request body to get the availability for scheduling heavy orders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HeavyScheduleAvailabilityRequest { + #[serde(flatten)] + pub schedule_availability_request: ScheduleAvailabilityRequest, +} +impl HeavyScheduleAvailabilityRequest { + pub fn new(schedule_availability_request: ScheduleAvailabilityRequest) -> Self { + Self { + schedule_availability_request, + } + } +} +#[doc = "Managed identity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProperties { + #[doc = "Managed service identity type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "User assigned identity properties."] + #[serde(rename = "userAssigned", default, skip_serializing_if = "Option::is_none")] + pub user_assigned: Option, +} +impl IdentityProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Import disk details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportDiskDetails { + #[doc = "The relative path of the manifest file on the disk."] + #[serde(rename = "manifestFile")] + pub manifest_file: String, + #[doc = "The Base16-encoded MD5 hash of the manifest file on the disk."] + #[serde(rename = "manifestHash")] + pub manifest_hash: String, + #[doc = "BitLocker key used to encrypt the disk."] + #[serde(rename = "bitLockerKey")] + pub bit_locker_key: String, + #[doc = "Path to backed up manifest, only returned if enableManifestBackup is true."] + #[serde(rename = "backupManifestCloudPath", default, skip_serializing_if = "Option::is_none")] + pub backup_manifest_cloud_path: Option, +} +impl ImportDiskDetails { + pub fn new(manifest_file: String, manifest_hash: String, bit_locker_key: String) -> Self { + Self { + manifest_file, + manifest_hash, + bit_locker_key, + backup_manifest_cloud_path: None, + } + } +} +#[doc = "Additional delivery info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobDeliveryInfo { + #[doc = "Scheduled date time."] + #[serde(rename = "scheduledDateTime", default, skip_serializing_if = "Option::is_none")] + pub scheduled_date_time: Option, +} +impl JobDeliveryInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobDetails { + #[doc = "List of stages that run in the job."] + #[serde(rename = "jobStages", default, skip_serializing_if = "Vec::is_empty")] + pub job_stages: Vec, + #[doc = "Contact Details."] + #[serde(rename = "contactDetails")] + pub contact_details: ContactDetails, + #[doc = "Shipping address where customer wishes to receive the device."] + #[serde(rename = "shippingAddress", default, skip_serializing_if = "Option::is_none")] + pub shipping_address: Option, + #[doc = "package shipping details"] + #[serde(rename = "deliveryPackage", default, skip_serializing_if = "Option::is_none")] + pub delivery_package: Option, + #[doc = "package shipping details"] + #[serde(rename = "returnPackage", default, skip_serializing_if = "Option::is_none")] + pub return_package: Option, + #[doc = "Details of the data to be imported into azure."] + #[serde(rename = "dataImportDetails", default, skip_serializing_if = "Vec::is_empty")] + pub data_import_details: Vec, + #[doc = "Details of the data to be exported from azure."] + #[serde(rename = "dataExportDetails", default, skip_serializing_if = "Vec::is_empty")] + pub data_export_details: Vec, + #[doc = "Indicates the type of job details."] + #[serde(rename = "jobDetailsType")] + pub job_details_type: job_details::JobDetailsType, + #[doc = "Preferences related to the order"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub preferences: Option, + #[doc = "List of copy log details."] + #[serde(rename = "copyLogDetails", default, skip_serializing_if = "Vec::is_empty")] + pub copy_log_details: Vec, + #[doc = "Shared access key to download the return shipment label"] + #[serde(rename = "reverseShipmentLabelSasKey", default, skip_serializing_if = "Option::is_none")] + pub reverse_shipment_label_sas_key: Option, + #[doc = "Shared access key to download the chain of custody logs"] + #[serde(rename = "chainOfCustodySasKey", default, skip_serializing_if = "Option::is_none")] + pub chain_of_custody_sas_key: Option, + #[doc = "Device erasure details with erasure completion status and erasureordestructionlog sas key"] + #[serde(rename = "deviceErasureDetails", default, skip_serializing_if = "Option::is_none")] + pub device_erasure_details: Option, + #[doc = "Encryption key containing details about key to encrypt different keys."] + #[serde(rename = "keyEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key: Option, + #[doc = "The expected size of the data, which needs to be transferred in this job, in terabytes."] + #[serde(rename = "expectedDataSizeInTeraBytes", default, skip_serializing_if = "Option::is_none")] + pub expected_data_size_in_tera_bytes: Option, + #[doc = "Available actions on the job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, + #[doc = "Last Mitigation Action Performed On Job"] + #[serde(rename = "lastMitigationActionOnJob", default, skip_serializing_if = "Option::is_none")] + pub last_mitigation_action_on_job: Option, + #[doc = "Datacenter address for given storage location."] + #[serde(rename = "datacenterAddress", default, skip_serializing_if = "Option::is_none")] + pub datacenter_address: Option, + #[doc = "DataCenter code."] + #[serde(rename = "dataCenterCode", default, skip_serializing_if = "Option::is_none")] + pub data_center_code: Option, +} +impl JobDetails { + pub fn new(contact_details: ContactDetails, job_details_type: job_details::JobDetailsType) -> Self { + Self { + job_stages: Vec::new(), + contact_details, + shipping_address: None, + delivery_package: None, + return_package: None, + data_import_details: Vec::new(), + data_export_details: Vec::new(), + job_details_type, + preferences: None, + copy_log_details: Vec::new(), + reverse_shipment_label_sas_key: None, + chain_of_custody_sas_key: None, + device_erasure_details: None, + key_encryption_key: None, + expected_data_size_in_tera_bytes: None, + actions: Vec::new(), + last_mitigation_action_on_job: None, + datacenter_address: None, + data_center_code: None, + } + } +} +pub mod job_details { + use super::*; + #[doc = "Indicates the type of job details."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobDetailsType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } + #[doc = "DataCenter code."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataCenterCode { + Invalid, + #[serde(rename = "BY2")] + By2, + #[serde(rename = "BY1")] + By1, + #[serde(rename = "ORK70")] + Ork70, + #[serde(rename = "AM2")] + Am2, + #[serde(rename = "AMS20")] + Ams20, + #[serde(rename = "BY21")] + By21, + #[serde(rename = "BY24")] + By24, + #[serde(rename = "MWH01")] + Mwh01, + #[serde(rename = "AMS06")] + Ams06, + #[serde(rename = "SSE90")] + Sse90, + #[serde(rename = "SYD03")] + Syd03, + #[serde(rename = "SYD23")] + Syd23, + #[serde(rename = "CBR20")] + Cbr20, + #[serde(rename = "YTO20")] + Yto20, + #[serde(rename = "CWL20")] + Cwl20, + #[serde(rename = "LON24")] + Lon24, + #[serde(rename = "BOM01")] + Bom01, + #[serde(rename = "BL20")] + Bl20, + #[serde(rename = "BL7")] + Bl7, + #[serde(rename = "SEL20")] + Sel20, + #[serde(rename = "TYO01")] + Tyo01, + #[serde(rename = "BN1")] + Bn1, + #[serde(rename = "SN5")] + Sn5, + #[serde(rename = "CYS04")] + Cys04, + #[serde(rename = "TYO22")] + Tyo22, + #[serde(rename = "YTO21")] + Yto21, + #[serde(rename = "YQB20")] + Yqb20, + #[serde(rename = "FRA22")] + Fra22, + #[serde(rename = "MAA01")] + Maa01, + #[serde(rename = "CPQ02")] + Cpq02, + #[serde(rename = "CPQ20")] + Cpq20, + #[serde(rename = "SIN20")] + Sin20, + #[serde(rename = "HKG20")] + Hkg20, + #[serde(rename = "SG2")] + Sg2, + #[serde(rename = "MEL23")] + Mel23, + #[serde(rename = "SEL21")] + Sel21, + #[serde(rename = "OSA20")] + Osa20, + #[serde(rename = "SHA03")] + Sha03, + #[serde(rename = "BJB")] + Bjb, + #[serde(rename = "JNB22")] + Jnb22, + #[serde(rename = "JNB21")] + Jnb21, + #[serde(rename = "MNZ21")] + Mnz21, + #[serde(rename = "SN8")] + Sn8, + #[serde(rename = "AUH20")] + Auh20, + #[serde(rename = "ZRH20")] + Zrh20, + #[serde(rename = "PUS20")] + Pus20, + AdHoc, + #[serde(rename = "CH1")] + Ch1, + #[serde(rename = "DSM05")] + Dsm05, + #[serde(rename = "DUB07")] + Dub07, + #[serde(rename = "PNQ01")] + Pnq01, + #[serde(rename = "SVG20")] + Svg20, + #[serde(rename = "OSA02")] + Osa02, + #[serde(rename = "OSA22")] + Osa22, + #[serde(rename = "PAR22")] + Par22, + #[serde(rename = "BN7")] + Bn7, + #[serde(rename = "SN6")] + Sn6, + #[serde(rename = "BJS20")] + Bjs20, + } +} +#[doc = "Job Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobProperties { + #[doc = "Type of the data transfer."] + #[serde(rename = "transferType")] + pub transfer_type: job_properties::TransferType, + #[doc = "Describes whether the job is cancellable or not."] + #[serde(rename = "isCancellable", default, skip_serializing_if = "Option::is_none")] + pub is_cancellable: Option, + #[doc = "Describes whether the job is deletable or not."] + #[serde(rename = "isDeletable", default, skip_serializing_if = "Option::is_none")] + pub is_deletable: Option, + #[doc = "Describes whether the shipping address is editable or not."] + #[serde(rename = "isShippingAddressEditable", default, skip_serializing_if = "Option::is_none")] + pub is_shipping_address_editable: Option, + #[doc = "Is Prepare To Ship Enabled on this job"] + #[serde(rename = "isPrepareToShipEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_prepare_to_ship_enabled: Option, + #[doc = "Name of the stage which is in progress."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Time at which the job was started in UTC ISO 8601 format."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Provides additional information about an http error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "Job details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, + #[doc = "Reason for cancellation."] + #[serde(rename = "cancellationReason", default, skip_serializing_if = "Option::is_none")] + pub cancellation_reason: Option, + #[doc = "Delivery type of Job."] + #[serde(rename = "deliveryType", default, skip_serializing_if = "Option::is_none")] + pub delivery_type: Option, + #[doc = "Additional delivery info."] + #[serde(rename = "deliveryInfo", default, skip_serializing_if = "Option::is_none")] + pub delivery_info: Option, + #[doc = "Flag to indicate cancellation of scheduled job."] + #[serde(rename = "isCancellableWithoutFee", default, skip_serializing_if = "Option::is_none")] + pub is_cancellable_without_fee: Option, +} +impl JobProperties { + pub fn new(transfer_type: job_properties::TransferType) -> Self { + Self { + transfer_type, + is_cancellable: None, + is_deletable: None, + is_shipping_address_editable: None, + is_prepare_to_ship_enabled: None, + status: None, + start_time: None, + error: None, + details: None, + cancellation_reason: None, + delivery_type: None, + delivery_info: None, + is_cancellable_without_fee: None, + } + } +} +pub mod job_properties { + use super::*; + #[doc = "Type of the data transfer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } + #[doc = "Name of the stage which is in progress."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + DeviceOrdered, + DevicePrepared, + Dispatched, + Delivered, + PickedUp, + #[serde(rename = "AtAzureDC")] + AtAzureDc, + DataCopy, + Completed, + CompletedWithErrors, + Cancelled, + #[serde(rename = "Failed_IssueReportedAtCustomer")] + FailedIssueReportedAtCustomer, + #[serde(rename = "Failed_IssueDetectedAtAzureDC")] + FailedIssueDetectedAtAzureDc, + Aborted, + CompletedWithWarnings, + #[serde(rename = "ReadyToDispatchFromAzureDC")] + ReadyToDispatchFromAzureDc, + #[serde(rename = "ReadyToReceiveAtAzureDC")] + ReadyToReceiveAtAzureDc, + Created, + #[serde(rename = "ShippedToAzureDC")] + ShippedToAzureDc, + AwaitingShipmentDetails, + #[serde(rename = "PreparingToShipFromAzureDC")] + PreparingToShipFromAzureDc, + ShippedToCustomer, + } + #[doc = "Delivery type of Job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeliveryType { + NonScheduled, + Scheduled, + } + impl Default for DeliveryType { + fn default() -> Self { + Self::NonScheduled + } + } +} +#[doc = "Job Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Job Properties"] + pub properties: JobProperties, + #[doc = "Name of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Id of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Provides details about resource creation and update time"] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl JobResource { + pub fn new(resource: Resource, properties: JobProperties) -> Self { + Self { + resource, + properties, + name: None, + id: None, + type_: None, + system_data: None, + } + } +} +#[doc = "Job Resource Collection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobResourceList { + #[doc = "List of job resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link for the next set of job resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl JobResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The JobResourceUpdateParameter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobResourceUpdateParameter { + #[doc = "Job Properties for update"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Msi identity details of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl JobResourceUpdateParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The base class for the secrets"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobSecrets { + #[doc = "Used to indicate what type of job secrets object."] + #[serde(rename = "jobSecretsType")] + pub job_secrets_type: job_secrets::JobSecretsType, + #[doc = "Dc access security code"] + #[serde(rename = "dcAccessSecurityCode", default, skip_serializing_if = "Option::is_none")] + pub dc_access_security_code: Option, + #[doc = "Provides additional information about an http error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl JobSecrets { + pub fn new(job_secrets_type: job_secrets::JobSecretsType) -> Self { + Self { + job_secrets_type, + dc_access_security_code: None, + error: None, + } + } +} +pub mod job_secrets { + use super::*; + #[doc = "Used to indicate what type of job secrets object."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobSecretsType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Job stages."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobStages { + #[doc = "Name of the job stage."] + #[serde(rename = "stageName", default, skip_serializing_if = "Option::is_none")] + pub stage_name: Option, + #[doc = "Display name of the job stage."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Status of the job stage."] + #[serde(rename = "stageStatus", default, skip_serializing_if = "Option::is_none")] + pub stage_status: Option, + #[doc = "Time for the job stage in UTC ISO 8601 format."] + #[serde(rename = "stageTime", default, skip_serializing_if = "Option::is_none")] + pub stage_time: Option, + #[doc = "Job Stage Details"] + #[serde(rename = "jobStageDetails", default, skip_serializing_if = "Option::is_none")] + pub job_stage_details: Option, +} +impl JobStages { + pub fn new() -> Self { + Self::default() + } +} +pub mod job_stages { + use super::*; + #[doc = "Name of the job stage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StageName { + DeviceOrdered, + DevicePrepared, + Dispatched, + Delivered, + PickedUp, + #[serde(rename = "AtAzureDC")] + AtAzureDc, + DataCopy, + Completed, + CompletedWithErrors, + Cancelled, + #[serde(rename = "Failed_IssueReportedAtCustomer")] + FailedIssueReportedAtCustomer, + #[serde(rename = "Failed_IssueDetectedAtAzureDC")] + FailedIssueDetectedAtAzureDc, + Aborted, + CompletedWithWarnings, + #[serde(rename = "ReadyToDispatchFromAzureDC")] + ReadyToDispatchFromAzureDc, + #[serde(rename = "ReadyToReceiveAtAzureDC")] + ReadyToReceiveAtAzureDc, + Created, + #[serde(rename = "ShippedToAzureDC")] + ShippedToAzureDc, + AwaitingShipmentDetails, + #[serde(rename = "PreparingToShipFromAzureDC")] + PreparingToShipFromAzureDc, + ShippedToCustomer, + } + #[doc = "Status of the job stage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StageStatus { + None, + InProgress, + Succeeded, + Failed, + Cancelled, + Cancelling, + SucceededWithErrors, + WaitingForCustomerAction, + SucceededWithWarnings, + WaitingForCustomerActionForKek, + WaitingForCustomerActionForCleanUp, + CustomerActionPerformedForCleanUp, + CustomerActionPerformed, + } +} +#[doc = "Encryption key containing details about key to encrypt different keys."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyEncryptionKey { + #[doc = "Type of encryption key used for key encryption."] + #[serde(rename = "kekType")] + pub kek_type: key_encryption_key::KekType, + #[doc = "Managed identity properties."] + #[serde(rename = "identityProperties", default, skip_serializing_if = "Option::is_none")] + pub identity_properties: Option, + #[doc = "Key encryption key. It is required in case of Customer managed KekType."] + #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] + pub kek_url: Option, + #[doc = "Kek vault resource id. It is required in case of Customer managed KekType."] + #[serde(rename = "kekVaultResourceID", default, skip_serializing_if = "Option::is_none")] + pub kek_vault_resource_id: Option, +} +impl KeyEncryptionKey { + pub fn new(kek_type: key_encryption_key::KekType) -> Self { + Self { + kek_type, + identity_properties: None, + kek_url: None, + kek_vault_resource_id: None, + } + } +} +pub mod key_encryption_key { + use super::*; + #[doc = "Type of encryption key used for key encryption."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KekType { + MicrosoftManaged, + CustomerManaged, + } + impl Default for KekType { + fn default() -> Self { + Self::MicrosoftManaged + } + } +} +#[doc = "Last Mitigation Action Performed On Job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LastMitigationActionOnJob { + #[doc = "Action performed date time"] + #[serde(rename = "actionDateTimeInUtc", default, skip_serializing_if = "Option::is_none")] + pub action_date_time_in_utc: Option, + #[doc = "Action performed by customer,\r\npossibility is that mitigation might happen by customer or service or by ops"] + #[serde(rename = "isPerformedByCustomer", default, skip_serializing_if = "Option::is_none")] + pub is_performed_by_customer: Option, + #[doc = "Resolution code provided by customer"] + #[serde(rename = "customerResolution", default, skip_serializing_if = "Option::is_none")] + pub customer_resolution: Option, +} +impl LastMitigationActionOnJob { + pub fn new() -> Self { + Self::default() + } +} +pub mod last_mitigation_action_on_job { + use super::*; + #[doc = "Resolution code provided by customer"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolution { + None, + MoveToCleanUpDevice, + Resume, + Restart, + ReachOutToOperation, + } +} +#[doc = "Details of the managed disks."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedDiskDetails { + #[serde(flatten)] + pub data_account_details: DataAccountDetails, + #[doc = "Resource Group Id of the compute disks."] + #[serde(rename = "resourceGroupId")] + pub resource_group_id: String, + #[doc = "Resource Id of the storage account that can be used to copy the vhd for staging."] + #[serde(rename = "stagingStorageAccountId")] + pub staging_storage_account_id: String, +} +impl ManagedDiskDetails { + pub fn new(data_account_details: DataAccountDetails, resource_group_id: String, staging_storage_account_id: String) -> Self { + Self { + data_account_details, + resource_group_id, + staging_storage_account_id, + } + } +} +#[doc = "The request body to provide the delivery package details of job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarkDevicesShippedRequest { + #[doc = "package carrier info"] + #[serde(rename = "deliverToDcPackageDetails")] + pub deliver_to_dc_package_details: PackageCarrierInfo, +} +impl MarkDevicesShippedRequest { + pub fn new(deliver_to_dc_package_details: PackageCarrierInfo) -> Self { + Self { + deliver_to_dc_package_details, + } + } +} +#[doc = "The Mitigate Job captured from request body for Mitigate API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MitigateJobRequest { + #[doc = "Resolution code for the job"] + #[serde(rename = "customerResolutionCode")] + pub customer_resolution_code: mitigate_job_request::CustomerResolutionCode, +} +impl MitigateJobRequest { + pub fn new(customer_resolution_code: mitigate_job_request::CustomerResolutionCode) -> Self { + Self { customer_resolution_code } + } +} +pub mod mitigate_job_request { + use super::*; + #[doc = "Resolution code for the job"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolutionCode { + None, + MoveToCleanUpDevice, + Resume, + Restart, + ReachOutToOperation, + } +} +#[doc = "Notification preference for a job stage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationPreference { + #[doc = "Name of the stage."] + #[serde(rename = "stageName")] + pub stage_name: notification_preference::StageName, + #[doc = "Notification is required or not."] + #[serde(rename = "sendNotification")] + pub send_notification: bool, +} +impl NotificationPreference { + pub fn new(stage_name: notification_preference::StageName, send_notification: bool) -> Self { + Self { + stage_name, + send_notification, + } + } +} +pub mod notification_preference { + use super::*; + #[doc = "Name of the stage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StageName { + DevicePrepared, + Dispatched, + Delivered, + PickedUp, + #[serde(rename = "AtAzureDC")] + AtAzureDc, + DataCopy, + Created, + ShippedToCustomer, + } +} +#[doc = "Operation entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation display"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Operation properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Origin of the operation. Can be : user|system|user,system"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Indicates whether the operation is a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation display"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationDisplay { + #[doc = "Provider name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Localized name of the operation for display purpose."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Localized description of the operation for display purpose."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl OperationDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationList { + #[doc = "List of operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link for the next set of operations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationProperties {} +impl OperationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Package carrier details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PackageCarrierDetails { + #[doc = "Carrier Account Number of customer for customer disk."] + #[serde(rename = "carrierAccountNumber", default, skip_serializing_if = "Option::is_none")] + pub carrier_account_number: Option, + #[doc = "Name of the carrier."] + #[serde(rename = "carrierName", default, skip_serializing_if = "Option::is_none")] + pub carrier_name: Option, + #[doc = "Tracking Id of shipment."] + #[serde(rename = "trackingId", default, skip_serializing_if = "Option::is_none")] + pub tracking_id: Option, +} +impl PackageCarrierDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "package carrier info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PackageCarrierInfo { + #[doc = "Name of the carrier."] + #[serde(rename = "carrierName", default, skip_serializing_if = "Option::is_none")] + pub carrier_name: Option, + #[doc = "Tracking Id of shipment."] + #[serde(rename = "trackingId", default, skip_serializing_if = "Option::is_none")] + pub tracking_id: Option, +} +impl PackageCarrierInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "package shipping details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PackageShippingDetails { + #[doc = "Url where shipment can be tracked."] + #[serde(rename = "trackingUrl", default, skip_serializing_if = "Option::is_none")] + pub tracking_url: Option, + #[doc = "Name of the carrier."] + #[serde(rename = "carrierName", default, skip_serializing_if = "Option::is_none")] + pub carrier_name: Option, + #[doc = "Tracking Id of shipment."] + #[serde(rename = "trackingId", default, skip_serializing_if = "Option::is_none")] + pub tracking_id: Option, +} +impl PackageShippingDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Preferences related to the order"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Preferences { + #[doc = "Preferred data center region."] + #[serde(rename = "preferredDataCenterRegion", default, skip_serializing_if = "Vec::is_empty")] + pub preferred_data_center_region: Vec, + #[doc = "Preferences related to the shipment logistics of the sku"] + #[serde(rename = "transportPreferences", default, skip_serializing_if = "Option::is_none")] + pub transport_preferences: Option, + #[doc = "Preferences related to the Encryption."] + #[serde(rename = "encryptionPreferences", default, skip_serializing_if = "Option::is_none")] + pub encryption_preferences: Option, + #[doc = "Preferences related to the Access Tier of storage accounts."] + #[serde(rename = "storageAccountAccessTierPreferences", default, skip_serializing_if = "Vec::is_empty")] + pub storage_account_access_tier_preferences: Vec, +} +impl Preferences { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request to validate preference of transport and data center."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PreferencesValidationRequest { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, + #[doc = "Preferences related to the order"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub preference: Option, + #[doc = "Device type to be used for the job."] + #[serde(rename = "deviceType")] + pub device_type: preferences_validation_request::DeviceType, +} +impl PreferencesValidationRequest { + pub fn new(validation_input_request: ValidationInputRequest, device_type: preferences_validation_request::DeviceType) -> Self { + Self { + validation_input_request, + preference: None, + device_type, + } + } +} +pub mod preferences_validation_request { + use super::*; + #[doc = "Device type to be used for the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Properties of data center and transport preference validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PreferencesValidationResponseProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "Validation status of requested data center and transport."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl PreferencesValidationResponseProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + status: None, + } + } +} +pub mod preferences_validation_response_properties { + use super::*; + #[doc = "Validation status of requested data center and transport."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + Skipped, + } +} +#[doc = "Request body to get the configuration for the region."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegionConfigurationRequest { + #[doc = "Request body to get the availability for scheduling orders."] + #[serde(rename = "scheduleAvailabilityRequest", default, skip_serializing_if = "Option::is_none")] + pub schedule_availability_request: Option, + #[doc = "Request body to get the transport availability for given sku."] + #[serde(rename = "transportAvailabilityRequest", default, skip_serializing_if = "Option::is_none")] + pub transport_availability_request: Option, + #[doc = "Request body to get the datacenter address."] + #[serde(rename = "datacenterAddressRequest", default, skip_serializing_if = "Option::is_none")] + pub datacenter_address_request: Option, +} +impl RegionConfigurationRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configuration response specific to a region."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RegionConfigurationResponse { + #[doc = "Schedule availability for given sku in a region."] + #[serde(rename = "scheduleAvailabilityResponse", default, skip_serializing_if = "Option::is_none")] + pub schedule_availability_response: Option, + #[doc = "Transport options available for given sku in a region."] + #[serde(rename = "transportAvailabilityResponse", default, skip_serializing_if = "Option::is_none")] + pub transport_availability_response: Option, + #[doc = "Datacenter address for given storage location."] + #[serde(rename = "datacenterAddressResponse", default, skip_serializing_if = "Option::is_none")] + pub datacenter_address_response: Option, +} +impl RegionConfigurationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Model of the Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[doc = "The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed."] + pub location: String, + #[doc = "The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The Sku."] + pub sku: Sku, + #[doc = "Msi identity details of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl Resource { + pub fn new(location: String, sku: Sku) -> Self { + Self { + location, + tags: None, + sku, + identity: None, + } + } +} +#[doc = "Msi identity details of the resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceIdentity { + #[doc = "Identity type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Service Principal Id backing the Msi"] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Home Tenant Id"] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "User Assigned Identities"] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ResourceIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body to get the availability for scheduling orders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleAvailabilityRequest { + #[doc = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01"] + #[serde(rename = "storageLocation")] + pub storage_location: String, + #[doc = "Sku Name for which the order is to be scheduled."] + #[serde(rename = "skuName")] + pub sku_name: schedule_availability_request::SkuName, + #[doc = "Country in which storage location should be supported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, +} +impl ScheduleAvailabilityRequest { + pub fn new(storage_location: String, sku_name: schedule_availability_request::SkuName) -> Self { + Self { + storage_location, + sku_name, + country: None, + } + } +} +pub mod schedule_availability_request { + use super::*; + #[doc = "Sku Name for which the order is to be scheduled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SkuName { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Schedule availability for given sku in a region."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScheduleAvailabilityResponse { + #[doc = "List of dates available to schedule"] + #[serde(rename = "availableDates", default, skip_serializing_if = "Vec::is_empty")] + pub available_dates: Vec, +} +impl ScheduleAvailabilityResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential details of the shares in account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ShareCredentialDetails { + #[doc = "Name of the share."] + #[serde(rename = "shareName", default, skip_serializing_if = "Option::is_none")] + pub share_name: Option, + #[doc = "Type of the share."] + #[serde(rename = "shareType", default, skip_serializing_if = "Option::is_none")] + pub share_type: Option, + #[doc = "User name for the share."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "Password for the share."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Access protocols supported on the device."] + #[serde(rename = "supportedAccessProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub supported_access_protocols: Vec, +} +impl ShareCredentialDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod share_credential_details { + use super::*; + #[doc = "Type of the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ShareType { + UnknownType, + #[serde(rename = "HCS")] + Hcs, + BlockBlob, + PageBlob, + AzureFile, + ManagedDisk, + } +} +#[doc = "Shipment pick up request details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShipmentPickUpRequest { + #[doc = "Minimum date after which the pick up should commence, this must be in local time of pick up area."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "Maximum date before which the pick up should commence, this must be in local time of pick up area."] + #[serde(rename = "endTime")] + pub end_time: String, + #[doc = "Shipment Location in the pickup place. Eg.front desk"] + #[serde(rename = "shipmentLocation")] + pub shipment_location: String, +} +impl ShipmentPickUpRequest { + pub fn new(start_time: String, end_time: String, shipment_location: String) -> Self { + Self { + start_time, + end_time, + shipment_location, + } + } +} +#[doc = "Shipment pick up response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ShipmentPickUpResponse { + #[doc = "Confirmation number for the pick up request."] + #[serde(rename = "confirmationNumber", default, skip_serializing_if = "Option::is_none")] + pub confirmation_number: Option, + #[doc = "Time by which shipment should be ready for pick up, this is in local time of pick up area."] + #[serde(rename = "readyByTime", default, skip_serializing_if = "Option::is_none")] + pub ready_by_time: Option, +} +impl ShipmentPickUpResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Shipping address where customer wishes to receive the device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShippingAddress { + #[doc = "Street Address line 1."] + #[serde(rename = "streetAddress1")] + pub street_address1: String, + #[doc = "Street Address line 2."] + #[serde(rename = "streetAddress2", default, skip_serializing_if = "Option::is_none")] + pub street_address2: Option, + #[doc = "Street Address line 3."] + #[serde(rename = "streetAddress3", default, skip_serializing_if = "Option::is_none")] + pub street_address3: Option, + #[doc = "Name of the City."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "Name of the State or Province."] + #[serde(rename = "stateOrProvince", default, skip_serializing_if = "Option::is_none")] + pub state_or_province: Option, + #[doc = "Name of the Country."] + pub country: String, + #[doc = "Postal code."] + #[serde(rename = "postalCode", default, skip_serializing_if = "Option::is_none")] + pub postal_code: Option, + #[doc = "Extended Zip Code."] + #[serde(rename = "zipExtendedCode", default, skip_serializing_if = "Option::is_none")] + pub zip_extended_code: Option, + #[doc = "Name of the company."] + #[serde(rename = "companyName", default, skip_serializing_if = "Option::is_none")] + pub company_name: Option, + #[doc = "Type of address."] + #[serde(rename = "addressType", default, skip_serializing_if = "Option::is_none")] + pub address_type: Option, +} +impl ShippingAddress { + pub fn new(street_address1: String, country: String) -> Self { + Self { + street_address1, + street_address2: None, + street_address3: None, + city: None, + state_or_province: None, + country, + postal_code: None, + zip_extended_code: None, + company_name: None, + address_type: None, + } + } +} +pub mod shipping_address { + use super::*; + #[doc = "Type of address."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AddressType { + None, + Residential, + Commercial, + } + impl Default for AddressType { + fn default() -> Self { + Self::None + } + } +} +#[doc = "The Sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[doc = "The sku name."] + pub name: sku::Name, + #[doc = "The display name of the sku."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The sku family."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, +} +impl Sku { + pub fn new(name: sku::Name) -> Self { + Self { + name, + display_name: None, + family: None, + } + } +} +pub mod sku { + use super::*; + #[doc = "The sku name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Request to validate sku availability."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SkuAvailabilityValidationRequest { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, + #[doc = "Device type to be used for the job."] + #[serde(rename = "deviceType")] + pub device_type: sku_availability_validation_request::DeviceType, + #[doc = "Type of the transfer."] + #[serde(rename = "transferType")] + pub transfer_type: sku_availability_validation_request::TransferType, + #[doc = "ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"] + pub country: String, + #[doc = "Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01"] + pub location: String, +} +impl SkuAvailabilityValidationRequest { + pub fn new( + validation_input_request: ValidationInputRequest, + device_type: sku_availability_validation_request::DeviceType, + transfer_type: sku_availability_validation_request::TransferType, + country: String, + location: String, + ) -> Self { + Self { + validation_input_request, + device_type, + transfer_type, + country, + location, + } + } +} +pub mod sku_availability_validation_request { + use super::*; + #[doc = "Device type to be used for the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } + #[doc = "Type of the transfer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferType { + ImportToAzure, + ExportFromAzure, + } +} +#[doc = "Properties of sku availability validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SkuAvailabilityValidationResponseProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "Sku availability validation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl SkuAvailabilityValidationResponseProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + status: None, + } + } +} +pub mod sku_availability_validation_response_properties { + use super::*; + #[doc = "Sku availability validation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + Skipped, + } +} +#[doc = "Capacity of the sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuCapacity { + #[doc = "Usable capacity in TB."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usable: Option, + #[doc = "Maximum capacity in TB."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, +} +impl SkuCapacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes metadata for retrieving price info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuCost { + #[doc = "Meter id of the Sku."] + #[serde(rename = "meterId", default, skip_serializing_if = "Option::is_none")] + pub meter_id: Option, + #[doc = "The type of the meter."] + #[serde(rename = "meterType", default, skip_serializing_if = "Option::is_none")] + pub meter_type: Option, + #[doc = "Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub multiplier: Option, +} +impl SkuCost { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information of the sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuInformation { + #[doc = "The Sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The sku is enabled or not."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Properties of the sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SkuInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuProperties { + #[doc = "The map of data location to service location."] + #[serde(rename = "dataLocationToServiceLocationMap", default, skip_serializing_if = "Vec::is_empty")] + pub data_location_to_service_location_map: Vec, + #[doc = "Capacity of the sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "Cost of the Sku."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub costs: Vec, + #[doc = "Api versions that support this Sku."] + #[serde(rename = "apiVersions", default, skip_serializing_if = "Vec::is_empty")] + pub api_versions: Vec, + #[doc = "Reason why the Sku is disabled."] + #[serde(rename = "disabledReason", default, skip_serializing_if = "Option::is_none")] + pub disabled_reason: Option, + #[doc = "Message for why the Sku is disabled."] + #[serde(rename = "disabledReasonMessage", default, skip_serializing_if = "Option::is_none")] + pub disabled_reason_message: Option, + #[doc = "Required feature to access the sku."] + #[serde(rename = "requiredFeature", default, skip_serializing_if = "Option::is_none")] + pub required_feature: Option, +} +impl SkuProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod sku_properties { + use super::*; + #[doc = "Reason why the Sku is disabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DisabledReason { + None, + Country, + Region, + Feature, + OfferType, + NoSubscriptionInfo, + } +} +#[doc = "Details for the storage account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountDetails { + #[serde(flatten)] + pub data_account_details: DataAccountDetails, + #[doc = "Storage Account Resource Id."] + #[serde(rename = "storageAccountId")] + pub storage_account_id: String, +} +impl StorageAccountDetails { + pub fn new(data_account_details: DataAccountDetails, storage_account_id: String) -> Self { + Self { + data_account_details, + storage_account_id, + } + } +} +#[doc = "Request to validate subscription permission to create jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionIsAllowedToCreateJobValidationRequest { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, +} +impl SubscriptionIsAllowedToCreateJobValidationRequest { + pub fn new(validation_input_request: ValidationInputRequest) -> Self { + Self { validation_input_request } + } +} +#[doc = "Properties of subscription permission to create job validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SubscriptionIsAllowedToCreateJobValidationResponseProperties { + #[serde(flatten)] + pub validation_input_response: ValidationInputResponse, + #[doc = "Validation status of subscription permission to create job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl SubscriptionIsAllowedToCreateJobValidationResponseProperties { + pub fn new(validation_input_response: ValidationInputResponse) -> Self { + Self { + validation_input_response, + status: None, + } + } +} +pub mod subscription_is_allowed_to_create_job_validation_response_properties { + use super::*; + #[doc = "Validation status of subscription permission to create job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Valid, + Invalid, + Skipped, + } +} +#[doc = "Details to transfer all data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransferAllDetails { + #[doc = "Type of the account of data"] + #[serde(rename = "dataAccountType")] + pub data_account_type: transfer_all_details::DataAccountType, + #[doc = "To indicate if all Azure blobs have to be transferred"] + #[serde(rename = "transferAllBlobs", default, skip_serializing_if = "Option::is_none")] + pub transfer_all_blobs: Option, + #[doc = "To indicate if all Azure Files have to be transferred"] + #[serde(rename = "transferAllFiles", default, skip_serializing_if = "Option::is_none")] + pub transfer_all_files: Option, +} +impl TransferAllDetails { + pub fn new(data_account_type: transfer_all_details::DataAccountType) -> Self { + Self { + data_account_type, + transfer_all_blobs: None, + transfer_all_files: None, + } + } +} +pub mod transfer_all_details { + use super::*; + #[doc = "Type of the account of data"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } + impl Default for DataAccountType { + fn default() -> Self { + Self::StorageAccount + } + } +} +#[doc = "Configuration for defining the transfer of data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransferConfiguration { + #[doc = "Type of the configuration for transfer."] + #[serde(rename = "transferConfigurationType")] + pub transfer_configuration_type: transfer_configuration::TransferConfigurationType, + #[doc = "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter."] + #[serde(rename = "transferFilterDetails", default, skip_serializing_if = "Option::is_none")] + pub transfer_filter_details: Option, + #[doc = "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll"] + #[serde(rename = "transferAllDetails", default, skip_serializing_if = "Option::is_none")] + pub transfer_all_details: Option, +} +impl TransferConfiguration { + pub fn new(transfer_configuration_type: transfer_configuration::TransferConfigurationType) -> Self { + Self { + transfer_configuration_type, + transfer_filter_details: None, + transfer_all_details: None, + } + } +} +pub mod transfer_configuration { + use super::*; + #[doc = "Type of the configuration for transfer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TransferConfigurationType { + TransferAll, + TransferUsingFilter, + } + #[doc = "Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct TransferFilterDetails { + #[doc = "Details of the filtering the transfer of data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub include: Box>, + } + impl TransferFilterDetails { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct TransferAllDetails { + #[doc = "Details to transfer all data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub include: Box>, + } + impl TransferAllDetails { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Details of the filtering the transfer of data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransferFilterDetails { + #[doc = "Type of the account of data."] + #[serde(rename = "dataAccountType")] + pub data_account_type: transfer_filter_details::DataAccountType, + #[doc = "Filter details to transfer Azure Blobs"] + #[serde(rename = "blobFilterDetails", default, skip_serializing_if = "Option::is_none")] + pub blob_filter_details: Option, + #[doc = "Filter details to transfer Azure files"] + #[serde(rename = "azureFileFilterDetails", default, skip_serializing_if = "Option::is_none")] + pub azure_file_filter_details: Option, + #[doc = "Details of the filter files to be used for data transfer."] + #[serde(rename = "filterFileDetails", default, skip_serializing_if = "Vec::is_empty")] + pub filter_file_details: Vec, +} +impl TransferFilterDetails { + pub fn new(data_account_type: transfer_filter_details::DataAccountType) -> Self { + Self { + data_account_type, + blob_filter_details: None, + azure_file_filter_details: None, + filter_file_details: Vec::new(), + } + } +} +pub mod transfer_filter_details { + use super::*; + #[doc = "Type of the account of data."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataAccountType { + StorageAccount, + ManagedDisk, + } + impl Default for DataAccountType { + fn default() -> Self { + Self::StorageAccount + } + } +} +#[doc = "Transport options availability details for given region."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TransportAvailabilityDetails { + #[doc = "Transport Shipment Type supported for given region."] + #[serde(rename = "shipmentType", default, skip_serializing_if = "Option::is_none")] + pub shipment_type: Option, +} +impl TransportAvailabilityDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod transport_availability_details { + use super::*; + #[doc = "Transport Shipment Type supported for given region."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ShipmentType { + CustomerManaged, + MicrosoftManaged, + } +} +#[doc = "Request body to get the transport availability for given sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TransportAvailabilityRequest { + #[doc = "Type of the device."] + #[serde(rename = "skuName", default, skip_serializing_if = "Option::is_none")] + pub sku_name: Option, +} +impl TransportAvailabilityRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod transport_availability_request { + use super::*; + #[doc = "Type of the device."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SkuName { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Transport options available for given sku in a region."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TransportAvailabilityResponse { + #[doc = "List of transport availability details for given region"] + #[serde(rename = "transportAvailabilityDetails", default, skip_serializing_if = "Vec::is_empty")] + pub transport_availability_details: Vec, +} +impl TransportAvailabilityResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Preferences related to the shipment logistics of the sku"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransportPreferences { + #[doc = "Indicates Shipment Logistics type that the customer preferred."] + #[serde(rename = "preferredShipmentType")] + pub preferred_shipment_type: transport_preferences::PreferredShipmentType, +} +impl TransportPreferences { + pub fn new(preferred_shipment_type: transport_preferences::PreferredShipmentType) -> Self { + Self { preferred_shipment_type } + } +} +pub mod transport_preferences { + use super::*; + #[doc = "Indicates Shipment Logistics type that the customer preferred."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PreferredShipmentType { + CustomerManaged, + MicrosoftManaged, + } +} +#[doc = "Unencrypted credentials for accessing device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnencryptedCredentials { + #[doc = "Name of the job."] + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[doc = "The base class for the secrets"] + #[serde(rename = "jobSecrets", default, skip_serializing_if = "Option::is_none")] + pub job_secrets: Option, +} +impl UnencryptedCredentials { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of unencrypted credentials for accessing device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnencryptedCredentialsList { + #[doc = "List of unencrypted credentials."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link for the next set of unencrypted credentials."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UnencryptedCredentialsList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job details for update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateJobDetails { + #[doc = "Contact Details."] + #[serde(rename = "contactDetails", default, skip_serializing_if = "Option::is_none")] + pub contact_details: Option, + #[doc = "Shipping address where customer wishes to receive the device."] + #[serde(rename = "shippingAddress", default, skip_serializing_if = "Option::is_none")] + pub shipping_address: Option, + #[doc = "Encryption key containing details about key to encrypt different keys."] + #[serde(rename = "keyEncryptionKey", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key: Option, + #[doc = "Package carrier details."] + #[serde(rename = "returnToCustomerPackageDetails", default, skip_serializing_if = "Option::is_none")] + pub return_to_customer_package_details: Option, +} +impl UpdateJobDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job Properties for update"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateJobProperties { + #[doc = "Job details for update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, +} +impl UpdateJobProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class defining User assigned identity details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentity { + #[doc = "The principal id of user assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client id of user assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserAssignedIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User assigned identity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedProperties { + #[doc = "Arm resource id for user assigned identity to be used to fetch MSI token."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl UserAssignedProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The requirements to validate customer address where the device needs to be shipped."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateAddress { + #[serde(flatten)] + pub validation_input_request: ValidationInputRequest, + #[doc = "Shipping address where customer wishes to receive the device."] + #[serde(rename = "shippingAddress")] + pub shipping_address: ShippingAddress, + #[doc = "Device type to be used for the job."] + #[serde(rename = "deviceType")] + pub device_type: validate_address::DeviceType, + #[doc = "Preferences related to the shipment logistics of the sku"] + #[serde(rename = "transportPreferences", default, skip_serializing_if = "Option::is_none")] + pub transport_preferences: Option, +} +impl ValidateAddress { + pub fn new( + validation_input_request: ValidationInputRequest, + shipping_address: ShippingAddress, + device_type: validate_address::DeviceType, + ) -> Self { + Self { + validation_input_request, + shipping_address, + device_type, + transport_preferences: None, + } + } +} +pub mod validate_address { + use super::*; + #[doc = "Device type to be used for the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBox, + DataBoxDisk, + DataBoxHeavy, + DataBoxCustomerDisk, + } +} +#[doc = "Minimum fields that must be present in any type of validation request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationInputRequest { + #[doc = "Identifies the type of validation request."] + #[serde(rename = "validationType")] + pub validation_type: validation_input_request::ValidationType, +} +impl ValidationInputRequest { + pub fn new(validation_type: validation_input_request::ValidationType) -> Self { + Self { validation_type } + } +} +pub mod validation_input_request { + use super::*; + #[doc = "Identifies the type of validation request."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationType { + ValidateAddress, + ValidateSubscriptionIsAllowedToCreateJob, + ValidatePreferences, + ValidateCreateOrderLimit, + ValidateSkuAvailability, + ValidateDataTransferDetails, + } +} +#[doc = "Minimum properties that should be present in each individual validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationInputResponse { + #[doc = "Identifies the type of validation response."] + #[serde(rename = "validationType")] + pub validation_type: validation_input_response::ValidationType, + #[doc = "Provides additional information about an http error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ValidationInputResponse { + pub fn new(validation_type: validation_input_response::ValidationType) -> Self { + Self { + validation_type, + error: None, + } + } +} +pub mod validation_input_response { + use super::*; + #[doc = "Identifies the type of validation response."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationType { + ValidateAddress, + ValidateSubscriptionIsAllowedToCreateJob, + ValidatePreferences, + ValidateCreateOrderLimit, + ValidateSkuAvailability, + ValidateDataTransferDetails, + } +} +#[doc = "Minimum request requirement of any validation category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationRequest { + #[doc = "Identify the nature of validation."] + #[serde(rename = "validationCategory")] + pub validation_category: validation_request::ValidationCategory, + #[doc = "List of request details contain validationType and its request as key and value respectively."] + #[serde(rename = "individualRequestDetails")] + pub individual_request_details: Vec, +} +impl ValidationRequest { + pub fn new( + validation_category: validation_request::ValidationCategory, + individual_request_details: Vec, + ) -> Self { + Self { + validation_category, + individual_request_details, + } + } +} +pub mod validation_request { + use super::*; + #[doc = "Identify the nature of validation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationCategory { + JobCreationValidation, + } +} +#[doc = "Response of pre job creation validations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidationResponse { + #[doc = "Properties of pre job creation validation response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ValidationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of pre job creation validation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidationResponseProperties { + #[doc = "Overall validation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "List of response details contain validationType and its response as key and value respectively."] + #[serde(rename = "individualResponseDetails", default, skip_serializing_if = "Vec::is_empty")] + pub individual_response_details: Vec, +} +impl ValidationResponseProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod validation_response_properties { + use super::*; + #[doc = "Overall validation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + AllValidToProceed, + InputsRevisitRequired, + CertainInputValidationsSkipped, + } +} +#[doc = "Provides details about resource creation and update time"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "A string identifier for the identity that created the resource"] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource: user, application, managedIdentity"] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)"] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "A string identifier for the identity that last modified the resource"] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource: user, application, managedIdentity"] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} diff --git a/services/mgmt/databox/src/package_2022_02/operations.rs b/services/mgmt/databox/src/package_2022_02/operations.rs new file mode 100644 index 0000000000..7ab18c78bc --- /dev/null +++ b/services/mgmt/databox/src/package_2022_02/operations.rs @@ -0,0 +1,1812 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn service(&self) -> service::Client { + service::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Jobs_List(#[from] jobs::list::Error), + #[error(transparent)] + Mitigate(#[from] mitigate::Error), + #[error(transparent)] + Jobs_MarkDevicesShipped(#[from] jobs::mark_devices_shipped::Error), + #[error(transparent)] + Service_ListAvailableSkusByResourceGroup(#[from] service::list_available_skus_by_resource_group::Error), + #[error(transparent)] + Service_ValidateAddress(#[from] service::validate_address::Error), + #[error(transparent)] + Service_ValidateInputsByResourceGroup(#[from] service::validate_inputs_by_resource_group::Error), + #[error(transparent)] + Service_ValidateInputs(#[from] service::validate_inputs::Error), + #[error(transparent)] + Jobs_ListByResourceGroup(#[from] jobs::list_by_resource_group::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + Jobs_Create(#[from] jobs::create::Error), + #[error(transparent)] + Jobs_Update(#[from] jobs::update::Error), + #[error(transparent)] + Jobs_Delete(#[from] jobs::delete::Error), + #[error(transparent)] + Jobs_BookShipmentPickUp(#[from] jobs::book_shipment_pick_up::Error), + #[error(transparent)] + Jobs_Cancel(#[from] jobs::cancel::Error), + #[error(transparent)] + Jobs_ListCredentials(#[from] jobs::list_credentials::Error), + #[error(transparent)] + Service_RegionConfiguration(#[from] service::region_configuration::Error), + #[error(transparent)] + Service_RegionConfigurationByResourceGroup(#[from] service::region_configuration_by_resource_group::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DataBox/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + skip_token: None, + } + } + pub fn mark_devices_shipped( + &self, + job_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + mark_devices_shipped_request: impl Into, + ) -> mark_devices_shipped::Builder { + mark_devices_shipped::Builder { + client: self.0.clone(), + job_name: job_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + mark_devices_shipped_request: mark_devices_shipped_request.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + skip_token: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + expand: None, + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + job_resource: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + job_resource: job_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + job_resource_update_parameter: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + job_resource_update_parameter: job_resource_update_parameter.into(), + if_match: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + } + } + pub fn book_shipment_pick_up( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + shipment_pick_up_request: impl Into, + ) -> book_shipment_pick_up::Builder { + book_shipment_pick_up::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + shipment_pick_up_request: shipment_pick_up_request.into(), + } + } + pub fn cancel( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + cancellation_reason: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + cancellation_reason: cancellation_reason.into(), + } + } + pub fn list_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + job_name: impl Into, + ) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + job_name: job_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBox/jobs", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod mark_devices_shipped { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) mark_devices_shipped_request: models::MarkDevicesShippedRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}/markDevicesShipped", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.mark_devices_shipped_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::JobResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + pub(crate) job_resource: models::JobResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.job_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::JobResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + pub(crate) job_resource_update_parameter: models::JobResourceUpdateParameter, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.job_resource_update_parameter).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod book_shipment_pick_up { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + pub(crate) shipment_pick_up_request: models::ShipmentPickUpRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}/bookShipmentPickUp", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.shipment_pick_up_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ShipmentPickUpResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + pub(crate) cancellation_reason: models::CancellationReason, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cancellation_reason).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}/listCredentials", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UnencryptedCredentialsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn mitigate( + &self, + job_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + mitigate_job_request: impl Into, + ) -> mitigate::Builder { + mitigate::Builder { + client: self.clone(), + job_name: job_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + mitigate_job_request: mitigate_job_request.into(), + } + } +} +pub mod mitigate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) job_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) mitigate_job_request: models::MitigateJobRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/jobs/{}/mitigate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.mitigate_job_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_available_skus_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + available_sku_request: impl Into, + ) -> list_available_skus_by_resource_group::Builder { + list_available_skus_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + available_sku_request: available_sku_request.into(), + } + } + pub fn validate_address( + &self, + subscription_id: impl Into, + location: impl Into, + validate_address: impl Into, + ) -> validate_address::Builder { + validate_address::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + validate_address: validate_address.into(), + } + } + pub fn validate_inputs_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + validation_request: impl Into, + ) -> validate_inputs_by_resource_group::Builder { + validate_inputs_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + validation_request: validation_request.into(), + } + } + pub fn validate_inputs( + &self, + subscription_id: impl Into, + location: impl Into, + validation_request: impl Into, + ) -> validate_inputs::Builder { + validate_inputs::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + validation_request: validation_request.into(), + } + } + pub fn region_configuration( + &self, + subscription_id: impl Into, + location: impl Into, + region_configuration_request: impl Into, + ) -> region_configuration::Builder { + region_configuration::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + region_configuration_request: region_configuration_request.into(), + } + } + pub fn region_configuration_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + region_configuration_request: impl Into, + ) -> region_configuration_by_resource_group::Builder { + region_configuration_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + region_configuration_request: region_configuration_request.into(), + } + } + } + pub mod list_available_skus_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) available_sku_request: models::AvailableSkuRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/locations/{}/availableSkus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.available_sku_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableSkusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_address { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) validate_address: models::ValidateAddress, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBox/locations/{}/validateAddress", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validate_address).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AddressValidationOutput = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_inputs_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) validation_request: models::ValidationRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/locations/{}/validateInputs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validation_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_inputs { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) validation_request: models::ValidationRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBox/locations/{}/validateInputs", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.validation_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod region_configuration { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) region_configuration_request: models::RegionConfigurationRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBox/locations/{}/regionConfiguration", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.region_configuration_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegionConfigurationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod region_configuration_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ApiError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) region_configuration_request: models::RegionConfigurationRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBox/locations/{}/regionConfiguration", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.region_configuration_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RegionConfigurationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/databoxedge/Cargo.toml b/services/mgmt/databoxedge/Cargo.toml index 4709a15961..61a855de4f 100644 --- a/services/mgmt/databoxedge/Cargo.toml +++ b/services/mgmt/databoxedge/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_databoxedge" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-06-01-preview", "package-2021-02-01", "package-2021-02-01-preview", "package-2020-12-01"] +features = ["no-default-tag", "package-2022-04-01-preview", "package-2021-06-01-preview", "package-2021-02-01", "package-2021-02-01-preview"] [features] default = ["package-2021-06-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-04-01-preview" = [] "package-2021-06-01" = [] "package-2021-06-01-preview" = [] "package-2021-02-01" = [] diff --git a/services/mgmt/databoxedge/README.md b/services/mgmt/databoxedge/README.md index 1c47d28f79..256b082c98 100644 --- a/services/mgmt/databoxedge/README.md +++ b/services/mgmt/databoxedge/README.md @@ -10,6 +10,7 @@ The default tag is `package-2021-06-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-04-01-preview` has 77 operations from 1 API versions: `2022-04-01-preview`. Use crate feature `package-2022-04-01-preview` to enable. The operations will be in the `package_2022_04_01_preview` module. - `package-2021-06-01` has 75 operations from 1 API versions: `2021-06-01`. Use crate feature `package-2021-06-01` to enable. The operations will be in the `package_2021_06_01` module. - `package-2021-06-01-preview` has 75 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-2021-06-01-preview` to enable. The operations will be in the `package_2021_06_01_preview` module. - `package-2021-02-01` has 75 operations from 1 API versions: `2021-02-01`. Use crate feature `package-2021-02-01` to enable. The operations will be in the `package_2021_02_01` module. diff --git a/services/mgmt/databoxedge/src/lib.rs b/services/mgmt/databoxedge/src/lib.rs index 37ca4507d1..465e39c69a 100644 --- a/services/mgmt/databoxedge/src/lib.rs +++ b/services/mgmt/databoxedge/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-04-01-preview")] +pub mod package_2022_04_01_preview; +#[cfg(all(feature = "package-2022-04-01-preview", not(feature = "no-default-tag")))] +pub use package_2022_04_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-06-01")] pub mod package_2021_06_01; #[cfg(all(feature = "package-2021-06-01", not(feature = "no-default-tag")))] diff --git a/services/mgmt/databoxedge/src/package_2021_06_01/models.rs b/services/mgmt/databoxedge/src/package_2021_06_01/models.rs index fd1bce33e4..4d6cc90394 100644 --- a/services/mgmt/databoxedge/src/package_2021_06_01/models.rs +++ b/services/mgmt/databoxedge/src/package_2021_06_01/models.rs @@ -848,6 +848,24 @@ pub struct DataBoxEdgeDeviceExtendedInfoProperties { #[doc = "Device secrets, will be returned only with ODataFilter $expand=deviceSecrets"] #[serde(rename = "deviceSecrets", default, skip_serializing_if = "Option::is_none")] pub device_secrets: Option, + #[doc = "Cluster Witness Type"] + #[serde(rename = "clusterWitnessType", default, skip_serializing_if = "Option::is_none")] + pub cluster_witness_type: Option, + #[doc = "The witness location of file share."] + #[serde(rename = "fileShareWitnessLocation", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_location: Option, + #[doc = "The username of file share."] + #[serde(rename = "fileShareWitnessUsername", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_username: Option, + #[doc = "The Cloud Witness Storage account name."] + #[serde(rename = "cloudWitnessStorageAccountName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_account_name: Option, + #[doc = "The Container for cloud witness in the storage account."] + #[serde(rename = "cloudWitnessContainerName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_container_name: Option, + #[doc = "The Azure service endpoint of the cloud witness storage account."] + #[serde(rename = "cloudWitnessStorageEndpoint", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_endpoint: Option, } impl DataBoxEdgeDeviceExtendedInfoProperties { pub fn new() -> Self { @@ -866,6 +884,13 @@ pub mod data_box_edge_device_extended_info_properties { KeyVaultSyncing, KeyVaultNotSynced, } + #[doc = "Cluster Witness Type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClusterWitnessType { + None, + Cloud, + FileShare, + } } #[doc = "The collection of Data Box Edge/Gateway devices."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] diff --git a/services/mgmt/databoxedge/src/package_2021_06_01_preview/models.rs b/services/mgmt/databoxedge/src/package_2021_06_01_preview/models.rs index ebb8a64a7a..ecb6c6653d 100644 --- a/services/mgmt/databoxedge/src/package_2021_06_01_preview/models.rs +++ b/services/mgmt/databoxedge/src/package_2021_06_01_preview/models.rs @@ -848,6 +848,24 @@ pub struct DataBoxEdgeDeviceExtendedInfoProperties { #[doc = "Device secrets, will be returned only with ODataFilter $expand=deviceSecrets"] #[serde(rename = "deviceSecrets", default, skip_serializing_if = "Option::is_none")] pub device_secrets: Option, + #[doc = "Cluster Witness Type"] + #[serde(rename = "clusterWitnessType", default, skip_serializing_if = "Option::is_none")] + pub cluster_witness_type: Option, + #[doc = "The witness location of file share."] + #[serde(rename = "fileShareWitnessLocation", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_location: Option, + #[doc = "The username of file share."] + #[serde(rename = "fileShareWitnessUsername", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_username: Option, + #[doc = "The Cloud Witness Storage account name."] + #[serde(rename = "cloudWitnessStorageAccountName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_account_name: Option, + #[doc = "The Container for cloud witness in the storage account."] + #[serde(rename = "cloudWitnessContainerName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_container_name: Option, + #[doc = "The Azure service endpoint of the cloud witness storage account."] + #[serde(rename = "cloudWitnessStorageEndpoint", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_endpoint: Option, } impl DataBoxEdgeDeviceExtendedInfoProperties { pub fn new() -> Self { @@ -866,6 +884,13 @@ pub mod data_box_edge_device_extended_info_properties { KeyVaultSyncing, KeyVaultNotSynced, } + #[doc = "Cluster Witness Type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClusterWitnessType { + None, + Cloud, + FileShare, + } } #[doc = "The collection of Data Box Edge/Gateway devices."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] diff --git a/services/mgmt/databoxedge/src/package_2022_04_01_preview/mod.rs b/services/mgmt/databoxedge/src/package_2022_04_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/databoxedge/src/package_2022_04_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/databoxedge/src/package_2022_04_01_preview/models.rs b/services/mgmt/databoxedge/src/package_2022_04_01_preview/models.rs new file mode 100644 index 0000000000..d568dac557 --- /dev/null +++ b/services/mgmt/databoxedge/src/package_2022_04_01_preview/models.rs @@ -0,0 +1,4648 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Represents the base class for all object models."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArmBaseModel { + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ArmBaseModel { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Role Addon"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Addon { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "Addon type."] + pub kind: addon::Kind, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Addon { + pub fn new(kind: addon::Kind) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + kind, + system_data: None, + } + } +} +pub mod addon { + use super::*; + #[doc = "Addon type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + IotEdge, + ArcForKubernetes, + } +} +#[doc = "Collection of all the Role addon on the Azure Stack Edge device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddonList { + #[doc = "The Value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AddonList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The shipping address of the customer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Address { + #[doc = "The address line1."] + #[serde(rename = "addressLine1", default, skip_serializing_if = "Option::is_none")] + pub address_line1: Option, + #[doc = "The address line2."] + #[serde(rename = "addressLine2", default, skip_serializing_if = "Option::is_none")] + pub address_line2: Option, + #[doc = "The address line3."] + #[serde(rename = "addressLine3", default, skip_serializing_if = "Option::is_none")] + pub address_line3: Option, + #[doc = "The postal code."] + #[serde(rename = "postalCode", default, skip_serializing_if = "Option::is_none")] + pub postal_code: Option, + #[doc = "The city name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "The state name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The country name."] + pub country: String, +} +impl Address { + pub fn new(country: String) -> Self { + Self { + address_line1: None, + address_line2: None, + address_line3: None, + postal_code: None, + city: None, + state: None, + country, + } + } +} +#[doc = "Alert on the data box edge/gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Alert { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "Properties of alert."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Alert { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error details for the alert."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertErrorDetails { + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Error Message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Number of occurrences."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub occurrences: Option, +} +impl AlertErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of alerts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertList { + #[doc = "The value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AlertList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of alert."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertProperties { + #[doc = "Alert title."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Alert type."] + #[serde(rename = "alertType", default, skip_serializing_if = "Option::is_none")] + pub alert_type: Option, + #[doc = "UTC time when the alert appeared."] + #[serde(rename = "appearedAtDateTime", default, skip_serializing_if = "Option::is_none")] + pub appeared_at_date_time: Option, + #[doc = "Alert recommendation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommendation: Option, + #[doc = "Severity of the alert."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "Error details for the alert."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Option::is_none")] + pub error_details: Option, + #[doc = "Alert details."] + #[serde(rename = "detailedInformation", default, skip_serializing_if = "Option::is_none")] + pub detailed_information: Option, +} +impl AlertProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod alert_properties { + use super::*; + #[doc = "Severity of the alert."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + Informational, + Warning, + Critical, + } +} +#[doc = "Arc Addon."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ArcAddon { + #[serde(flatten)] + pub addon: Addon, + #[doc = "Arc addon properties."] + pub properties: ArcAddonProperties, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ArcAddon { + pub fn new(addon: Addon, properties: ArcAddonProperties) -> Self { + Self { + addon, + properties, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "Arc addon properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ArcAddonProperties { + #[doc = "Arc resource subscription Id"] + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[doc = "Arc resource group name"] + #[serde(rename = "resourceGroupName")] + pub resource_group_name: String, + #[doc = "Arc resource Name"] + #[serde(rename = "resourceName")] + pub resource_name: String, + #[doc = "Arc resource location"] + #[serde(rename = "resourceLocation")] + pub resource_location: String, + #[doc = "Arc resource version"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Host OS supported by the Arc addon."] + #[serde(rename = "hostPlatform", default, skip_serializing_if = "Option::is_none")] + pub host_platform: Option, + #[doc = "Platform where the runtime is hosted."] + #[serde(rename = "hostPlatformType", default, skip_serializing_if = "Option::is_none")] + pub host_platform_type: Option, + #[doc = "Addon Provisioning State"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ArcAddonProperties { + pub fn new(subscription_id: String, resource_group_name: String, resource_name: String, resource_location: String) -> Self { + Self { + subscription_id, + resource_group_name, + resource_name, + resource_location, + version: None, + host_platform: None, + host_platform_type: None, + provisioning_state: None, + } + } +} +pub mod arc_addon_properties { + use super::*; + #[doc = "Host OS supported by the Arc addon."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatform { + Windows, + Linux, + } + #[doc = "Platform where the runtime is hosted."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatformType { + KubernetesCluster, + #[serde(rename = "LinuxVM")] + LinuxVm, + } + #[doc = "Addon Provisioning State"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Invalid, + Creating, + Created, + Updating, + Reconfiguring, + Failed, + Deleting, + } +} +#[doc = "Represent the secrets intended for encryption with asymmetric key pair."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsymmetricEncryptedSecret { + #[doc = "The value of the secret."] + pub value: String, + #[doc = "Thumbprint certificate used to encrypt \\\"Value\\\". If the value is unencrypted, it will be null."] + #[serde(rename = "encryptionCertThumbprint", default, skip_serializing_if = "Option::is_none")] + pub encryption_cert_thumbprint: Option, + #[doc = "The algorithm used to encrypt \"Value\"."] + #[serde(rename = "encryptionAlgorithm")] + pub encryption_algorithm: asymmetric_encrypted_secret::EncryptionAlgorithm, +} +impl AsymmetricEncryptedSecret { + pub fn new(value: String, encryption_algorithm: asymmetric_encrypted_secret::EncryptionAlgorithm) -> Self { + Self { + value, + encryption_cert_thumbprint: None, + encryption_algorithm, + } + } +} +pub mod asymmetric_encrypted_secret { + use super::*; + #[doc = "The algorithm used to encrypt \"Value\"."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EncryptionAlgorithm { + None, + #[serde(rename = "AES256")] + Aes256, + #[serde(rename = "RSAES_PKCS1_v_1_5")] + RsaesPkcs1V15, + } +} +#[doc = "Authentication mechanism for IoT devices."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Authentication { + #[doc = "Symmetric key for authentication."] + #[serde(rename = "symmetricKey", default, skip_serializing_if = "Option::is_none")] + pub symmetric_key: Option, +} +impl Authentication { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure container mapping of the endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureContainerInfo { + #[doc = "ID of the storage account credential used to access storage."] + #[serde(rename = "storageAccountCredentialId")] + pub storage_account_credential_id: String, + #[doc = "Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob)."] + #[serde(rename = "containerName")] + pub container_name: String, + #[doc = "Storage format used for the file represented by the share."] + #[serde(rename = "dataFormat")] + pub data_format: azure_container_info::DataFormat, +} +impl AzureContainerInfo { + pub fn new(storage_account_credential_id: String, container_name: String, data_format: azure_container_info::DataFormat) -> Self { + Self { + storage_account_credential_id, + container_name, + data_format, + } + } +} +pub mod azure_container_info { + use super::*; + #[doc = "Storage format used for the file represented by the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataFormat { + BlockBlob, + PageBlob, + AzureFile, + } +} +#[doc = "The bandwidth schedule details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BandwidthSchedule { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of the bandwidth schedule."] + pub properties: BandwidthScheduleProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl BandwidthSchedule { + pub fn new(properties: BandwidthScheduleProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The properties of the bandwidth schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BandwidthScheduleProperties { + #[doc = "The start time of the schedule in UTC."] + pub start: String, + #[doc = "The stop time of the schedule in UTC."] + pub stop: String, + #[doc = "The bandwidth rate in Mbps."] + #[serde(rename = "rateInMbps")] + pub rate_in_mbps: i32, + #[doc = "The days of the week when this schedule is applicable."] + pub days: Vec, +} +impl BandwidthScheduleProperties { + pub fn new(start: String, stop: String, rate_in_mbps: i32, days: Vec) -> Self { + Self { + start, + stop, + rate_in_mbps, + days, + } + } +} +#[doc = "The collection of bandwidth schedules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BandwidthSchedulesList { + #[doc = "The list of bandwidth schedules."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BandwidthSchedulesList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The mapping between a particular client IP and the type of access client has on the NFS share."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientAccessRight { + #[doc = "IP of the client."] + pub client: String, + #[doc = "Type of access to be allowed for the client."] + #[serde(rename = "accessPermission")] + pub access_permission: client_access_right::AccessPermission, +} +impl ClientAccessRight { + pub fn new(client: String, access_permission: client_access_right::AccessPermission) -> Self { + Self { client, access_permission } + } +} +pub mod client_access_right { + use super::*; + #[doc = "Type of access to be allowed for the client."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessPermission { + NoAccess, + ReadOnly, + ReadWrite, + } +} +#[doc = "The preview of Virtual Machine Cloud Management from the Azure supports deploying and managing VMs on your Azure Stack Edge device from Azure Portal. \r\nFor more information, refer to: https://docs.microsoft.com/en-us/azure/databox-online/azure-stack-edge-gpu-virtual-machine-overview\r\nBy using this feature, you agree to the preview legal terms. See the https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/ for additional details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudEdgeManagementRole { + #[serde(flatten)] + pub role: Role, + #[doc = "CloudEdgeManagement Role properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CloudEdgeManagementRole { + pub fn new(role: Role) -> Self { + Self { + role, + properties: None, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "CloudEdgeManagement Role properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudEdgeManagementRoleProperties { + #[doc = "Local Edge Management Status"] + #[serde(rename = "localManagementStatus", default, skip_serializing_if = "Option::is_none")] + pub local_management_status: Option, + #[doc = "Details about Edge Profile for the resource"] + #[serde(rename = "edgeProfile", default, skip_serializing_if = "Option::is_none")] + pub edge_profile: Option, + #[doc = "Role status."] + #[serde(rename = "roleStatus")] + pub role_status: cloud_edge_management_role_properties::RoleStatus, +} +impl CloudEdgeManagementRoleProperties { + pub fn new(role_status: cloud_edge_management_role_properties::RoleStatus) -> Self { + Self { + local_management_status: None, + edge_profile: None, + role_status, + } + } +} +pub mod cloud_edge_management_role_properties { + use super::*; + #[doc = "Local Edge Management Status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LocalManagementStatus { + Enabled, + Disabled, + } + #[doc = "Role status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RoleStatus { + Enabled, + Disabled, + } +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cluster Compute Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterCapacityViewData { + #[doc = "The FQDN of the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "Cluster GPU Data."] + #[serde(rename = "gpuCapacity", default, skip_serializing_if = "Option::is_none")] + pub gpu_capacity: Option, + #[doc = "NodeCapacityInfo defines the required information to determine the placement of a VM."] + #[serde(rename = "memoryCapacity", default, skip_serializing_if = "Option::is_none")] + pub memory_capacity: Option, + #[doc = "The last time at which the ClusterCapacityViewData was set."] + #[serde(rename = "lastRefreshedTime", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_time: Option, + #[doc = "The total # of vCPUs provisioned by non-HPN VM per appliance."] + #[serde(rename = "totalProvisionedNonHpnCores", default, skip_serializing_if = "Option::is_none")] + pub total_provisioned_non_hpn_cores: Option, +} +impl ClusterCapacityViewData { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cluster GPU Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterGpuCapacity { + #[doc = "The cluster GPU Type."] + #[serde(rename = "gpuType", default, skip_serializing_if = "Option::is_none")] + pub gpu_type: Option, + #[doc = "The used GPU units count in the cluster."] + #[serde(rename = "gpuUsedUnitsCount", default, skip_serializing_if = "Option::is_none")] + pub gpu_used_units_count: Option, + #[doc = "The free GPU units count in the cluster."] + #[serde(rename = "gpuFreeUnitsCount", default, skip_serializing_if = "Option::is_none")] + pub gpu_free_units_count: Option, + #[doc = "The GPU units count reserved for failover in the cluster."] + #[serde(rename = "gpuReservedForFailoverUnitsCount", default, skip_serializing_if = "Option::is_none")] + pub gpu_reserved_for_failover_units_count: Option, + #[doc = "The total GPU units count in the cluster."] + #[serde(rename = "gpuTotalUnitsCount", default, skip_serializing_if = "Option::is_none")] + pub gpu_total_units_count: Option, +} +impl ClusterGpuCapacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NodeCapacityInfo defines the required information to determine the placement of a VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterMemoryCapacity { + #[doc = "The free memory in the cluster in MB."] + #[serde(rename = "clusterFreeMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_free_memory_mb: Option, + #[doc = "The used memory in the cluster in MB."] + #[serde(rename = "clusterUsedMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_used_memory_mb: Option, + #[doc = "The failover memory in the cluster in MB."] + #[serde(rename = "clusterFailoverMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_failover_memory_mb: Option, + #[doc = "The fragmentation memory in the cluster in MB."] + #[serde(rename = "clusterFragmentationMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_fragmentation_memory_mb: Option, + #[doc = "The memory reserved for Hyper-V in the cluster in MB."] + #[serde(rename = "clusterHypervReserveMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_hyperv_reserve_memory_mb: Option, + #[doc = "The memory of the Infra VM in the cluster in MB."] + #[serde(rename = "clusterInfraVmMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_infra_vm_memory_mb: Option, + #[doc = "The total memory in the cluster in MB."] + #[serde(rename = "clusterTotalMemoryMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_total_memory_mb: Option, + #[doc = "The non-failover memory in the cluster in MB."] + #[serde(rename = "clusterNonFailoverVmMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_non_failover_vm_mb: Option, + #[doc = "The memory used by VMs in the cluster in MB."] + #[serde(rename = "clusterMemoryUsedByVmsMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_memory_used_by_vms_mb: Option, +} +impl ClusterMemoryCapacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cluster Storage Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterStorageViewData { + #[doc = "Total storage on the cluster in MB."] + #[serde(rename = "clusterTotalStorageMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_total_storage_mb: Option, + #[doc = "The available or free storage on the cluster in MB."] + #[serde(rename = "clusterFreeStorageMb", default, skip_serializing_if = "Option::is_none")] + pub cluster_free_storage_mb: Option, +} +impl ClusterStorageViewData { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Cni configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CniConfig { + #[doc = "Cni type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Cni version"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Pod Subnet"] + #[serde(rename = "podSubnet", default, skip_serializing_if = "Option::is_none")] + pub pod_subnet: Option, + #[doc = "Service subnet"] + #[serde(rename = "serviceSubnet", default, skip_serializing_if = "Option::is_none")] + pub service_subnet: Option, + #[doc = "ComponentType of the Kubernetes node."] + #[serde(rename = "componentType", default, skip_serializing_if = "Option::is_none")] + pub component_type: Option, +} +impl CniConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod cni_config { + use super::*; + #[doc = "ComponentType of the Kubernetes node."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentType { + Invalid, + Cluster, + Node, + Etcd, + #[serde(rename = "CNI")] + Cni, + LoadBalancer, + } +} +#[doc = "Compute infrastructure Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ComputeResource { + #[doc = "Processor count"] + #[serde(rename = "processorCount")] + pub processor_count: i32, + #[doc = "Memory in GB"] + #[serde(rename = "memoryInGB")] + pub memory_in_gb: i64, +} +impl ComputeResource { + pub fn new(processor_count: i32, memory_in_gb: i64) -> Self { + Self { + processor_count, + memory_in_gb, + } + } +} +#[doc = "This contains the compute information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ComputeVersionInformation { + #[doc = "Kubernetes Version"] + #[serde(rename = "kubernetesVersion", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_version: Option, + #[doc = "IOTEdge Version"] + #[serde(rename = "iotEdgeVersion", default, skip_serializing_if = "Option::is_none")] + pub iot_edge_version: Option, + #[doc = "Azure Arc Version"] + #[serde(rename = "azureArcVersion", default, skip_serializing_if = "Option::is_none")] + pub azure_arc_version: Option, +} +impl ComputeVersionInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains all the contact details of the customer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactDetails { + #[doc = "The contact person name."] + #[serde(rename = "contactPerson")] + pub contact_person: String, + #[doc = "The name of the company."] + #[serde(rename = "companyName")] + pub company_name: String, + #[doc = "The phone number."] + pub phone: String, + #[doc = "The email list."] + #[serde(rename = "emailList")] + pub email_list: Vec, +} +impl ContactDetails { + pub fn new(contact_person: String, company_name: String, phone: String, email_list: Vec) -> Self { + Self { + contact_person, + company_name, + phone, + email_list, + } + } +} +#[doc = "Represents a container on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Container { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The container properties."] + pub properties: ContainerProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Container { + pub fn new(properties: ContainerProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "Collection of all the containers on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerList { + #[doc = "The list of containers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ContainerList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The container properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerProperties { + #[doc = "Current status of the container."] + #[serde(rename = "containerStatus", default, skip_serializing_if = "Option::is_none")] + pub container_status: Option, + #[doc = "DataFormat for Container"] + #[serde(rename = "dataFormat")] + pub data_format: container_properties::DataFormat, + #[doc = "Fields for tracking refresh job on the share or container."] + #[serde(rename = "refreshDetails", default, skip_serializing_if = "Option::is_none")] + pub refresh_details: Option, + #[doc = "The UTC time when container got created."] + #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")] + pub created_date_time: Option, +} +impl ContainerProperties { + pub fn new(data_format: container_properties::DataFormat) -> Self { + Self { + container_status: None, + data_format, + refresh_details: None, + created_date_time: None, + } + } +} +pub mod container_properties { + use super::*; + #[doc = "Current status of the container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ContainerStatus { + #[serde(rename = "OK")] + Ok, + Offline, + Unknown, + Updating, + NeedsAttention, + } + #[doc = "DataFormat for Container"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataFormat { + BlockBlob, + PageBlob, + AzureFile, + } +} +#[doc = "DC Access code in the case of Self Managed Shipping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DcAccessCode { + #[doc = "DCAccessCode Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DcAccessCode { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DCAccessCode Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DcAccessCodeProperties { + #[doc = "DCAccess Code for the Self Managed shipment."] + #[serde(rename = "authCode", default, skip_serializing_if = "Option::is_none")] + pub auth_code: Option, +} +impl DcAccessCodeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxEdgeDevice { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed."] + pub location: String, + #[doc = "The list of tags that describe the device. These tags can be used to view and group this device (across resource groups)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The SKU type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The etag for the devices."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Msi identity details of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "The kind of the device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The properties of the Data Box Edge/Gateway device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DataBoxEdgeDevice { + pub fn new(location: String) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + location, + tags: None, + sku: None, + etag: None, + identity: None, + kind: None, + system_data: None, + properties: None, + } + } +} +pub mod data_box_edge_device { + use super::*; + #[doc = "The kind of the device."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + AzureDataBoxGateway, + AzureStackEdge, + AzureStackHub, + AzureModularDataCentre, + } +} +#[doc = "The extended Info of the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDeviceExtendedInfo { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of the Data Box Edge/Gateway device extended info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DataBoxEdgeDeviceExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Data Box Edge/Gateway device extended info patch."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDeviceExtendedInfoPatch { + #[doc = "The Key Vault ARM Id for client secrets"] + #[serde(rename = "clientSecretStoreId", default, skip_serializing_if = "Option::is_none")] + pub client_secret_store_id: Option, + #[doc = "The url to access the Client Key Vault"] + #[serde(rename = "clientSecretStoreUrl", default, skip_serializing_if = "Option::is_none")] + pub client_secret_store_url: Option, + #[doc = "The name for Channel Integrity Key stored in the Client Key Vault"] + #[serde(rename = "channelIntegrityKeyName", default, skip_serializing_if = "Option::is_none")] + pub channel_integrity_key_name: Option, + #[doc = "The version of Channel Integrity Key stored in the Client Key Vault"] + #[serde(rename = "channelIntegrityKeyVersion", default, skip_serializing_if = "Option::is_none")] + pub channel_integrity_key_version: Option, + #[doc = "For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable."] + #[serde(rename = "syncStatus", default, skip_serializing_if = "Option::is_none")] + pub sync_status: Option, +} +impl DataBoxEdgeDeviceExtendedInfoPatch { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_edge_device_extended_info_patch { + use super::*; + #[doc = "For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SyncStatus { + KeyVaultSynced, + KeyVaultSyncFailed, + KeyVaultNotConfigured, + KeyVaultSyncPending, + KeyVaultSyncing, + KeyVaultNotSynced, + } +} +#[doc = "The properties of the Data Box Edge/Gateway device extended info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDeviceExtendedInfoProperties { + #[doc = "The digital signature of encrypted certificate."] + #[serde(rename = "encryptionKeyThumbprint", default, skip_serializing_if = "Option::is_none")] + pub encryption_key_thumbprint: Option, + #[doc = "The public part of the encryption certificate. Client uses this to encrypt any secret."] + #[serde(rename = "encryptionKey", default, skip_serializing_if = "Option::is_none")] + pub encryption_key: Option, + #[doc = "The Resource ID of the Resource."] + #[serde(rename = "resourceKey", default, skip_serializing_if = "Option::is_none")] + pub resource_key: Option, + #[doc = "The Key Vault ARM Id for client secrets"] + #[serde(rename = "clientSecretStoreId", default, skip_serializing_if = "Option::is_none")] + pub client_secret_store_id: Option, + #[doc = "The url to access the Client Key Vault"] + #[serde(rename = "clientSecretStoreUrl", default, skip_serializing_if = "Option::is_none")] + pub client_secret_store_url: Option, + #[doc = "The name of Channel Integrity Key stored in the Client Key Vault"] + #[serde(rename = "channelIntegrityKeyName", default, skip_serializing_if = "Option::is_none")] + pub channel_integrity_key_name: Option, + #[doc = "The version of Channel Integrity Key stored in the Client Key Vault"] + #[serde(rename = "channelIntegrityKeyVersion", default, skip_serializing_if = "Option::is_none")] + pub channel_integrity_key_version: Option, + #[doc = "Key vault sync status"] + #[serde(rename = "keyVaultSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub key_vault_sync_status: Option, + #[doc = "Device secrets, will be returned only with ODataFilter $expand=deviceSecrets"] + #[serde(rename = "deviceSecrets", default, skip_serializing_if = "Option::is_none")] + pub device_secrets: Option, + #[doc = "Cluster Witness Type"] + #[serde(rename = "clusterWitnessType", default, skip_serializing_if = "Option::is_none")] + pub cluster_witness_type: Option, + #[doc = "The witness location of file share."] + #[serde(rename = "fileShareWitnessLocation", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_location: Option, + #[doc = "The username of file share."] + #[serde(rename = "fileShareWitnessUsername", default, skip_serializing_if = "Option::is_none")] + pub file_share_witness_username: Option, + #[doc = "The Cloud Witness Storage account name."] + #[serde(rename = "cloudWitnessStorageAccountName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_account_name: Option, + #[doc = "The Container for cloud witness in the storage account."] + #[serde(rename = "cloudWitnessContainerName", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_container_name: Option, + #[doc = "The Azure service endpoint of the cloud witness storage account."] + #[serde(rename = "cloudWitnessStorageEndpoint", default, skip_serializing_if = "Option::is_none")] + pub cloud_witness_storage_endpoint: Option, +} +impl DataBoxEdgeDeviceExtendedInfoProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_edge_device_extended_info_properties { + use super::*; + #[doc = "Key vault sync status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyVaultSyncStatus { + KeyVaultSynced, + KeyVaultSyncFailed, + KeyVaultNotConfigured, + KeyVaultSyncPending, + KeyVaultSyncing, + KeyVaultNotSynced, + } + #[doc = "Cluster Witness Type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClusterWitnessType { + None, + Cloud, + FileShare, + } +} +#[doc = "The collection of Data Box Edge/Gateway devices."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDeviceList { + #[doc = "The list of Data Box Edge/Gateway devices."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DataBoxEdgeDeviceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Data Box Edge/Gateway device patch."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDevicePatch { + #[doc = "The tags attached to the Data Box Edge/Gateway resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Msi identity details of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "The Data Box Edge/Gateway device properties patch."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DataBoxEdgeDevicePatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDeviceProperties { + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The status of the Data Box Edge/Gateway device."] + #[serde(rename = "dataBoxEdgeDeviceStatus", default, skip_serializing_if = "Option::is_none")] + pub data_box_edge_device_status: Option, + #[doc = "The Serial Number of Data Box Edge/Gateway device."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "The Description of the Data Box Edge/Gateway device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The description of the Data Box Edge/Gateway device model."] + #[serde(rename = "modelDescription", default, skip_serializing_if = "Option::is_none")] + pub model_description: Option, + #[doc = "The type of the Data Box Edge/Gateway device."] + #[serde(rename = "deviceType", default, skip_serializing_if = "Option::is_none")] + pub device_type: Option, + #[doc = "The Data Box Edge/Gateway device name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The Data Box Edge/Gateway device culture."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub culture: Option, + #[doc = "The Data Box Edge/Gateway device model."] + #[serde(rename = "deviceModel", default, skip_serializing_if = "Option::is_none")] + pub device_model: Option, + #[doc = "The Data Box Edge/Gateway device software version."] + #[serde(rename = "deviceSoftwareVersion", default, skip_serializing_if = "Option::is_none")] + pub device_software_version: Option, + #[doc = "The Data Box Edge/Gateway device local capacity in MB."] + #[serde(rename = "deviceLocalCapacity", default, skip_serializing_if = "Option::is_none")] + pub device_local_capacity: Option, + #[doc = "The Data Box Edge/Gateway device timezone."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[doc = "The device software version number of the device (eg: 1.2.18105.6)."] + #[serde(rename = "deviceHcsVersion", default, skip_serializing_if = "Option::is_none")] + pub device_hcs_version: Option, + #[doc = "Type of compute roles configured."] + #[serde(rename = "configuredRoleTypes", default, skip_serializing_if = "Vec::is_empty")] + pub configured_role_types: Vec, + #[doc = "The number of nodes in the cluster."] + #[serde(rename = "nodeCount", default, skip_serializing_if = "Option::is_none")] + pub node_count: Option, + #[doc = "Fields for tracking resource move"] + #[serde(rename = "resourceMoveDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_move_details: Option, + #[doc = "Details about Edge Profile for the resource"] + #[serde(rename = "edgeProfile", default, skip_serializing_if = "Option::is_none")] + pub edge_profile: Option, + #[doc = "Wraps data-residency related information for edge-resource and this should be used with ARM layer."] + #[serde(rename = "dataResidency", default, skip_serializing_if = "Option::is_none")] + pub data_residency: Option, + #[doc = "This contains the compute information"] + #[serde(rename = "computeVersionInformation", default, skip_serializing_if = "Option::is_none")] + pub compute_version_information: Option, + #[doc = "Type of Kubernetes Platform"] + #[serde(rename = "kubernetesPlatform", default, skip_serializing_if = "Option::is_none")] + pub kubernetes_platform: Option, +} +impl DataBoxEdgeDeviceProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_edge_device_properties { + use super::*; + #[doc = "The status of the Data Box Edge/Gateway device."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataBoxEdgeDeviceStatus { + ReadyToSetup, + Online, + Offline, + NeedsAttention, + Disconnected, + PartiallyDisconnected, + Maintenance, + } + #[doc = "The type of the Data Box Edge/Gateway device."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeviceType { + DataBoxEdgeDevice, + } +} +#[doc = "The Data Box Edge/Gateway device properties patch."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeDevicePropertiesPatch { + #[doc = "The Data Box Edge/Gateway Edge Profile patch."] + #[serde(rename = "edgeProfile", default, skip_serializing_if = "Option::is_none")] + pub edge_profile: Option, +} +impl DataBoxEdgeDevicePropertiesPatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource Move details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataBoxEdgeMoveRequest { + #[doc = "Target resource group ARMId"] + #[serde(rename = "targetResourceGroup")] + pub target_resource_group: String, + #[doc = "List of resources to be moved"] + pub resources: Vec, +} +impl DataBoxEdgeMoveRequest { + pub fn new(target_resource_group: String, resources: Vec) -> Self { + Self { + target_resource_group, + resources, + } + } +} +#[doc = "The Sku information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeSku { + #[doc = "The type of the resource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "The Sku name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Sku kind."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "The Sku tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The Sku kind."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[doc = "The Sku family."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[doc = "Availability of the Sku for the region."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "The API versions in which Sku is available."] + #[serde(rename = "apiVersions", default, skip_serializing_if = "Vec::is_empty")] + pub api_versions: Vec, + #[doc = "Availability of the Sku for the location/zone/site."] + #[serde(rename = "locationInfo", default, skip_serializing_if = "Vec::is_empty")] + pub location_info: Vec, + #[doc = "The pricing info of the Sku."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub costs: Vec, + #[doc = "Sku can be signed up by customer or not."] + #[serde(rename = "signupOption", default, skip_serializing_if = "Option::is_none")] + pub signup_option: Option, + #[doc = "Availability of the Sku as preview/stable."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Links to the next set of results"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub availability: Option, + #[doc = "List of Shipment Types supported by this SKU"] + #[serde(rename = "shipmentTypes", default, skip_serializing_if = "Vec::is_empty")] + pub shipment_types: Vec, + #[doc = "The capability info of the SKU."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, +} +impl DataBoxEdgeSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_box_edge_sku { + use super::*; + #[doc = "The Sku name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Gateway, + Edge, + #[serde(rename = "TEA_1Node")] + Tea1node, + #[serde(rename = "TEA_1Node_UPS")] + Tea1nodeUps, + #[serde(rename = "TEA_1Node_Heater")] + Tea1nodeHeater, + #[serde(rename = "TEA_1Node_UPS_Heater")] + Tea1nodeUpsHeater, + #[serde(rename = "TEA_4Node_Heater")] + Tea4nodeHeater, + #[serde(rename = "TEA_4Node_UPS_Heater")] + Tea4nodeUpsHeater, + #[serde(rename = "TMA")] + Tma, + #[serde(rename = "TDC")] + Tdc, + #[serde(rename = "TCA_Small")] + TcaSmall, + #[serde(rename = "GPU")] + Gpu, + #[serde(rename = "TCA_Large")] + TcaLarge, + #[serde(rename = "EdgeP_Base")] + EdgePBase, + #[serde(rename = "EdgeP_High")] + EdgePHigh, + #[serde(rename = "EdgePR_Base")] + EdgePrBase, + #[serde(rename = "EdgePR_Base_UPS")] + EdgePrBaseUps, + #[serde(rename = "EP2_64_1VPU_W")] + Ep2641vpuW, + #[serde(rename = "EP2_128_1T4_Mx1_W")] + Ep21281t4Mx1W, + #[serde(rename = "EP2_256_2T4_W")] + Ep22562t4W, + #[serde(rename = "EdgeMR_Mini")] + EdgeMrMini, + #[serde(rename = "RCA_Small")] + RcaSmall, + #[serde(rename = "RCA_Large")] + RcaLarge, + #[serde(rename = "RDC")] + Rdc, + Management, + #[serde(rename = "EP2_64_Mx1_W")] + Ep264Mx1W, + #[serde(rename = "EP2_128_GPU1_Mx1_W")] + Ep2128Gpu1Mx1W, + #[serde(rename = "EP2_256_GPU2_Mx1")] + Ep2256Gpu2Mx1, + #[serde(rename = "EdgeMR_TCP")] + EdgeMrTcp, + } + #[doc = "The Sku tier."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + } + #[doc = "Sku can be signed up by customer or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SignupOption { + None, + Available, + } + #[doc = "Availability of the Sku as preview/stable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Version { + Stable, + Preview, + } + #[doc = "Links to the next set of results"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Availability { + Available, + Unavailable, + } +} +#[doc = "List of SKU Information objects."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataBoxEdgeSkuList { + #[doc = "List of ResourceType Sku"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Links to the next set of results"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DataBoxEdgeSkuList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Wraps data-residency related information for edge-resource and this should be used with ARM layer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataResidency { + #[doc = "DataResidencyType enum"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DataResidency { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_residency { + use super::*; + #[doc = "DataResidencyType enum"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + GeoZoneReplication, + ZoneReplication, + } +} +#[doc = "Object for Capturing DeviceCapacityInfo"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceCapacityInfo { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of Device Capacity Info"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DeviceCapacityInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of Device Capacity Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceCapacityInfoProperties { + #[doc = "Timestamp of request in UTC"] + #[serde(rename = "timeStamp", default, skip_serializing_if = "Option::is_none")] + pub time_stamp: Option, + #[doc = "Cluster Storage Data."] + #[serde(rename = "clusterStorageCapacityInfo", default, skip_serializing_if = "Option::is_none")] + pub cluster_storage_capacity_info: Option, + #[doc = "Cluster Compute Data."] + #[serde(rename = "clusterComputeCapacityInfo", default, skip_serializing_if = "Option::is_none")] + pub cluster_compute_capacity_info: Option, + #[doc = "The dictionary of individual node names and node capacities in the cluster."] + #[serde(rename = "nodeCapacityInfos", default, skip_serializing_if = "Option::is_none")] + pub node_capacity_infos: Option, +} +impl DeviceCapacityInfoProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Object for Capturing DeviceCapacityRequestInfo"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceCapacityRequestInfo { + #[doc = "Properties of Device Capacity Request Info containing VM's to be checked and their corresponding results."] + pub properties: DeviceCapacityRequestInfoProperties, +} +impl DeviceCapacityRequestInfo { + pub fn new(properties: DeviceCapacityRequestInfoProperties) -> Self { + Self { properties } + } +} +#[doc = "Properties of Device Capacity Request Info containing VM's to be checked and their corresponding results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceCapacityRequestInfoProperties { + #[doc = "Array containing the sizes of the VMs for checking if its feasible to create them on the appliance."] + #[serde(rename = "vmPlacementQuery")] + pub vm_placement_query: Vec>, + #[doc = "Array of the VMs of the sizes in VmSizes can be provisioned on the appliance."] + #[serde(rename = "vmPlacementResults", default, skip_serializing_if = "Vec::is_empty")] + pub vm_placement_results: Vec, +} +impl DeviceCapacityRequestInfoProperties { + pub fn new(vm_placement_query: Vec>) -> Self { + Self { + vm_placement_query, + vm_placement_results: Vec::new(), + } + } +} +#[doc = "The diagnostic proactive log collection settings of a device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticProactiveLogCollectionSettings { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of proactive log collection settings."] + pub properties: ProactiveLogCollectionSettingsProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DiagnosticProactiveLogCollectionSettings { + pub fn new(properties: ProactiveLogCollectionSettingsProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The remote support settings of a device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticRemoteSupportSettings { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of remote support settings."] + pub properties: DiagnosticRemoteSupportSettingsProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DiagnosticRemoteSupportSettings { + pub fn new(properties: DiagnosticRemoteSupportSettingsProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The properties of remote support settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiagnosticRemoteSupportSettingsProperties { + #[doc = "Remote support settings list according to the RemoteApplicationType"] + #[serde(rename = "remoteSupportSettingsList", default, skip_serializing_if = "Vec::is_empty")] + pub remote_support_settings_list: Vec, +} +impl DiagnosticRemoteSupportSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about Edge Profile for the resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EdgeProfile { + #[doc = "Subscription details for the Edge Profile"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subscription: Option, +} +impl EdgeProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Data Box Edge/Gateway Edge Profile patch."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EdgeProfilePatch { + #[doc = "The Data Box Edge/Gateway Edge Profile Subscription patch."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subscription: Option, +} +impl EdgeProfilePatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subscription details for the Edge Profile"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EdgeProfileSubscription { + #[doc = "Edge Subscription Registration ID"] + #[serde(rename = "registrationId", default, skip_serializing_if = "Option::is_none")] + pub registration_id: Option, + #[doc = "ARM ID of the subscription"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "registrationDate", default, skip_serializing_if = "Option::is_none")] + pub registration_date: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EdgeProfileSubscription { + pub fn new() -> Self { + Self::default() + } +} +pub mod edge_profile_subscription { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Registered, + Warned, + Suspended, + Deleted, + Unregistered, + } +} +#[doc = "The Data Box Edge/Gateway Edge Profile Subscription patch."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EdgeProfileSubscriptionPatch { + #[doc = "The path ID that uniquely identifies the subscription of the edge profile."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl EdgeProfileSubscriptionPatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Etcd configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EtcdInfo { + #[doc = "Etcd type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Etcd version"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "ComponentType of the Kubernetes node."] + #[serde(rename = "componentType", default, skip_serializing_if = "Option::is_none")] + pub component_type: Option, +} +impl EtcdInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod etcd_info { + use super::*; + #[doc = "ComponentType of the Kubernetes node."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentType { + Invalid, + Cluster, + Node, + Etcd, + #[serde(rename = "CNI")] + Cni, + LoadBalancer, + } +} +#[doc = "Trigger details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileEventTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "File trigger properties."] + pub properties: FileTriggerProperties, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl FileEventTrigger { + pub fn new(trigger: Trigger, properties: FileTriggerProperties) -> Self { + Self { + trigger, + properties, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "File source details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileSourceInfo { + #[doc = "File share ID."] + #[serde(rename = "shareId")] + pub share_id: String, +} +impl FileSourceInfo { + pub fn new(share_id: String) -> Self { + Self { share_id } + } +} +#[doc = "File trigger properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileTriggerProperties { + #[doc = "File source details."] + #[serde(rename = "sourceInfo")] + pub source_info: FileSourceInfo, + #[doc = "Compute role against which events will be raised."] + #[serde(rename = "sinkInfo")] + pub sink_info: RoleSinkInfo, + #[doc = "A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module."] + #[serde(rename = "customContextTag", default, skip_serializing_if = "Option::is_none")] + pub custom_context_tag: Option, +} +impl FileTriggerProperties { + pub fn new(source_info: FileSourceInfo, sink_info: RoleSinkInfo) -> Self { + Self { + source_info, + sink_info, + custom_context_tag: None, + } + } +} +#[doc = "Used in activation key generation flow."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GenerateCertResponse { + #[doc = "Gets or sets base64 encoded certificate raw data,\r\nthis is the public part needed to be uploaded to cert vault"] + #[serde(rename = "publicKey", default, skip_serializing_if = "Option::is_none")] + pub public_key: Option, + #[doc = "Gets or sets base64 encoded private part of the certificate,\r\nneeded to form the activation key"] + #[serde(rename = "privateKey", default, skip_serializing_if = "Option::is_none")] + pub private_key: Option, + #[doc = "Gets or sets expiry time in UTC"] + #[serde(rename = "expiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub expiry_time_in_utc: Option, +} +impl GenerateCertResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Host Capacity Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HostCapacity { + #[doc = "The name of the host."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "The available memory on the host accounting for VM placement size and any host VM reservations."] + #[serde(rename = "effectiveAvailableMemoryMbOnHost", default, skip_serializing_if = "Option::is_none")] + pub effective_available_memory_mb_on_host: Option, + #[doc = "The available amount of GPUs on the host to use after accounting for GPUS used by reservations on the host."] + #[serde(rename = "availableGpuCount", default, skip_serializing_if = "Option::is_none")] + pub available_gpu_count: Option, + #[doc = "The VM used memory per VmId."] + #[serde(rename = "vmUsedMemory", default, skip_serializing_if = "Option::is_none")] + pub vm_used_memory: Option, + #[doc = "The GPU type of the VM."] + #[serde(rename = "gpuType", default, skip_serializing_if = "Option::is_none")] + pub gpu_type: Option, + #[doc = "The numa nodes information for Hpn VMs."] + #[serde(rename = "numaNodesData", default, skip_serializing_if = "Vec::is_empty")] + pub numa_nodes_data: Vec, +} +impl HostCapacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Image repository credential."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImageRepositoryCredential { + #[doc = "Image repository url (e.g.: mcr.microsoft.com)."] + #[serde(rename = "imageRepositoryUrl")] + pub image_repository_url: String, + #[doc = "Repository user name."] + #[serde(rename = "userName")] + pub user_name: String, + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl ImageRepositoryCredential { + pub fn new(image_repository_url: String, user_name: String) -> Self { + Self { + image_repository_url, + user_name, + password: None, + } + } +} +#[doc = "Metadata of IoT device/IoT Edge device to be configured."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IoTDeviceInfo { + #[doc = "ID of the IoT device/edge device."] + #[serde(rename = "deviceId")] + pub device_id: String, + #[doc = "Host name for the IoT hub associated to the device."] + #[serde(rename = "ioTHostHub")] + pub io_t_host_hub: String, + #[doc = "Id for the IoT hub associated to the device."] + #[serde(rename = "ioTHostHubId", default, skip_serializing_if = "Option::is_none")] + pub io_t_host_hub_id: Option, + #[doc = "Authentication mechanism for IoT devices."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authentication: Option, +} +impl IoTDeviceInfo { + pub fn new(device_id: String, io_t_host_hub: String) -> Self { + Self { + device_id, + io_t_host_hub, + io_t_host_hub_id: None, + authentication: None, + } + } +} +#[doc = "IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IoTEdgeAgentInfo { + #[doc = "Name of the IoT edge agent image."] + #[serde(rename = "imageName")] + pub image_name: String, + #[doc = "Image Tag."] + pub tag: String, + #[doc = "Image repository credential."] + #[serde(rename = "imageRepository", default, skip_serializing_if = "Option::is_none")] + pub image_repository: Option, +} +impl IoTEdgeAgentInfo { + pub fn new(image_name: String, tag: String) -> Self { + Self { + image_name, + tag, + image_repository: None, + } + } +} +#[doc = "Compute role."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IoTRole { + #[serde(flatten)] + pub role: Role, + #[doc = "IoT role properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl IoTRole { + pub fn new(role: Role) -> Self { + Self { + role, + properties: None, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "IoT role properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IoTRoleProperties { + #[doc = "Host OS supported by the IoT role."] + #[serde(rename = "hostPlatform")] + pub host_platform: io_t_role_properties::HostPlatform, + #[doc = "Metadata of IoT device/IoT Edge device to be configured."] + #[serde(rename = "ioTDeviceDetails")] + pub io_t_device_details: IoTDeviceInfo, + #[doc = "Metadata of IoT device/IoT Edge device to be configured."] + #[serde(rename = "ioTEdgeDeviceDetails")] + pub io_t_edge_device_details: IoTDeviceInfo, + #[doc = "Mount points of shares in role(s)."] + #[serde(rename = "shareMappings", default, skip_serializing_if = "Vec::is_empty")] + pub share_mappings: Vec, + #[doc = "IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified."] + #[serde(rename = "ioTEdgeAgentInfo", default, skip_serializing_if = "Option::is_none")] + pub io_t_edge_agent_info: Option, + #[doc = "Platform where the Iot runtime is hosted."] + #[serde(rename = "hostPlatformType", default, skip_serializing_if = "Option::is_none")] + pub host_platform_type: Option, + #[doc = "Compute infrastructure Resource"] + #[serde(rename = "computeResource", default, skip_serializing_if = "Option::is_none")] + pub compute_resource: Option, + #[doc = "Role status."] + #[serde(rename = "roleStatus")] + pub role_status: io_t_role_properties::RoleStatus, +} +impl IoTRoleProperties { + pub fn new( + host_platform: io_t_role_properties::HostPlatform, + io_t_device_details: IoTDeviceInfo, + io_t_edge_device_details: IoTDeviceInfo, + role_status: io_t_role_properties::RoleStatus, + ) -> Self { + Self { + host_platform, + io_t_device_details, + io_t_edge_device_details, + share_mappings: Vec::new(), + io_t_edge_agent_info: None, + host_platform_type: None, + compute_resource: None, + role_status, + } + } +} +pub mod io_t_role_properties { + use super::*; + #[doc = "Host OS supported by the IoT role."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatform { + Windows, + Linux, + } + #[doc = "Platform where the Iot runtime is hosted."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatformType { + KubernetesCluster, + #[serde(rename = "LinuxVM")] + LinuxVm, + } + #[doc = "Role status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RoleStatus { + Enabled, + Disabled, + } +} +#[doc = "Details related to the IPv4 address configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Ipv4Config { + #[doc = "The IPv4 address of the network adapter."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The IPv4 subnet of the network adapter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "The IPv4 gateway of the network adapter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub gateway: Option, +} +impl Ipv4Config { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details related to the IPv6 address configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Ipv6Config { + #[doc = "The IPv6 address of the network adapter."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The IPv6 prefix of the network adapter."] + #[serde(rename = "prefixLength", default, skip_serializing_if = "Option::is_none")] + pub prefix_length: Option, + #[doc = "The IPv6 gateway of the network adapter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub gateway: Option, +} +impl Ipv6Config { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A device job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Job { + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The current status of the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The UTC date and time at which the job started."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The UTC date and time at which the job completed."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The percentage of the job that is complete."] + #[serde(rename = "percentComplete", default, skip_serializing_if = "Option::is_none")] + pub percent_complete: Option, + #[doc = "The job error information containing the list of job errors."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "The properties for the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Job { + pub fn new() -> Self { + Self::default() + } +} +pub mod job { + use super::*; + #[doc = "The current status of the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Running, + Succeeded, + Failed, + Canceled, + Paused, + Scheduled, + } +} +#[doc = "The job error information containing the list of job errors."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobErrorDetails { + #[doc = "The error details."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "The code intended for programmatic access."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The message that describes the error in detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl JobErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The job error items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobErrorItem { + #[doc = "The recommended actions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, + #[doc = "The code intended for programmatic access."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The message that describes the error in detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl JobErrorItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties for the job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobProperties { + #[doc = "The type of the job."] + #[serde(rename = "jobType", default, skip_serializing_if = "Option::is_none")] + pub job_type: Option, + #[doc = "Current stage of the update operation."] + #[serde(rename = "currentStage", default, skip_serializing_if = "Option::is_none")] + pub current_stage: Option, + #[doc = "Details about the download progress of update."] + #[serde(rename = "downloadProgress", default, skip_serializing_if = "Option::is_none")] + pub download_progress: Option, + #[doc = "Progress details during installation of updates."] + #[serde(rename = "installProgress", default, skip_serializing_if = "Option::is_none")] + pub install_progress: Option, + #[doc = "Total number of errors encountered during the refresh process."] + #[serde(rename = "totalRefreshErrors", default, skip_serializing_if = "Option::is_none")] + pub total_refresh_errors: Option, + #[doc = "Local share/remote container relative path to the error manifest file of the refresh."] + #[serde(rename = "errorManifestFile", default, skip_serializing_if = "Option::is_none")] + pub error_manifest_file: Option, + #[doc = "ARM ID of the entity that was refreshed."] + #[serde(rename = "refreshedEntityId", default, skip_serializing_if = "Option::is_none")] + pub refreshed_entity_id: Option, + #[doc = "If only subfolders need to be refreshed, then the subfolder path inside the share or container. (The path is empty if there are no subfolders.)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl JobProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod job_properties { + use super::*; + #[doc = "The type of the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobType { + Invalid, + ScanForUpdates, + DownloadUpdates, + InstallUpdates, + RefreshShare, + RefreshContainer, + Backup, + Restore, + TriggerSupportPackage, + } + #[doc = "Current stage of the update operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentStage { + Unknown, + Initial, + ScanStarted, + ScanComplete, + ScanFailed, + DownloadStarted, + DownloadComplete, + DownloadFailed, + InstallStarted, + InstallComplete, + InstallFailed, + RebootInitiated, + Success, + Failure, + RescanStarted, + RescanComplete, + RescanFailed, + } +} +#[doc = "Kubernetes cluster configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesClusterInfo { + #[doc = "Etcd configuration"] + #[serde(rename = "etcdInfo", default, skip_serializing_if = "Option::is_none")] + pub etcd_info: Option, + #[doc = "Kubernetes cluster nodes"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub nodes: Vec, + #[doc = "Kubernetes cluster version"] + pub version: String, + #[doc = "ComponentType of the Kubernetes node."] + #[serde(rename = "componentType", default, skip_serializing_if = "Option::is_none")] + pub component_type: Option, +} +impl KubernetesClusterInfo { + pub fn new(version: String) -> Self { + Self { + etcd_info: None, + nodes: Vec::new(), + version, + component_type: None, + } + } +} +pub mod kubernetes_cluster_info { + use super::*; + #[doc = "ComponentType of the Kubernetes node."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentType { + Invalid, + Cluster, + Node, + Etcd, + #[serde(rename = "CNI")] + Cni, + LoadBalancer, + } +} +#[doc = "Kubernetes node IP configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubernetesIpConfiguration { + #[doc = "Port of the Kubernetes node."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "IP address of the Kubernetes node."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} +impl KubernetesIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The limited preview of Kubernetes Cluster Management from the Azure supports:\r\n1. Using a simple turn-key option in Azure Portal, deploy a Kubernetes cluster on your Azure Stack Edge device. \r\n2. Configure Kubernetes cluster running on your device with Arc enabled Kubernetes with a click of a button in the Azure Portal. \r\n Azure Arc enables organizations to view, manage, and govern their on-premises Kubernetes clusters using the Azure Portal, command line tools, and APIs.\r\n3. Easily configure Persistent Volumes using SMB and NFS shares for storing container data. \r\n For more information, refer to the document here: https://databoxupdatepackages.blob.core.windows.net/documentation/Microsoft-Azure-Stack-Edge-K8-Cloud-Management-20210323.pdf \r\n Or Demo: https://databoxupdatepackages.blob.core.windows.net/documentation/Microsoft-Azure-Stack-Edge-K8S-Cloud-Management-20210323.mp4\r\n By using this feature, you agree to the preview legal terms. See the https://azure.microsoft.com/en-us/support/legal/preview-supplemental-terms/"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesRole { + #[serde(flatten)] + pub role: Role, + #[doc = "Kubernetes role properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl KubernetesRole { + pub fn new(role: Role) -> Self { + Self { + role, + properties: None, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "Kubernetes role compute resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesRoleCompute { + #[doc = "VM profile"] + #[serde(rename = "vmProfile")] + pub vm_profile: String, + #[doc = "Memory in bytes"] + #[serde(rename = "memoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub memory_in_bytes: Option, + #[doc = "Processor count"] + #[serde(rename = "processorCount", default, skip_serializing_if = "Option::is_none")] + pub processor_count: Option, + #[doc = "Count of huge pages"] + #[serde(rename = "hugePage2M", default, skip_serializing_if = "Option::is_none")] + pub huge_page2_m: Option, + #[doc = "Count of huge pages"] + #[serde(rename = "hugePage1G", default, skip_serializing_if = "Option::is_none")] + pub huge_page1_g: Option, +} +impl KubernetesRoleCompute { + pub fn new(vm_profile: String) -> Self { + Self { + vm_profile, + memory_in_bytes: None, + processor_count: None, + huge_page2_m: None, + huge_page1_g: None, + } + } +} +#[doc = "Kubernetes role network resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubernetesRoleNetwork { + #[doc = "Cni configuration"] + #[serde(rename = "cniConfig", default, skip_serializing_if = "Option::is_none")] + pub cni_config: Option, + #[doc = "Load balancer configuration"] + #[serde(rename = "loadBalancerConfig", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_config: Option, +} +impl KubernetesRoleNetwork { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Kubernetes role properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesRoleProperties { + #[doc = "Host OS supported by the Kubernetes role."] + #[serde(rename = "hostPlatform")] + pub host_platform: kubernetes_role_properties::HostPlatform, + #[doc = "State of Kubernetes deployment"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Platform where the runtime is hosted."] + #[serde(rename = "hostPlatformType", default, skip_serializing_if = "Option::is_none")] + pub host_platform_type: Option, + #[doc = "Kubernetes cluster configuration"] + #[serde(rename = "kubernetesClusterInfo")] + pub kubernetes_cluster_info: KubernetesClusterInfo, + #[doc = "Kubernetes role resources"] + #[serde(rename = "kubernetesRoleResources")] + pub kubernetes_role_resources: KubernetesRoleResources, + #[doc = "Role status."] + #[serde(rename = "roleStatus")] + pub role_status: kubernetes_role_properties::RoleStatus, +} +impl KubernetesRoleProperties { + pub fn new( + host_platform: kubernetes_role_properties::HostPlatform, + kubernetes_cluster_info: KubernetesClusterInfo, + kubernetes_role_resources: KubernetesRoleResources, + role_status: kubernetes_role_properties::RoleStatus, + ) -> Self { + Self { + host_platform, + provisioning_state: None, + host_platform_type: None, + kubernetes_cluster_info, + kubernetes_role_resources, + role_status, + } + } +} +pub mod kubernetes_role_properties { + use super::*; + #[doc = "Host OS supported by the Kubernetes role."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatform { + Windows, + Linux, + } + #[doc = "State of Kubernetes deployment"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Invalid, + Creating, + Created, + Updating, + Reconfiguring, + Failed, + Deleting, + } + #[doc = "Platform where the runtime is hosted."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HostPlatformType { + KubernetesCluster, + #[serde(rename = "LinuxVM")] + LinuxVm, + } + #[doc = "Role status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RoleStatus { + Enabled, + Disabled, + } +} +#[doc = "Kubernetes role resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesRoleResources { + #[doc = "Kubernetes role storage resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub storage: Option, + #[doc = "Kubernetes role compute resource"] + pub compute: KubernetesRoleCompute, + #[doc = "Kubernetes role network resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, +} +impl KubernetesRoleResources { + pub fn new(compute: KubernetesRoleCompute) -> Self { + Self { + storage: None, + compute, + network: None, + } + } +} +#[doc = "Kubernetes role storage resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubernetesRoleStorage { + #[doc = "Kubernetes storage class info."] + #[serde(rename = "storageClasses", default, skip_serializing_if = "Vec::is_empty")] + pub storage_classes: Vec, + #[doc = "Mount points of shares in role(s)."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, +} +impl KubernetesRoleStorage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Kubernetes storage class info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KubernetesRoleStorageClassInfo { + #[doc = "Storage class name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Storage class type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "If provisioned storage is posix compliant."] + #[serde(rename = "posixCompliant", default, skip_serializing_if = "Option::is_none")] + pub posix_compliant: Option, +} +impl KubernetesRoleStorageClassInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod kubernetes_role_storage_class_info { + use super::*; + #[doc = "If provisioned storage is posix compliant."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PosixCompliant { + Invalid, + Enabled, + Disabled, + } +} +#[doc = "Load balancer configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerConfig { + #[doc = "Load balancer type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Load balancer version"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "ComponentType of the Kubernetes node."] + #[serde(rename = "componentType", default, skip_serializing_if = "Option::is_none")] + pub component_type: Option, +} +impl LoadBalancerConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod load_balancer_config { + use super::*; + #[doc = "ComponentType of the Kubernetes node."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentType { + Invalid, + Cluster, + Node, + Etcd, + #[serde(rename = "CNI")] + Cni, + LoadBalancer, + } +} +#[doc = "MEC role."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MecRole { + #[serde(flatten)] + pub role: Role, + #[doc = "MEC role properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl MecRole { + pub fn new(role: Role) -> Self { + Self { + role, + properties: None, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "MEC role properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MecRoleProperties { + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Controller Endpoint."] + #[serde(rename = "controllerEndpoint", default, skip_serializing_if = "Option::is_none")] + pub controller_endpoint: Option, + #[doc = "Unique Id of the Resource."] + #[serde(rename = "resourceUniqueId", default, skip_serializing_if = "Option::is_none")] + pub resource_unique_id: Option, + #[doc = "Role status."] + #[serde(rename = "roleStatus")] + pub role_status: mec_role_properties::RoleStatus, +} +impl MecRoleProperties { + pub fn new(role_status: mec_role_properties::RoleStatus) -> Self { + Self { + connection_string: None, + controller_endpoint: None, + resource_unique_id: None, + role_status, + } + } +} +pub mod mec_role_properties { + use super::*; + #[doc = "Role status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RoleStatus { + Enabled, + Disabled, + } +} +#[doc = "Metric configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricConfiguration { + #[doc = "The Resource ID on which the metrics should be pushed."] + #[serde(rename = "resourceId")] + pub resource_id: String, + #[doc = "The MDM account to which the counters should be pushed."] + #[serde(rename = "mdmAccount", default, skip_serializing_if = "Option::is_none")] + pub mdm_account: Option, + #[doc = "The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified"] + #[serde(rename = "metricNameSpace", default, skip_serializing_if = "Option::is_none")] + pub metric_name_space: Option, + #[doc = "Host name for the IoT hub associated to the device."] + #[serde(rename = "counterSets")] + pub counter_sets: Vec, +} +impl MetricConfiguration { + pub fn new(resource_id: String, counter_sets: Vec) -> Self { + Self { + resource_id, + mdm_account: None, + metric_name_space: None, + counter_sets, + } + } +} +#[doc = "The metric counter"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricCounter { + #[doc = "The counter name."] + pub name: String, + #[doc = "The instance from which counter should be collected."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Option, + #[doc = "The dimension filter."] + #[serde(rename = "dimensionFilter", default, skip_serializing_if = "Vec::is_empty")] + pub dimension_filter: Vec, + #[doc = "The additional dimensions to be added to metric."] + #[serde(rename = "additionalDimensions", default, skip_serializing_if = "Vec::is_empty")] + pub additional_dimensions: Vec, +} +impl MetricCounter { + pub fn new(name: String) -> Self { + Self { + name, + instance: None, + dimension_filter: Vec::new(), + additional_dimensions: Vec::new(), + } + } +} +#[doc = "The metric counter set"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricCounterSet { + #[doc = "The counters that should be collected in this set."] + pub counters: Vec, +} +impl MetricCounterSet { + pub fn new(counters: Vec) -> Self { + Self { counters } + } +} +#[doc = "The metric dimension"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricDimension { + #[doc = "The dimension type."] + #[serde(rename = "sourceType")] + pub source_type: String, + #[doc = "The dimension value."] + #[serde(rename = "sourceName")] + pub source_name: String, +} +impl MetricDimension { + pub fn new(source_type: String, source_name: String) -> Self { + Self { source_type, source_name } + } +} +#[doc = "Metric Dimension v1."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricDimensionV1 { + #[doc = "Name of the metrics dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display name of the metrics dimension."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "To be exported to shoe box."] + #[serde(rename = "toBeExportedForShoebox", default, skip_serializing_if = "Option::is_none")] + pub to_be_exported_for_shoebox: Option, +} +impl MetricDimensionV1 { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metric specification version 1."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricSpecificationV1 { + #[doc = "Name of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display name of the metric."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Description of the metric to be displayed."] + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[doc = "Metric units."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "Metric aggregation type."] + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[doc = "Metric dimensions, other than default dimension which is resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[doc = "Set true to fill the gaps with zero."] + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[doc = "Metric category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "Resource name override."] + #[serde(rename = "resourceIdDimensionNameOverride", default, skip_serializing_if = "Option::is_none")] + pub resource_id_dimension_name_override: Option, + #[doc = "Support granularity of metrics."] + #[serde(rename = "supportedTimeGrainTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_time_grain_types: Vec, + #[doc = "Support metric aggregation type."] + #[serde(rename = "supportedAggregationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_aggregation_types: Vec, +} +impl MetricSpecificationV1 { + pub fn new() -> Self { + Self::default() + } +} +pub mod metric_specification_v1 { + use super::*; + #[doc = "Metric units."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + NotSpecified, + Percent, + Count, + Seconds, + Milliseconds, + Bytes, + BytesPerSecond, + CountPerSecond, + } + #[doc = "Metric aggregation type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AggregationType { + NotSpecified, + None, + Average, + Minimum, + Maximum, + Total, + Count, + } + #[doc = "Metric category."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Category { + Capacity, + Transaction, + } +} +#[doc = "The metric setting details for the role"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringMetricConfiguration { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "Metrics properties"] + pub properties: MonitoringMetricConfigurationProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl MonitoringMetricConfiguration { + pub fn new(properties: MonitoringMetricConfigurationProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "Collection of metric configurations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MonitoringMetricConfigurationList { + #[doc = "The list of metric configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MonitoringMetricConfigurationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metrics properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MonitoringMetricConfigurationProperties { + #[doc = "The metrics configuration details"] + #[serde(rename = "metricConfigurations")] + pub metric_configurations: Vec, +} +impl MonitoringMetricConfigurationProperties { + pub fn new(metric_configurations: Vec) -> Self { + Self { metric_configurations } + } +} +#[doc = "The share mount point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MountPointMap { + #[doc = "ID of the share mounted to the role VM."] + #[serde(rename = "shareId")] + pub share_id: String, + #[doc = "ID of the role to which share is mounted."] + #[serde(rename = "roleId", default, skip_serializing_if = "Option::is_none")] + pub role_id: Option, + #[doc = "Mount point for the share."] + #[serde(rename = "mountPoint", default, skip_serializing_if = "Option::is_none")] + pub mount_point: Option, + #[doc = "Mounting type."] + #[serde(rename = "mountType", default, skip_serializing_if = "Option::is_none")] + pub mount_type: Option, + #[doc = "Role type."] + #[serde(rename = "roleType", default, skip_serializing_if = "Option::is_none")] + pub role_type: Option, +} +impl MountPointMap { + pub fn new(share_id: String) -> Self { + Self { + share_id, + role_id: None, + mount_point: None, + mount_type: None, + role_type: None, + } + } +} +pub mod mount_point_map { + use super::*; + #[doc = "Mounting type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MountType { + Volume, + HostPath, + } + #[doc = "Role type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RoleType { + #[serde(rename = "IOT")] + Iot, + #[serde(rename = "ASA")] + Asa, + Functions, + Cognitive, + #[serde(rename = "MEC")] + Mec, + CloudEdgeManagement, + Kubernetes, + } +} +#[doc = "Represents the networkAdapter on a device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkAdapter { + #[doc = "Instance ID of network adapter."] + #[serde(rename = "adapterId", default, skip_serializing_if = "Option::is_none")] + pub adapter_id: Option, + #[doc = "The network adapter position."] + #[serde(rename = "adapterPosition", default, skip_serializing_if = "Option::is_none")] + pub adapter_position: Option, + #[doc = "Logical index of the adapter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub index: Option, + #[doc = "Node ID of the network adapter."] + #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")] + pub node_id: Option, + #[doc = "Network adapter name."] + #[serde(rename = "networkAdapterName", default, skip_serializing_if = "Option::is_none")] + pub network_adapter_name: Option, + #[doc = "Hardware label for the adapter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[doc = "MAC address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[doc = "Link speed."] + #[serde(rename = "linkSpeed", default, skip_serializing_if = "Option::is_none")] + pub link_speed: Option, + #[doc = "Value indicating whether this adapter is valid."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Value indicating whether this adapter is RDMA capable."] + #[serde(rename = "rdmaStatus", default, skip_serializing_if = "Option::is_none")] + pub rdma_status: Option, + #[doc = "Value indicating whether this adapter has DHCP enabled."] + #[serde(rename = "dhcpStatus", default, skip_serializing_if = "Option::is_none")] + pub dhcp_status: Option, + #[doc = "Details related to the IPv4 address configuration."] + #[serde(rename = "ipv4Configuration", default, skip_serializing_if = "Option::is_none")] + pub ipv4_configuration: Option, + #[doc = "Details related to the IPv6 address configuration."] + #[serde(rename = "ipv6Configuration", default, skip_serializing_if = "Option::is_none")] + pub ipv6_configuration: Option, + #[doc = "The IPv6 local address."] + #[serde(rename = "ipv6LinkLocalAddress", default, skip_serializing_if = "Option::is_none")] + pub ipv6_link_local_address: Option, + #[doc = "The list of DNS Servers of the device."] + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, +} +impl NetworkAdapter { + pub fn new() -> Self { + Self::default() + } +} +pub mod network_adapter { + use super::*; + #[doc = "Value indicating whether this adapter is valid."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Inactive, + Active, + } + #[doc = "Value indicating whether this adapter is RDMA capable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RdmaStatus { + Incapable, + Capable, + } + #[doc = "Value indicating whether this adapter has DHCP enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DhcpStatus { + Disabled, + Enabled, + } +} +#[doc = "The network adapter position."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkAdapterPosition { + #[doc = "The network group."] + #[serde(rename = "networkGroup", default, skip_serializing_if = "Option::is_none")] + pub network_group: Option, + #[doc = "The port."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl NetworkAdapterPosition { + pub fn new() -> Self { + Self::default() + } +} +pub mod network_adapter_position { + use super::*; + #[doc = "The network group."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NetworkGroup { + None, + #[serde(rename = "NonRDMA")] + NonRdma, + #[serde(rename = "RDMA")] + Rdma, + } +} +#[doc = "The network settings of a device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSettings { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of network settings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl NetworkSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of network settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSettingsProperties { + #[doc = "The network adapter list on the device."] + #[serde(rename = "networkAdapters", default, skip_serializing_if = "Vec::is_empty")] + pub network_adapters: Vec, +} +impl NetworkSettingsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents a single node in a Data box Edge/Gateway device\r\nGateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node\r\nMulti-node Edge devices will have more than 1 nodes"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Node { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "This class represents the nodes in a highly available cluster"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Node { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Kubernetes node info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NodeInfo { + #[doc = "Node name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Node type - Master/Worker"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "IP Configuration of the Kubernetes node."] + #[serde(rename = "ipConfiguration", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configuration: Vec, + #[doc = "ComponentType of the Kubernetes node."] + #[serde(rename = "componentType", default, skip_serializing_if = "Option::is_none")] + pub component_type: Option, +} +impl NodeInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod node_info { + use super::*; + #[doc = "Node type - Master/Worker"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Master, + Worker, + ManagementCluster, + ControlPlane, + NodePool, + } + #[doc = "ComponentType of the Kubernetes node."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComponentType { + Invalid, + Cluster, + Node, + Etcd, + #[serde(rename = "CNI")] + Cni, + LoadBalancer, + } +} +#[doc = "Collection of Nodes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NodeList { + #[doc = "The list of Nodes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NodeList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the nodes in a highly available cluster"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NodeProperties { + #[doc = "The current status of the individual node"] + #[serde(rename = "nodeStatus", default, skip_serializing_if = "Option::is_none")] + pub node_status: Option, + #[doc = "Serial number of the Chassis"] + #[serde(rename = "nodeChassisSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub node_chassis_serial_number: Option, + #[doc = "Serial number of the individual node"] + #[serde(rename = "nodeSerialNumber", default, skip_serializing_if = "Option::is_none")] + pub node_serial_number: Option, + #[doc = "Display Name of the individual node"] + #[serde(rename = "nodeDisplayName", default, skip_serializing_if = "Option::is_none")] + pub node_display_name: Option, + #[doc = "Friendly software version name that is currently installed on the node"] + #[serde(rename = "nodeFriendlySoftwareVersion", default, skip_serializing_if = "Option::is_none")] + pub node_friendly_software_version: Option, + #[doc = "HCS version that is currently installed on the node"] + #[serde(rename = "nodeHcsVersion", default, skip_serializing_if = "Option::is_none")] + pub node_hcs_version: Option, + #[doc = "Guid instance id of the node"] + #[serde(rename = "nodeInstanceId", default, skip_serializing_if = "Option::is_none")] + pub node_instance_id: Option, +} +impl NodeProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod node_properties { + use super::*; + #[doc = "The current status of the individual node"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NodeStatus { + Unknown, + Up, + Down, + Rebooting, + ShuttingDown, + } +} +#[doc = "NUMA node data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NumaNodeData { + #[doc = "The NUMA node index."] + #[serde(rename = "numaNodeIndex", default, skip_serializing_if = "Option::is_none")] + pub numa_node_index: Option, + #[doc = "The total memory on the NUMA node."] + #[serde(rename = "totalMemoryInMb", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_mb: Option, + #[doc = "The logical cores per core count."] + #[serde(rename = "logicalCoreCountPerCore", default, skip_serializing_if = "Option::is_none")] + pub logical_core_count_per_core: Option, + #[doc = "The effective available memory on the NUMA node in MB."] + #[serde(rename = "effectiveAvailableMemoryInMb", default, skip_serializing_if = "Option::is_none")] + pub effective_available_memory_in_mb: Option, + #[doc = "The free VCPU indices for the Hpn VMs."] + #[serde(rename = "freeVCpuIndexesForHpn", default, skip_serializing_if = "Vec::is_empty")] + pub free_v_cpu_indexes_for_hpn: Vec, + #[doc = "The VCPU indices for Hpn VMs"] + #[serde(rename = "vCpuIndexesForHpn", default, skip_serializing_if = "Vec::is_empty")] + pub v_cpu_indexes_for_hpn: Vec, + #[doc = "The VCPU indices for the root."] + #[serde(rename = "vCpuIndexesForRoot", default, skip_serializing_if = "Vec::is_empty")] + pub v_cpu_indexes_for_root: Vec, +} +impl NumaNodeData { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Is data action."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Operation display properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Origin of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Operation properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation display properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationDisplay { + #[doc = "Provider name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The type of resource in which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operation to be performed on the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation to be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl OperationDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationProperties { + #[doc = "Service specification."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl OperationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of operations used for the discovery of available provider operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsList { + #[doc = "The value."] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationsList { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The order details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Order { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "It specify the order api version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Order properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Order { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of order entities."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OrderList { + #[doc = "The list of orders."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OrderList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Order properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OrderProperties { + #[doc = "It specify the order resource id."] + #[serde(rename = "orderId", default, skip_serializing_if = "Option::is_none")] + pub order_id: Option, + #[doc = "Contains all the contact details of the customer."] + #[serde(rename = "contactInformation", default, skip_serializing_if = "Option::is_none")] + pub contact_information: Option, + #[doc = "The shipping address of the customer."] + #[serde(rename = "shippingAddress", default, skip_serializing_if = "Option::is_none")] + pub shipping_address: Option
, + #[doc = "Represents a single status change."] + #[serde(rename = "currentStatus", default, skip_serializing_if = "Option::is_none")] + pub current_status: Option, + #[doc = "List of status changes in the order."] + #[serde(rename = "orderHistory", default, skip_serializing_if = "Vec::is_empty")] + pub order_history: Vec, + #[doc = "Serial number of the device."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "Tracking information for the package delivered to the customer whether it has an original or a replacement device."] + #[serde(rename = "deliveryTrackingInfo", default, skip_serializing_if = "Vec::is_empty")] + pub delivery_tracking_info: Vec, + #[doc = "Tracking information for the package returned from the customer whether it has an original or a replacement device."] + #[serde(rename = "returnTrackingInfo", default, skip_serializing_if = "Vec::is_empty")] + pub return_tracking_info: Vec, + #[doc = "ShipmentType of the order"] + #[serde(rename = "shipmentType", default, skip_serializing_if = "Option::is_none")] + pub shipment_type: Option, +} +impl OrderProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod order_properties { + use super::*; + #[doc = "ShipmentType of the order"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ShipmentType { + NotApplicable, + ShippedToCustomer, + SelfPickup, + } +} +#[doc = "Represents a single status change."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrderStatus { + #[doc = "Status of the order as per the allowed status types."] + pub status: order_status::Status, + #[doc = "Time of status update."] + #[serde(rename = "updateDateTime", default, skip_serializing_if = "Option::is_none")] + pub update_date_time: Option, + #[doc = "Comments related to this status change."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, + #[doc = "Tracking courier information."] + #[serde(rename = "trackingInformation", default, skip_serializing_if = "Option::is_none")] + pub tracking_information: Option, + #[doc = "Dictionary to hold generic information which is not stored\r\nby the already existing properties"] + #[serde(rename = "additionalOrderDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_order_details: Option, +} +impl OrderStatus { + pub fn new(status: order_status::Status) -> Self { + Self { + status, + update_date_time: None, + comments: None, + tracking_information: None, + additional_order_details: None, + } + } +} +pub mod order_status { + use super::*; + #[doc = "Status of the order as per the allowed status types."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Untracked, + AwaitingFulfillment, + AwaitingPreparation, + AwaitingShipment, + Shipped, + Arriving, + Delivered, + ReplacementRequested, + LostDevice, + Declined, + ReturnInitiated, + AwaitingReturnShipment, + ShippedBack, + CollectedAtMicrosoft, + AwaitingPickup, + PickupCompleted, + AwaitingDrop, + } +} +#[doc = "Trigger details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicTimerEventTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "Periodic timer trigger properties."] + pub properties: PeriodicTimerProperties, + #[doc = "The path ID that uniquely identifies the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The object name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The hierarchical type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PeriodicTimerEventTrigger { + pub fn new(trigger: Trigger, properties: PeriodicTimerProperties) -> Self { + Self { + trigger, + properties, + id: None, + name: None, + type_: None, + } + } +} +#[doc = "Periodic timer trigger properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicTimerProperties { + #[doc = "Periodic timer event source."] + #[serde(rename = "sourceInfo")] + pub source_info: PeriodicTimerSourceInfo, + #[doc = "Compute role against which events will be raised."] + #[serde(rename = "sinkInfo")] + pub sink_info: RoleSinkInfo, + #[doc = "A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module."] + #[serde(rename = "customContextTag", default, skip_serializing_if = "Option::is_none")] + pub custom_context_tag: Option, +} +impl PeriodicTimerProperties { + pub fn new(source_info: PeriodicTimerSourceInfo, sink_info: RoleSinkInfo) -> Self { + Self { + source_info, + sink_info, + custom_context_tag: None, + } + } +} +#[doc = "Periodic timer event source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicTimerSourceInfo { + #[doc = "The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds."] + pub schedule: String, + #[doc = "Topic where periodic events are published to IoT device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub topic: Option, +} +impl PeriodicTimerSourceInfo { + pub fn new(start_time: String, schedule: String) -> Self { + Self { + start_time, + schedule, + topic: None, + } + } +} +#[doc = "The properties of proactive log collection settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProactiveLogCollectionSettingsProperties { + #[doc = "Proactive diagnostic collection consent flag"] + #[serde(rename = "userConsent")] + pub user_consent: proactive_log_collection_settings_properties::UserConsent, +} +impl ProactiveLogCollectionSettingsProperties { + pub fn new(user_consent: proactive_log_collection_settings_properties::UserConsent) -> Self { + Self { user_consent } + } +} +pub mod proactive_log_collection_settings_properties { + use super::*; + #[doc = "Proactive diagnostic collection consent flag"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UserConsent { + Enabled, + Disabled, + } +} +#[doc = "Raw Certificate Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RawCertificateData { + #[doc = "The authentication type."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The base64 encoded certificate raw data."] + pub certificate: String, +} +impl RawCertificateData { + pub fn new(certificate: String) -> Self { + Self { + authentication_type: None, + certificate, + } + } +} +pub mod raw_certificate_data { + use super::*; + #[doc = "The authentication type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Invalid, + AzureActiveDirectory, + } +} +#[doc = "Fields for tracking refresh job on the share or container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RefreshDetails { + #[doc = "If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress."] + #[serde(rename = "inProgressRefreshJobId", default, skip_serializing_if = "Option::is_none")] + pub in_progress_refresh_job_id: Option, + #[doc = "Indicates the completed time for the last refresh job on this particular share or container, if any.This could be a failed job or a successful job."] + #[serde(rename = "lastCompletedRefreshJobTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub last_completed_refresh_job_time_in_utc: Option, + #[doc = "Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job."] + #[serde(rename = "errorManifestFile", default, skip_serializing_if = "Option::is_none")] + pub error_manifest_file: Option, + #[doc = "Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job."] + #[serde(rename = "lastJob", default, skip_serializing_if = "Option::is_none")] + pub last_job: Option, +} +impl RefreshDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "RemoteApplicationType for which remote support settings is being modified"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemoteSupportSettings { + #[doc = "Remote application type"] + #[serde(rename = "remoteApplicationType", default, skip_serializing_if = "Option::is_none")] + pub remote_application_type: Option, + #[doc = "Access level allowed for this remote application type"] + #[serde(rename = "accessLevel", default, skip_serializing_if = "Option::is_none")] + pub access_level: Option, + #[doc = "Expiration time stamp"] + #[serde(rename = "expirationTimeStampInUTC", default, skip_serializing_if = "Option::is_none")] + pub expiration_time_stamp_in_utc: Option, +} +impl RemoteSupportSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod remote_support_settings { + use super::*; + #[doc = "Remote application type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RemoteApplicationType { + Powershell, + #[serde(rename = "WAC")] + Wac, + #[serde(rename = "LocalUI")] + LocalUi, + AllApplications, + } + #[doc = "Access level allowed for this remote application type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessLevel { + None, + ReadOnly, + ReadWrite, + FullAccess, + } +} +#[doc = "Msi identity details of the resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceIdentity { + #[doc = "Identity type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Service Principal Id backing the Msi"] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Home Tenant Id"] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +impl ResourceIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_identity { + use super::*; + #[doc = "Identity type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + None, + SystemAssigned, + UserAssigned, + } +} +#[doc = "Fields for tracking resource move"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceMoveDetails { + #[doc = "Denotes whether move operation is in progress"] + #[serde(rename = "operationInProgress", default, skip_serializing_if = "Option::is_none")] + pub operation_in_progress: Option, + #[doc = "Denotes the timeout of the operation to finish"] + #[serde(rename = "operationInProgressLockTimeoutInUTC", default, skip_serializing_if = "Option::is_none")] + pub operation_in_progress_lock_timeout_in_utc: Option, +} +impl ResourceMoveDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_move_details { + use super::*; + #[doc = "Denotes whether move operation is in progress"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationInProgress { + None, + ResourceMoveInProgress, + ResourceMoveFailed, + } +} +#[doc = "Compute role."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Role { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "Role type."] + pub kind: role::Kind, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Role { + pub fn new(kind: role::Kind) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + kind, + system_data: None, + } + } +} +pub mod role { + use super::*; + #[doc = "Role type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "IOT")] + Iot, + #[serde(rename = "ASA")] + Asa, + Functions, + Cognitive, + #[serde(rename = "MEC")] + Mec, + CloudEdgeManagement, + Kubernetes, + } +} +#[doc = "Collection of all the roles on the Data Box Edge device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoleList { + #[doc = "The Value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RoleList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Compute role against which events will be raised."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleSinkInfo { + #[doc = "Compute role ID."] + #[serde(rename = "roleId")] + pub role_id: String, +} +impl RoleSinkInfo { + pub fn new(role_id: String) -> Self { + Self { role_id } + } +} +#[doc = "Holds device secret either as a KeyVault reference or as an encrypted value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Secret { + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "encryptedSecret", default, skip_serializing_if = "Option::is_none")] + pub encrypted_secret: Option, + #[doc = "Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740)."] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, +} +impl Secret { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The security settings of a device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecuritySettings { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The properties of security settings."] + pub properties: SecuritySettingsProperties, +} +impl SecuritySettings { + pub fn new(properties: SecuritySettingsProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + } + } +} +#[doc = "The properties of security settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecuritySettingsProperties { + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "deviceAdminPassword")] + pub device_admin_password: AsymmetricEncryptedSecret, +} +impl SecuritySettingsProperties { + pub fn new(device_admin_password: AsymmetricEncryptedSecret) -> Self { + Self { device_admin_password } + } +} +#[doc = "Service specification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceSpecification { + #[doc = "Metric specification as defined by shoebox."] + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, +} +impl ServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents a share on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Share { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The share properties."] + pub properties: ShareProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Share { + pub fn new(properties: ShareProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "Specifies the mapping between this particular user and the type of access he has on shares on this device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShareAccessRight { + #[doc = "The share ID."] + #[serde(rename = "shareId")] + pub share_id: String, + #[doc = "Type of access to be allowed on the share for this user."] + #[serde(rename = "accessType")] + pub access_type: share_access_right::AccessType, +} +impl ShareAccessRight { + pub fn new(share_id: String, access_type: share_access_right::AccessType) -> Self { + Self { share_id, access_type } + } +} +pub mod share_access_right { + use super::*; + #[doc = "Type of access to be allowed on the share for this user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessType { + Change, + Read, + Custom, + } +} +#[doc = "Collection of all the shares on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ShareList { + #[doc = "The list of shares."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ShareList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The share properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShareProperties { + #[doc = "Description for the share."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Current status of the share."] + #[serde(rename = "shareStatus")] + pub share_status: share_properties::ShareStatus, + #[doc = "Current monitoring status of the share."] + #[serde(rename = "monitoringStatus")] + pub monitoring_status: share_properties::MonitoringStatus, + #[doc = "Azure container mapping of the endpoint."] + #[serde(rename = "azureContainerInfo", default, skip_serializing_if = "Option::is_none")] + pub azure_container_info: Option, + #[doc = "Access protocol to be used by the share."] + #[serde(rename = "accessProtocol")] + pub access_protocol: share_properties::AccessProtocol, + #[doc = "Mapping of users and corresponding access rights on the share (required for SMB protocol)."] + #[serde(rename = "userAccessRights", default, skip_serializing_if = "Vec::is_empty")] + pub user_access_rights: Vec, + #[doc = "List of IP addresses and corresponding access rights on the share(required for NFS protocol)."] + #[serde(rename = "clientAccessRights", default, skip_serializing_if = "Vec::is_empty")] + pub client_access_rights: Vec, + #[doc = "Fields for tracking refresh job on the share or container."] + #[serde(rename = "refreshDetails", default, skip_serializing_if = "Option::is_none")] + pub refresh_details: Option, + #[doc = "Share mount point to the role."] + #[serde(rename = "shareMappings", default, skip_serializing_if = "Vec::is_empty")] + pub share_mappings: Vec, + #[doc = "Data policy of the share."] + #[serde(rename = "dataPolicy", default, skip_serializing_if = "Option::is_none")] + pub data_policy: Option, +} +impl ShareProperties { + pub fn new( + share_status: share_properties::ShareStatus, + monitoring_status: share_properties::MonitoringStatus, + access_protocol: share_properties::AccessProtocol, + ) -> Self { + Self { + description: None, + share_status, + monitoring_status, + azure_container_info: None, + access_protocol, + user_access_rights: Vec::new(), + client_access_rights: Vec::new(), + refresh_details: None, + share_mappings: Vec::new(), + data_policy: None, + } + } +} +pub mod share_properties { + use super::*; + #[doc = "Current status of the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ShareStatus { + Offline, + Unknown, + #[serde(rename = "OK")] + Ok, + Updating, + NeedsAttention, + } + #[doc = "Current monitoring status of the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MonitoringStatus { + Enabled, + Disabled, + } + #[doc = "Access protocol to be used by the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessProtocol { + #[serde(rename = "SMB")] + Smb, + #[serde(rename = "NFS")] + Nfs, + } + #[doc = "Data policy of the share."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataPolicy { + Cloud, + Local, + } +} +#[doc = "The SKU type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Sku { + #[doc = "SKU name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The SKU tier. This is based on the SKU name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl Sku { + pub fn new() -> Self { + Self::default() + } +} +pub mod sku { + use super::*; + #[doc = "SKU name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Gateway, + Edge, + #[serde(rename = "TEA_1Node")] + Tea1node, + #[serde(rename = "TEA_1Node_UPS")] + Tea1nodeUps, + #[serde(rename = "TEA_1Node_Heater")] + Tea1nodeHeater, + #[serde(rename = "TEA_1Node_UPS_Heater")] + Tea1nodeUpsHeater, + #[serde(rename = "TEA_4Node_Heater")] + Tea4nodeHeater, + #[serde(rename = "TEA_4Node_UPS_Heater")] + Tea4nodeUpsHeater, + #[serde(rename = "TMA")] + Tma, + #[serde(rename = "TDC")] + Tdc, + #[serde(rename = "TCA_Small")] + TcaSmall, + #[serde(rename = "GPU")] + Gpu, + #[serde(rename = "TCA_Large")] + TcaLarge, + #[serde(rename = "EdgeP_Base")] + EdgePBase, + #[serde(rename = "EdgeP_High")] + EdgePHigh, + #[serde(rename = "EdgePR_Base")] + EdgePrBase, + #[serde(rename = "EdgePR_Base_UPS")] + EdgePrBaseUps, + #[serde(rename = "EP2_64_1VPU_W")] + Ep2641vpuW, + #[serde(rename = "EP2_128_1T4_Mx1_W")] + Ep21281t4Mx1W, + #[serde(rename = "EP2_256_2T4_W")] + Ep22562t4W, + #[serde(rename = "EdgeMR_Mini")] + EdgeMrMini, + #[serde(rename = "RCA_Small")] + RcaSmall, + #[serde(rename = "RCA_Large")] + RcaLarge, + #[serde(rename = "RDC")] + Rdc, + Management, + #[serde(rename = "EP2_64_Mx1_W")] + Ep264Mx1W, + #[serde(rename = "EP2_128_GPU1_Mx1_W")] + Ep2128Gpu1Mx1W, + #[serde(rename = "EP2_256_GPU2_Mx1")] + Ep2256Gpu2Mx1, + #[serde(rename = "EdgeMR_TCP")] + EdgeMrTcp, + } + #[doc = "The SKU tier. This is based on the SKU name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + } +} +#[doc = "The metadata to describe the capability."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuCapability { + #[doc = "An invariant to describe the feature."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "An invariant if the feature is measured by quantity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SkuCapability { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The metadata for retrieving price info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuCost { + #[doc = "Used for querying price from commerce."] + #[serde(rename = "meterId", default, skip_serializing_if = "Option::is_none")] + pub meter_id: Option, + #[doc = "The cost quantity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantity: Option, + #[doc = "The extended unit."] + #[serde(rename = "extendedUnit", default, skip_serializing_if = "Option::is_none")] + pub extended_unit: Option, +} +impl SkuCost { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuLocationInfo { + #[doc = "The location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "The zones."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "The sites."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sites: Vec, +} +impl SkuLocationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents a Storage Account on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccount { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The storage account properties."] + pub properties: StorageAccountProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl StorageAccount { + pub fn new(properties: StorageAccountProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The storage account credential."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountCredential { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The storage account credential properties."] + pub properties: StorageAccountCredentialProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl StorageAccountCredential { + pub fn new(properties: StorageAccountCredentialProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The collection of storage account credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageAccountCredentialList { + #[doc = "The value."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StorageAccountCredentialList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The storage account credential properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountCredentialProperties { + #[doc = "Alias for the storage account."] + pub alias: String, + #[doc = "Username for the storage account."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "Connection string for the storage account. Use this string if username and account key are not specified."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Signifies whether SSL needs to be enabled or not."] + #[serde(rename = "sslStatus")] + pub ssl_status: storage_account_credential_properties::SslStatus, + #[doc = "Blob end point for private clouds."] + #[serde(rename = "blobDomainName", default, skip_serializing_if = "Option::is_none")] + pub blob_domain_name: Option, + #[doc = "Type of storage accessed on the storage account."] + #[serde(rename = "accountType")] + pub account_type: storage_account_credential_properties::AccountType, + #[doc = "Id of the storage account."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, +} +impl StorageAccountCredentialProperties { + pub fn new( + alias: String, + ssl_status: storage_account_credential_properties::SslStatus, + account_type: storage_account_credential_properties::AccountType, + ) -> Self { + Self { + alias, + user_name: None, + account_key: None, + connection_string: None, + ssl_status, + blob_domain_name: None, + account_type, + storage_account_id: None, + } + } +} +pub mod storage_account_credential_properties { + use super::*; + #[doc = "Signifies whether SSL needs to be enabled or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SslStatus { + Enabled, + Disabled, + } + #[doc = "Type of storage accessed on the storage account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccountType { + GeneralPurposeStorage, + BlobStorage, + } +} +#[doc = "Collection of all the Storage Accounts on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageAccountList { + #[doc = "The list of storageAccounts."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StorageAccountList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The storage account properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountProperties { + #[doc = "Description for the storage Account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Current status of the storage account"] + #[serde(rename = "storageAccountStatus", default, skip_serializing_if = "Option::is_none")] + pub storage_account_status: Option, + #[doc = "Data policy of the storage Account."] + #[serde(rename = "dataPolicy")] + pub data_policy: storage_account_properties::DataPolicy, + #[doc = "Storage Account Credential Id"] + #[serde(rename = "storageAccountCredentialId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_credential_id: Option, + #[doc = "BlobEndpoint of Storage Account"] + #[serde(rename = "blobEndpoint", default, skip_serializing_if = "Option::is_none")] + pub blob_endpoint: Option, + #[doc = "The Container Count. Present only for Storage Accounts with DataPolicy set to Cloud."] + #[serde(rename = "containerCount", default, skip_serializing_if = "Option::is_none")] + pub container_count: Option, +} +impl StorageAccountProperties { + pub fn new(data_policy: storage_account_properties::DataPolicy) -> Self { + Self { + description: None, + storage_account_status: None, + data_policy, + storage_account_credential_id: None, + blob_endpoint: None, + container_count: None, + } + } +} +pub mod storage_account_properties { + use super::*; + #[doc = "Current status of the storage account"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageAccountStatus { + #[serde(rename = "OK")] + Ok, + Offline, + Unknown, + Updating, + NeedsAttention, + } + #[doc = "Data policy of the storage Account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataPolicy { + Cloud, + Local, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionProperties { + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "locationPlacementId", default, skip_serializing_if = "Option::is_none")] + pub location_placement_id: Option, + #[serde(rename = "quotaId", default, skip_serializing_if = "Option::is_none")] + pub quota_id: Option, + #[serde(rename = "serializedDetails", default, skip_serializing_if = "Option::is_none")] + pub serialized_details: Option, + #[serde(rename = "registeredFeatures", default, skip_serializing_if = "Vec::is_empty")] + pub registered_features: Vec, +} +impl SubscriptionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubscriptionRegisteredFeatures { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl SubscriptionRegisteredFeatures { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The share properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportPackageRequestProperties { + #[doc = "MinimumTimeStamp from where logs need to be collected"] + #[serde(rename = "minimumTimeStamp", default, skip_serializing_if = "Option::is_none")] + pub minimum_time_stamp: Option, + #[doc = "Start of the timespan of the log collection"] + #[serde(rename = "maximumTimeStamp", default, skip_serializing_if = "Option::is_none")] + pub maximum_time_stamp: Option, + #[doc = "Type of files, which need to be included in the logs\r\nThis will contain the type of logs (Default/DefaultWithDumps/None/All/DefaultWithArchived)\r\nor a comma separated list of log types that are required"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub include: Option, +} +impl SupportPackageRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Symmetric key for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SymmetricKey { + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, +} +impl SymmetricKey { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[doc = "Tracking courier information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TrackingInfo { + #[doc = "Serial number of the device being tracked."] + #[serde(rename = "serialNumber", default, skip_serializing_if = "Option::is_none")] + pub serial_number: Option, + #[doc = "Name of the carrier used in the delivery."] + #[serde(rename = "carrierName", default, skip_serializing_if = "Option::is_none")] + pub carrier_name: Option, + #[doc = "Tracking ID of the shipment."] + #[serde(rename = "trackingId", default, skip_serializing_if = "Option::is_none")] + pub tracking_id: Option, + #[doc = "Tracking URL of the shipment."] + #[serde(rename = "trackingUrl", default, skip_serializing_if = "Option::is_none")] + pub tracking_url: Option, +} +impl TrackingInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trigger details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Trigger { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "Trigger Kind."] + pub kind: trigger::Kind, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Trigger { + pub fn new(kind: trigger::Kind) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + kind, + system_data: None, + } + } +} +pub mod trigger { + use super::*; + #[doc = "Trigger Kind."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + FileEvent, + PeriodicTimerEvent, + } +} +#[doc = "Collection of all trigger on the data box edge device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerList { + #[doc = "The list of triggers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TriggerList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The request object for trigger support package."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerSupportPackageRequest { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The share properties."] + pub properties: SupportPackageRequestProperties, +} +impl TriggerSupportPackageRequest { + pub fn new(properties: SupportPackageRequestProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + } + } +} +#[doc = "Update Specific attributes"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateDetails { + #[doc = "Title of the Update"] + #[serde(rename = "updateTitle", default, skip_serializing_if = "Option::is_none")] + pub update_title: Option, + #[doc = "Size of the update(In Bytes)"] + #[serde(rename = "updateSize", default, skip_serializing_if = "Option::is_none")] + pub update_size: Option, + #[doc = "Type of the Update"] + #[serde(rename = "updateType", default, skip_serializing_if = "Option::is_none")] + pub update_type: Option, + #[doc = "Target Version number"] + #[serde(rename = "targetVersion", default, skip_serializing_if = "Option::is_none")] + pub target_version: Option, + #[doc = "Friendly Version Number"] + #[serde(rename = "friendlyVersionNumber", default, skip_serializing_if = "Option::is_none")] + pub friendly_version_number: Option, + #[doc = "Estimated Install Time for the update"] + #[serde(rename = "estimatedInstallTimeInMins", default, skip_serializing_if = "Option::is_none")] + pub estimated_install_time_in_mins: Option, + #[doc = "Indicates if updates are available and at least one of the updates needs a reboot."] + #[serde(rename = "rebootBehavior", default, skip_serializing_if = "Option::is_none")] + pub reboot_behavior: Option, + #[doc = "Impact of Installing an updateType"] + #[serde(rename = "installationImpact", default, skip_serializing_if = "Option::is_none")] + pub installation_impact: Option, + #[doc = "Status of the update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl UpdateDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod update_details { + use super::*; + #[doc = "Type of the Update"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UpdateType { + Software, + Kubernetes, + Firmware, + } + #[doc = "Indicates if updates are available and at least one of the updates needs a reboot."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootBehavior { + NeverReboots, + RequiresReboot, + RequestReboot, + } + #[doc = "Impact of Installing an updateType"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InstallationImpact { + None, + DeviceRebooted, + KubernetesWorkloadsDown, + } + #[doc = "Status of the update."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + DownloadPending, + DownloadStarted, + DownloadCompleted, + InstallStarted, + InstallCompleted, + } +} +#[doc = "Details about the download progress of update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateDownloadProgress { + #[doc = "The download phase."] + #[serde(rename = "downloadPhase", default, skip_serializing_if = "Option::is_none")] + pub download_phase: Option, + #[doc = "Percentage of completion."] + #[serde(rename = "percentComplete", default, skip_serializing_if = "Option::is_none")] + pub percent_complete: Option, + #[doc = "Total bytes to download."] + #[serde(rename = "totalBytesToDownload", default, skip_serializing_if = "Option::is_none")] + pub total_bytes_to_download: Option, + #[doc = "Total bytes downloaded."] + #[serde(rename = "totalBytesDownloaded", default, skip_serializing_if = "Option::is_none")] + pub total_bytes_downloaded: Option, + #[doc = "Number of updates to download."] + #[serde(rename = "numberOfUpdatesToDownload", default, skip_serializing_if = "Option::is_none")] + pub number_of_updates_to_download: Option, + #[doc = "Number of updates downloaded."] + #[serde(rename = "numberOfUpdatesDownloaded", default, skip_serializing_if = "Option::is_none")] + pub number_of_updates_downloaded: Option, +} +impl UpdateDownloadProgress { + pub fn new() -> Self { + Self::default() + } +} +pub mod update_download_progress { + use super::*; + #[doc = "The download phase."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DownloadPhase { + Unknown, + Initializing, + Downloading, + Verifying, + } +} +#[doc = "Progress details during installation of updates."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateInstallProgress { + #[doc = "Percentage completed."] + #[serde(rename = "percentComplete", default, skip_serializing_if = "Option::is_none")] + pub percent_complete: Option, + #[doc = "Number of updates to install."] + #[serde(rename = "numberOfUpdatesToInstall", default, skip_serializing_if = "Option::is_none")] + pub number_of_updates_to_install: Option, + #[doc = "Number of updates installed."] + #[serde(rename = "numberOfUpdatesInstalled", default, skip_serializing_if = "Option::is_none")] + pub number_of_updates_installed: Option, +} +impl UpdateInstallProgress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about ongoing updates and availability of updates on the device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateSummary { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The device update information summary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl UpdateSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The device update information summary."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateSummaryProperties { + #[doc = "The current version of the device in format: 1.2.17312.13.\","] + #[serde(rename = "deviceVersionNumber", default, skip_serializing_if = "Option::is_none")] + pub device_version_number: Option, + #[doc = "The current version of the device in text format."] + #[serde(rename = "friendlyDeviceVersionName", default, skip_serializing_if = "Option::is_none")] + pub friendly_device_version_name: Option, + #[doc = "The last time when a scan was done on the device."] + #[serde(rename = "deviceLastScannedDateTime", default, skip_serializing_if = "Option::is_none")] + pub device_last_scanned_date_time: Option, + #[doc = "The time when the last scan job was completed (success/cancelled/failed) on the appliance."] + #[serde(rename = "lastCompletedScanJobDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_completed_scan_job_date_time: Option, + #[doc = "Time when the last scan job is successfully completed."] + #[serde(rename = "lastSuccessfulScanJobTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_scan_job_time: Option, + #[doc = "The time when the last Download job was completed (success/cancelled/failed) on the appliance."] + #[serde(rename = "lastCompletedDownloadJobDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_completed_download_job_date_time: Option, + #[doc = "JobId of the last ran download job.(Can be success/cancelled/failed)"] + #[serde(rename = "lastCompletedDownloadJobId", default, skip_serializing_if = "Option::is_none")] + pub last_completed_download_job_id: Option, + #[doc = "JobStatus of the last ran download job."] + #[serde(rename = "lastDownloadJobStatus", default, skip_serializing_if = "Option::is_none")] + pub last_download_job_status: Option, + #[doc = "The time when the Last Install job was completed successfully on the appliance"] + #[serde(rename = "lastSuccessfulInstallJobDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_install_job_date_time: Option, + #[doc = "The time when the last Install job was completed (success/cancelled/failed) on the appliance."] + #[serde(rename = "lastCompletedInstallJobDateTime", default, skip_serializing_if = "Option::is_none")] + pub last_completed_install_job_date_time: Option, + #[doc = "JobId of the last ran install job.(Can be success/cancelled/failed)"] + #[serde(rename = "lastCompletedInstallJobId", default, skip_serializing_if = "Option::is_none")] + pub last_completed_install_job_id: Option, + #[doc = "JobStatus of the last ran install job."] + #[serde(rename = "lastInstallJobStatus", default, skip_serializing_if = "Option::is_none")] + pub last_install_job_status: Option, + #[doc = "The number of updates available for the current device version as per the last device scan."] + #[serde(rename = "totalNumberOfUpdatesAvailable", default, skip_serializing_if = "Option::is_none")] + pub total_number_of_updates_available: Option, + #[doc = "The total number of items pending download."] + #[serde(rename = "totalNumberOfUpdatesPendingDownload", default, skip_serializing_if = "Option::is_none")] + pub total_number_of_updates_pending_download: Option, + #[doc = "The total number of items pending install."] + #[serde(rename = "totalNumberOfUpdatesPendingInstall", default, skip_serializing_if = "Option::is_none")] + pub total_number_of_updates_pending_install: Option, + #[doc = "Indicates if updates are available and at least one of the updates needs a reboot."] + #[serde(rename = "rebootBehavior", default, skip_serializing_if = "Option::is_none")] + pub reboot_behavior: Option, + #[doc = "The current update operation."] + #[serde(rename = "ongoingUpdateOperation", default, skip_serializing_if = "Option::is_none")] + pub ongoing_update_operation: Option, + #[doc = "The job ID of the download job in progress."] + #[serde(rename = "inProgressDownloadJobId", default, skip_serializing_if = "Option::is_none")] + pub in_progress_download_job_id: Option, + #[doc = "The job ID of the install job in progress."] + #[serde(rename = "inProgressInstallJobId", default, skip_serializing_if = "Option::is_none")] + pub in_progress_install_job_id: Option, + #[doc = "The time when the currently running download (if any) started."] + #[serde(rename = "inProgressDownloadJobStartedDateTime", default, skip_serializing_if = "Option::is_none")] + pub in_progress_download_job_started_date_time: Option, + #[doc = "The time when the currently running install (if any) started."] + #[serde(rename = "inProgressInstallJobStartedDateTime", default, skip_serializing_if = "Option::is_none")] + pub in_progress_install_job_started_date_time: Option, + #[doc = "The list of updates available for install."] + #[serde(rename = "updateTitles", default, skip_serializing_if = "Vec::is_empty")] + pub update_titles: Vec, + #[doc = "The list of updates available for install."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub updates: Vec, + #[doc = "The total size of updates available for download in bytes."] + #[serde(rename = "totalUpdateSizeInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_update_size_in_bytes: Option, + #[doc = "The total time in Minutes"] + #[serde(rename = "totalTimeInMinutes", default, skip_serializing_if = "Option::is_none")] + pub total_time_in_minutes: Option, +} +impl UpdateSummaryProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod update_summary_properties { + use super::*; + #[doc = "JobStatus of the last ran download job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastDownloadJobStatus { + Invalid, + Running, + Succeeded, + Failed, + Canceled, + Paused, + Scheduled, + } + #[doc = "JobStatus of the last ran install job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastInstallJobStatus { + Invalid, + Running, + Succeeded, + Failed, + Canceled, + Paused, + Scheduled, + } + #[doc = "Indicates if updates are available and at least one of the updates needs a reboot."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RebootBehavior { + NeverReboots, + RequiresReboot, + RequestReboot, + } + #[doc = "The current update operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OngoingUpdateOperation { + None, + Scan, + Download, + Install, + } +} +#[doc = "The upload certificate request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UploadCertificateRequest { + #[doc = "Raw Certificate Data."] + pub properties: RawCertificateData, +} +impl UploadCertificateRequest { + pub fn new(properties: RawCertificateData) -> Self { + Self { properties } + } +} +#[doc = "The upload registration certificate response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UploadCertificateResponse { + #[doc = "Specifies authentication type."] + #[serde(rename = "authType", default, skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + #[doc = "The resource ID of the Data Box Edge/Gateway device."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Azure Active Directory tenant authority."] + #[serde(rename = "aadAuthority", default, skip_serializing_if = "Option::is_none")] + pub aad_authority: Option, + #[doc = "Azure Active Directory tenant ID."] + #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] + pub aad_tenant_id: Option, + #[doc = "Azure Active Directory service principal client ID."] + #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_client_id: Option, + #[doc = "Azure Active Directory service principal object ID."] + #[serde(rename = "servicePrincipalObjectId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_object_id: Option, + #[doc = "The azure management endpoint audience."] + #[serde(rename = "azureManagementEndpointAudience", default, skip_serializing_if = "Option::is_none")] + pub azure_management_endpoint_audience: Option, + #[doc = "Identifier of the target resource that is the recipient of the requested token."] + #[serde(rename = "aadAudience", default, skip_serializing_if = "Option::is_none")] + pub aad_audience: Option, +} +impl UploadCertificateResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod upload_certificate_response { + use super::*; + #[doc = "Specifies authentication type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthType { + Invalid, + AzureActiveDirectory, + } +} +#[doc = "Represents a user who has access to one or more shares on the Data Box Edge/Gateway device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct User { + #[serde(flatten)] + pub arm_base_model: ArmBaseModel, + #[doc = "The user properties."] + pub properties: UserProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl User { + pub fn new(properties: UserProperties) -> Self { + Self { + arm_base_model: ArmBaseModel::default(), + properties, + system_data: None, + } + } +} +#[doc = "The mapping between a particular user and the access type on the SMB share."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAccessRight { + #[doc = "User ID (already existing in the device)."] + #[serde(rename = "userId")] + pub user_id: String, + #[doc = "Type of access to be allowed for the user."] + #[serde(rename = "accessType")] + pub access_type: user_access_right::AccessType, +} +impl UserAccessRight { + pub fn new(user_id: String, access_type: user_access_right::AccessType) -> Self { + Self { user_id, access_type } + } +} +pub mod user_access_right { + use super::*; + #[doc = "Type of access to be allowed for the user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AccessType { + Change, + Read, + Custom, + } +} +#[doc = "Collection of users."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserList { + #[doc = "The list of users."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UserList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The user properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserProperties { + #[doc = "Represent the secrets intended for encryption with asymmetric key pair."] + #[serde(rename = "encryptedPassword", default, skip_serializing_if = "Option::is_none")] + pub encrypted_password: Option, + #[doc = "List of shares that the user has rights on. This field should not be specified during user creation."] + #[serde(rename = "shareAccessRights", default, skip_serializing_if = "Vec::is_empty")] + pub share_access_rights: Vec, + #[doc = "Type of the user."] + #[serde(rename = "userType")] + pub user_type: user_properties::UserType, +} +impl UserProperties { + pub fn new(user_type: user_properties::UserType) -> Self { + Self { + encrypted_password: None, + share_access_rights: Vec::new(), + user_type, + } + } +} +pub mod user_properties { + use super::*; + #[doc = "Type of the user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum UserType { + Share, + LocalManagement, + #[serde(rename = "ARM")] + Arm, + } +} +#[doc = "VmMemory Data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VmMemory { + #[doc = "The total amount of RAM in the virtual machine, as seen by the guest operating system. For a virtual machine with dynamic memory enabled, this represents the initial memory available at startup."] + #[serde(rename = "startupMemoryMB", default, skip_serializing_if = "Option::is_none")] + pub startup_memory_mb: Option, + #[doc = "The current memory used by the virtual machine."] + #[serde(rename = "currentMemoryUsageMB", default, skip_serializing_if = "Option::is_none")] + pub current_memory_usage_mb: Option, +} +impl VmMemory { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of VM sizes being checked for creation on appliance along with corresponding result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VmPlacementRequestResult { + #[doc = "List of VM sizes being checked."] + #[serde(rename = "vmSize", default, skip_serializing_if = "Vec::is_empty")] + pub vm_size: Vec, + #[doc = "Boolean value indicating if the\u{202f}VM(s)\u{202f}in\u{202f}VmSize\u{202f}can\u{202f}be\u{202f}created."] + #[serde(rename = "isFeasible", default, skip_serializing_if = "Option::is_none")] + pub is_feasible: Option, + #[doc = "MessageCode\u{202f}indicating reason for success or failure."] + #[serde(rename = "messageCode", default, skip_serializing_if = "Option::is_none")] + pub message_code: Option, + #[doc = "Localized message\u{202f}to\u{202f}be\u{202f}displayed\u{202f}to\u{202f}the\u{202f}user\u{202f}to\u{202f}explain\u{202f}the\u{202f}check\u{202f}result."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl VmPlacementRequestResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/databoxedge/src/package_2022_04_01_preview/operations.rs b/services/mgmt/databoxedge/src/package_2022_04_01_preview/operations.rs new file mode 100644 index 0000000000..fe4e1c4fe8 --- /dev/null +++ b/services/mgmt/databoxedge/src/package_2022_04_01_preview/operations.rs @@ -0,0 +1,7644 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn addons(&self) -> addons::Client { + addons::Client(self.clone()) + } + pub fn alerts(&self) -> alerts::Client { + alerts::Client(self.clone()) + } + pub fn available_skus(&self) -> available_skus::Client { + available_skus::Client(self.clone()) + } + pub fn bandwidth_schedules(&self) -> bandwidth_schedules::Client { + bandwidth_schedules::Client(self.clone()) + } + pub fn containers(&self) -> containers::Client { + containers::Client(self.clone()) + } + pub fn device_capacity_check(&self) -> device_capacity_check::Client { + device_capacity_check::Client(self.clone()) + } + pub fn device_capacity_info(&self) -> device_capacity_info::Client { + device_capacity_info::Client(self.clone()) + } + pub fn devices(&self) -> devices::Client { + devices::Client(self.clone()) + } + pub fn diagnostic_settings(&self) -> diagnostic_settings::Client { + diagnostic_settings::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn monitoring_config(&self) -> monitoring_config::Client { + monitoring_config::Client(self.clone()) + } + pub fn nodes(&self) -> nodes::Client { + nodes::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn operations_status(&self) -> operations_status::Client { + operations_status::Client(self.clone()) + } + pub fn orders(&self) -> orders::Client { + orders::Client(self.clone()) + } + pub fn roles(&self) -> roles::Client { + roles::Client(self.clone()) + } + pub fn shares(&self) -> shares::Client { + shares::Client(self.clone()) + } + pub fn storage_account_credentials(&self) -> storage_account_credentials::Client { + storage_account_credentials::Client(self.clone()) + } + pub fn storage_accounts(&self) -> storage_accounts::Client { + storage_accounts::Client(self.clone()) + } + pub fn support_packages(&self) -> support_packages::Client { + support_packages::Client(self.clone()) + } + pub fn triggers(&self) -> triggers::Client { + triggers::Client(self.clone()) + } + pub fn users(&self) -> users::Client { + users::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + AvailableSkus_List(#[from] available_skus::list::Error), + #[error(transparent)] + Devices_ListBySubscription(#[from] devices::list_by_subscription::Error), + #[error(transparent)] + Devices_ListByResourceGroup(#[from] devices::list_by_resource_group::Error), + #[error(transparent)] + Devices_Get(#[from] devices::get::Error), + #[error(transparent)] + Devices_CreateOrUpdate(#[from] devices::create_or_update::Error), + #[error(transparent)] + Devices_Update(#[from] devices::update::Error), + #[error(transparent)] + Devices_Delete(#[from] devices::delete::Error), + #[error(transparent)] + Alerts_ListByDataBoxEdgeDevice(#[from] alerts::list_by_data_box_edge_device::Error), + #[error(transparent)] + Alerts_Get(#[from] alerts::get::Error), + #[error(transparent)] + BandwidthSchedules_ListByDataBoxEdgeDevice(#[from] bandwidth_schedules::list_by_data_box_edge_device::Error), + #[error(transparent)] + BandwidthSchedules_Get(#[from] bandwidth_schedules::get::Error), + #[error(transparent)] + BandwidthSchedules_CreateOrUpdate(#[from] bandwidth_schedules::create_or_update::Error), + #[error(transparent)] + BandwidthSchedules_Delete(#[from] bandwidth_schedules::delete::Error), + #[error(transparent)] + DeviceCapacityCheck_CheckResourceCreationFeasibility(#[from] device_capacity_check::check_resource_creation_feasibility::Error), + #[error(transparent)] + DeviceCapacityInfo_GetDeviceCapacityInfo(#[from] device_capacity_info::get_device_capacity_info::Error), + #[error(transparent)] + DiagnosticSettings_GetDiagnosticProactiveLogCollectionSettings( + #[from] diagnostic_settings::get_diagnostic_proactive_log_collection_settings::Error, + ), + #[error(transparent)] + DiagnosticSettings_UpdateDiagnosticProactiveLogCollectionSettings( + #[from] diagnostic_settings::update_diagnostic_proactive_log_collection_settings::Error, + ), + #[error(transparent)] + DiagnosticSettings_GetDiagnosticRemoteSupportSettings(#[from] diagnostic_settings::get_diagnostic_remote_support_settings::Error), + #[error(transparent)] + DiagnosticSettings_UpdateDiagnosticRemoteSupportSettings(#[from] diagnostic_settings::update_diagnostic_remote_support_settings::Error), + #[error(transparent)] + Devices_DownloadUpdates(#[from] devices::download_updates::Error), + #[error(transparent)] + Devices_GenerateCertificate(#[from] devices::generate_certificate::Error), + #[error(transparent)] + Devices_GetExtendedInformation(#[from] devices::get_extended_information::Error), + #[error(transparent)] + Devices_InstallUpdates(#[from] devices::install_updates::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + Devices_GetNetworkSettings(#[from] devices::get_network_settings::Error), + #[error(transparent)] + Nodes_ListByDataBoxEdgeDevice(#[from] nodes::list_by_data_box_edge_device::Error), + #[error(transparent)] + OperationsStatus_Get(#[from] operations_status::get::Error), + #[error(transparent)] + Orders_ListByDataBoxEdgeDevice(#[from] orders::list_by_data_box_edge_device::Error), + #[error(transparent)] + Orders_Get(#[from] orders::get::Error), + #[error(transparent)] + Orders_CreateOrUpdate(#[from] orders::create_or_update::Error), + #[error(transparent)] + Orders_Delete(#[from] orders::delete::Error), + #[error(transparent)] + Orders_ListDcAccessCode(#[from] orders::list_dc_access_code::Error), + #[error(transparent)] + Roles_ListByDataBoxEdgeDevice(#[from] roles::list_by_data_box_edge_device::Error), + #[error(transparent)] + Roles_Get(#[from] roles::get::Error), + #[error(transparent)] + Roles_CreateOrUpdate(#[from] roles::create_or_update::Error), + #[error(transparent)] + Roles_Delete(#[from] roles::delete::Error), + #[error(transparent)] + Addons_ListByRole(#[from] addons::list_by_role::Error), + #[error(transparent)] + Addons_Get(#[from] addons::get::Error), + #[error(transparent)] + Addons_CreateOrUpdate(#[from] addons::create_or_update::Error), + #[error(transparent)] + Addons_Delete(#[from] addons::delete::Error), + #[error(transparent)] + MonitoringConfig_List(#[from] monitoring_config::list::Error), + #[error(transparent)] + MonitoringConfig_Get(#[from] monitoring_config::get::Error), + #[error(transparent)] + MonitoringConfig_CreateOrUpdate(#[from] monitoring_config::create_or_update::Error), + #[error(transparent)] + MonitoringConfig_Delete(#[from] monitoring_config::delete::Error), + #[error(transparent)] + Devices_ScanForUpdates(#[from] devices::scan_for_updates::Error), + #[error(transparent)] + Devices_CreateOrUpdateSecuritySettings(#[from] devices::create_or_update_security_settings::Error), + #[error(transparent)] + Shares_ListByDataBoxEdgeDevice(#[from] shares::list_by_data_box_edge_device::Error), + #[error(transparent)] + Shares_Get(#[from] shares::get::Error), + #[error(transparent)] + Shares_CreateOrUpdate(#[from] shares::create_or_update::Error), + #[error(transparent)] + Shares_Delete(#[from] shares::delete::Error), + #[error(transparent)] + Shares_Refresh(#[from] shares::refresh::Error), + #[error(transparent)] + StorageAccountCredentials_ListByDataBoxEdgeDevice(#[from] storage_account_credentials::list_by_data_box_edge_device::Error), + #[error(transparent)] + StorageAccountCredentials_Get(#[from] storage_account_credentials::get::Error), + #[error(transparent)] + StorageAccountCredentials_CreateOrUpdate(#[from] storage_account_credentials::create_or_update::Error), + #[error(transparent)] + StorageAccountCredentials_Delete(#[from] storage_account_credentials::delete::Error), + #[error(transparent)] + StorageAccounts_ListByDataBoxEdgeDevice(#[from] storage_accounts::list_by_data_box_edge_device::Error), + #[error(transparent)] + StorageAccounts_Get(#[from] storage_accounts::get::Error), + #[error(transparent)] + StorageAccounts_CreateOrUpdate(#[from] storage_accounts::create_or_update::Error), + #[error(transparent)] + StorageAccounts_Delete(#[from] storage_accounts::delete::Error), + #[error(transparent)] + Containers_ListByStorageAccount(#[from] containers::list_by_storage_account::Error), + #[error(transparent)] + Containers_Get(#[from] containers::get::Error), + #[error(transparent)] + Containers_CreateOrUpdate(#[from] containers::create_or_update::Error), + #[error(transparent)] + Containers_Delete(#[from] containers::delete::Error), + #[error(transparent)] + Containers_Refresh(#[from] containers::refresh::Error), + #[error(transparent)] + Triggers_ListByDataBoxEdgeDevice(#[from] triggers::list_by_data_box_edge_device::Error), + #[error(transparent)] + Triggers_Get(#[from] triggers::get::Error), + #[error(transparent)] + Triggers_CreateOrUpdate(#[from] triggers::create_or_update::Error), + #[error(transparent)] + Triggers_Delete(#[from] triggers::delete::Error), + #[error(transparent)] + SupportPackages_TriggerSupportPackage(#[from] support_packages::trigger_support_package::Error), + #[error(transparent)] + Devices_UpdateExtendedInformation(#[from] devices::update_extended_information::Error), + #[error(transparent)] + Devices_GetUpdateSummary(#[from] devices::get_update_summary::Error), + #[error(transparent)] + Devices_UploadCertificate(#[from] devices::upload_certificate::Error), + #[error(transparent)] + Users_ListByDataBoxEdgeDevice(#[from] users::list_by_data_box_edge_device::Error), + #[error(transparent)] + Users_Get(#[from] users::get::Error), + #[error(transparent)] + Users_CreateOrUpdate(#[from] users::create_or_update::Error), + #[error(transparent)] + Users_Delete(#[from] users::delete::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all the supported operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DataBoxEdge/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all the available Skus and information related to them."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBoxEdge/availableSkus", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeSkuList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod devices { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + expand: None, + } + } + pub fn get( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + data_box_edge_device: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + data_box_edge_device: data_box_edge_device.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn update( + &self, + device_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Downloads the updates on a Data Box Edge/Data Box Gateway device."] + pub fn download_updates( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> download_updates::Builder { + download_updates::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn generate_certificate( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> generate_certificate::Builder { + generate_certificate::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get_extended_information( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_extended_information::Builder { + get_extended_information::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Installs the updates on the Data Box Edge/Data Box Gateway device."] + pub fn install_updates( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> install_updates::Builder { + install_updates::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get_network_settings( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_network_settings::Builder { + get_network_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Scans for updates on a Data Box Edge/Data Box Gateway device."] + pub fn scan_for_updates( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> scan_for_updates::Builder { + scan_for_updates::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update_security_settings( + &self, + device_name: impl Into, + security_settings: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update_security_settings::Builder { + create_or_update_security_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + security_settings: security_settings.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn update_extended_information( + &self, + device_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> update_extended_information::Builder { + update_extended_information::Builder { + client: self.0.clone(), + device_name: device_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device."] + pub fn get_update_summary( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_update_summary::Builder { + get_update_summary::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn upload_certificate( + &self, + device_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> upload_certificate::Builder { + upload_certificate::Builder { + client: self.0.clone(), + device_name: device_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDeviceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDeviceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDevice = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) data_box_edge_device: models::DataBoxEdgeDevice, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.data_box_edge_device).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDevice = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) parameters: models::DataBoxEdgeDevicePatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDevice = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod download_updates { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/downloadUpdates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_certificate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/generateCertificate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GenerateCertResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_extended_information { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/getExtendedInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDeviceExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod install_updates { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/installUpdates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_network_settings { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/networkSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod scan_for_updates { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/scanForUpdates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_security_settings { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) security_settings: models::SecuritySettings, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/securitySettings/default/update" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.security_settings).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_extended_information { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) parameters: models::DataBoxEdgeDeviceExtendedInfoPatch, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/updateExtendedInformation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataBoxEdgeDeviceExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_summary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/updateSummary/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UpdateSummary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod upload_certificate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) parameters: models::UploadCertificateRequest, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/uploadCertificate", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UploadCertificateResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod alerts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets an alert by name."] + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/alerts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/alerts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod bandwidth_schedules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/bandwidthSchedules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BandwidthSchedulesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/bandwidthSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BandwidthSchedule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BandwidthSchedule), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) parameters: models::BandwidthSchedule, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/bandwidthSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BandwidthSchedule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/bandwidthSchedules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod device_capacity_check { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_resource_creation_feasibility( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + device_name: impl Into, + device_capacity_request_info: impl Into, + ) -> check_resource_creation_feasibility::Builder { + check_resource_creation_feasibility::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + device_name: device_name.into(), + device_capacity_request_info: device_capacity_request_info.into(), + capacity_name: None, + } + } + } + pub mod check_resource_creation_feasibility { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) device_name: String, + pub(crate) device_capacity_request_info: models::DeviceCapacityRequestInfo, + pub(crate) capacity_name: Option, + } + impl Builder { + pub fn capacity_name(mut self, capacity_name: impl Into) -> Self { + self.capacity_name = Some(capacity_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/deviceCapacityCheck", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.device_capacity_request_info).map_err(Error::Serialize)?; + if let Some(capacity_name) = &self.capacity_name { + url.query_pairs_mut().append_pair("capacityName", capacity_name); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod device_capacity_info { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_device_capacity_info( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + device_name: impl Into, + ) -> get_device_capacity_info::Builder { + get_device_capacity_info::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + device_name: device_name.into(), + } + } + } + pub mod get_device_capacity_info { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) device_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/deviceCapacityInfo/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCapacityInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod diagnostic_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_diagnostic_proactive_log_collection_settings( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_diagnostic_proactive_log_collection_settings::Builder { + get_diagnostic_proactive_log_collection_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn update_diagnostic_proactive_log_collection_settings( + &self, + device_name: impl Into, + proactive_log_collection_settings: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> update_diagnostic_proactive_log_collection_settings::Builder { + update_diagnostic_proactive_log_collection_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + proactive_log_collection_settings: proactive_log_collection_settings.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get_diagnostic_remote_support_settings( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_diagnostic_remote_support_settings::Builder { + get_diagnostic_remote_support_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn update_diagnostic_remote_support_settings( + &self, + device_name: impl Into, + diagnostic_remote_support_settings: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> update_diagnostic_remote_support_settings::Builder { + update_diagnostic_remote_support_settings::Builder { + client: self.0.clone(), + device_name: device_name.into(), + diagnostic_remote_support_settings: diagnostic_remote_support_settings.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod get_diagnostic_proactive_log_collection_settings { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/diagnosticProactiveLogCollectionSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticProactiveLogCollectionSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_diagnostic_proactive_log_collection_settings { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DiagnosticProactiveLogCollectionSettings), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) proactive_log_collection_settings: models::DiagnosticProactiveLogCollectionSettings, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/diagnosticProactiveLogCollectionSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.proactive_log_collection_settings).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticProactiveLogCollectionSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_diagnostic_remote_support_settings { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/diagnosticRemoteSupportSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticRemoteSupportSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_diagnostic_remote_support_settings { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::DiagnosticRemoteSupportSettings), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) diagnostic_remote_support_settings: models::DiagnosticRemoteSupportSettings, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/diagnosticRemoteSupportSettings/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.diagnostic_remote_support_settings).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DiagnosticRemoteSupportSettings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the details of a specified job on a Data Box Edge/Data Box Gateway device."] + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/jobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod nodes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/nodes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NodeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the details of a specified job on a Data Box Edge/Data Box Gateway device."] + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/operationsStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod orders { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists all the orders related to a Data Box Edge/Data Box Gateway device."] + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a specific order by name."] + pub fn get( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Creates or updates an order."] + pub fn create_or_update( + &self, + device_name: impl Into, + order: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + order: order.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Deletes the order related to the device."] + pub fn delete( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets the DCAccess Code"] + pub fn list_dc_access_code( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_dc_access_code::Builder { + list_dc_access_code::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/orders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OrderList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/orders/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Order = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Order), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) order: models::Order, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/orders/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.order).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Order = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/orders/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_dc_access_code { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/orders/default/listDCAccessCode" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DcAccessCode = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod roles { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + role: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + role: role.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Role = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Role), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) role: models::Role, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.role).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Role = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod addons { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_role( + &self, + device_name: impl Into, + role_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_role::Builder { + list_by_role::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + device_name: impl Into, + role_name: impl Into, + addon_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + addon_name: addon_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + role_name: impl Into, + addon_name: impl Into, + addon: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + addon_name: addon_name.into(), + addon: addon.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + role_name: impl Into, + addon_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + addon_name: addon_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_role { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/addons", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.role_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AddonList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) addon_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/addons/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.role_name, + &self.addon_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Addon = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Addon), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) addon_name: String, + pub(crate) addon: models::Addon, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/addons/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.role_name, + &self.addon_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.addon).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Addon = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) addon_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/addons/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.role_name, + &self.addon_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod monitoring_config { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists metric configurations in a role."] + pub fn list( + &self, + device_name: impl Into, + role_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a metric configuration of a role."] + pub fn get( + &self, + device_name: impl Into, + role_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Creates a new metric configuration or updates an existing one for a role."] + pub fn create_or_update( + &self, + device_name: impl Into, + role_name: impl Into, + monitoring_metric_configuration: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + monitoring_metric_configuration: monitoring_metric_configuration.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "deletes a new metric configuration for a role."] + pub fn delete( + &self, + device_name: impl Into, + role_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + role_name: role_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/monitoringConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringMetricConfigurationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/monitoringConfig/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringMetricConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MonitoringMetricConfiguration), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) monitoring_metric_configuration: models::MonitoringMetricConfiguration, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/monitoringConfig/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.monitoring_metric_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MonitoringMetricConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) role_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/roles/{}/monitoringConfig/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . role_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod shares { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists all the shares in a Data Box Edge/Data Box Gateway device."] + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a share by name."] + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Creates a new share or updates an existing share on the device."] + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + share: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + share: share.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Refreshes the share metadata with the data from the cloud."] + pub fn refresh( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/shares", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ShareList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/shares/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Share = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Share), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) share: models::Share, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/shares/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.share).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Share = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/shares/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/shares/{}/refresh", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod storage_account_credentials { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets all the storage account credentials in a Data Box Edge/Data Box Gateway device."] + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + storage_account_credential: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + storage_account_credential: storage_account_credential.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccountCredentials" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccountCredentialList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccountCredentials/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccountCredential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::StorageAccountCredential), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) storage_account_credential: models::StorageAccountCredential, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccountCredentials/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.storage_account_credential).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccountCredential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccountCredentials/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod storage_accounts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists all the StorageAccounts in a Data Box Edge/Data Box Gateway device."] + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a StorageAccount by name."] + pub fn get( + &self, + device_name: impl Into, + storage_account_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Creates a new StorageAccount or updates an existing StorageAccount on the device."] + pub fn create_or_update( + &self, + device_name: impl Into, + storage_account_name: impl Into, + storage_account: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + storage_account: storage_account.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + storage_account_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccountList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.storage_account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::StorageAccount), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) storage_account: models::StorageAccount, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.storage_account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.storage_account).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageAccount = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.storage_account_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists all the containers of a storage Account in a Data Box Edge/Data Box Gateway device."] + pub fn list_by_storage_account( + &self, + device_name: impl Into, + storage_account_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_storage_account::Builder { + list_by_storage_account::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a container by name."] + pub fn get( + &self, + device_name: impl Into, + storage_account_name: impl Into, + container_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + container_name: container_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Creates a new container or updates an existing container on the device."] + pub fn create_or_update( + &self, + device_name: impl Into, + storage_account_name: impl Into, + container_name: impl Into, + container: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + container_name: container_name.into(), + container: container.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + storage_account_name: impl Into, + container_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + container_name: container_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Refreshes the container metadata with the data from the cloud."] + pub fn refresh( + &self, + device_name: impl Into, + storage_account_name: impl Into, + container_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + device_name: device_name.into(), + storage_account_name: storage_account_name.into(), + container_name: container_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_storage_account { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}/containers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . storage_account_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContainerList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) container_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . storage_account_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Container = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Container), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) container_name: String, + pub(crate) container: models::Container, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . storage_account_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.container).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Container = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) container_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}/containers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . storage_account_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) storage_account_name: String, + pub(crate) container_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/storageAccounts/{}/containers/{}/refresh" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . device_name , & self . storage_account_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod triggers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + filter: None, + } + } + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + trigger: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + trigger: trigger.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/triggers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/triggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Trigger), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) trigger: models::Trigger, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/triggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.trigger).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/triggers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod support_packages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Triggers support package on the device"] + pub fn trigger_support_package( + &self, + device_name: impl Into, + trigger_support_package_request: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> trigger_support_package::Builder { + trigger_support_package::Builder { + client: self.0.clone(), + device_name: device_name.into(), + trigger_support_package_request: trigger_support_package_request.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod trigger_support_package { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) trigger_support_package_request: models::TriggerSupportPackageRequest, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/triggerSupportPackage", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.trigger_support_package_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod users { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_data_box_edge_device( + &self, + device_name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_data_box_edge_device::Builder { + list_by_data_box_edge_device::Builder { + client: self.0.clone(), + device_name: device_name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + filter: None, + } + } + pub fn get( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn create_or_update( + &self, + device_name: impl Into, + name: impl Into, + user: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + user: user.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn delete( + &self, + device_name: impl Into, + name: impl Into, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + device_name: device_name.into(), + name: name.into(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + } + pub mod list_by_data_box_edge_device { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/users", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::User), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) user: models::User, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.user).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_name: String, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{}/users/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.device_name, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/databricks/Cargo.toml b/services/mgmt/databricks/Cargo.toml index 297f0b5b8a..c1f47113e2 100644 --- a/services/mgmt/databricks/Cargo.toml +++ b/services/mgmt/databricks/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_databricks" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/datacatalog/Cargo.toml b/services/mgmt/datacatalog/Cargo.toml index 4dccea6b22..72834638ea 100644 --- a/services/mgmt/datacatalog/Cargo.toml +++ b/services/mgmt/datacatalog/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datacatalog" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/datadog/Cargo.toml b/services/mgmt/datadog/Cargo.toml index e61388d7ac..ce579b15a0 100644 --- a/services/mgmt/datadog/Cargo.toml +++ b/services/mgmt/datadog/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datadog" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/datafactory/Cargo.toml b/services/mgmt/datafactory/Cargo.toml index 797e8a52f5..51bb5d0cd0 100644 --- a/services/mgmt/datafactory/Cargo.toml +++ b/services/mgmt/datafactory/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datafactory" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/datafactory/src/package_2018_06/models.rs b/services/mgmt/datafactory/src/package_2018_06/models.rs index bd2dadd880..8718b1d8a8 100644 --- a/services/mgmt/datafactory/src/package_2018_06/models.rs +++ b/services/mgmt/datafactory/src/package_2018_06/models.rs @@ -928,6 +928,44 @@ impl AmazonS3ReadSettings { } } } +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} #[doc = "Append value for a Variable of type Array."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AppendVariableActivity { @@ -971,6 +1009,41 @@ impl ArmIdWrapper { Self::default() } } +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AvroCompressionCodec { #[serde(rename = "none")] @@ -6231,6 +6304,41 @@ impl DatasetStorageFormat { } } } +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "The days of the week."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum DayOfWeek { @@ -15061,6 +15169,18 @@ impl PrestoSource { } } } +#[doc = "Private endpoint which a connection belongs to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The resource Id for private endpoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} #[doc = "A list of linked service resources."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PrivateEndpointConnectionListResponse { @@ -15095,6 +15215,9 @@ pub struct PrivateLinkConnectionApprovalRequest { #[doc = "The state of a private link connection"] #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] pub private_link_service_connection_state: Option, + #[doc = "Private endpoint which a connection belongs to."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, } impl PrivateLinkConnectionApprovalRequest { pub fn new() -> Self { @@ -20482,6 +20605,37 @@ impl TumblingWindowTriggerDependencyReference { } } } +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} #[doc = "Type conversion settings"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct TypeConversionSettings { diff --git a/services/mgmt/datalakeanalytics/Cargo.toml b/services/mgmt/datalakeanalytics/Cargo.toml index 120b7f7c93..ff2bd6e122 100644 --- a/services/mgmt/datalakeanalytics/Cargo.toml +++ b/services/mgmt/datalakeanalytics/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datalakeanalytics" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/datalakestore/Cargo.toml b/services/mgmt/datalakestore/Cargo.toml index 070ca6e8d0..b6a708c89f 100644 --- a/services/mgmt/datalakestore/Cargo.toml +++ b/services/mgmt/datalakestore/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datalakestore" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dataprotection/Cargo.toml b/services/mgmt/dataprotection/Cargo.toml index 5de16cb53d..dd6d31baa1 100644 --- a/services/mgmt/dataprotection/Cargo.toml +++ b/services/mgmt/dataprotection/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_dataprotection" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2022-01", "package-2021-10-preview", "package-2021-07", "package-2021-01"] +features = ["no-default-tag", "package-preview-2022-02", "package-2022-01", "package-2021-10-preview", "package-2021-07"] [features] -default = ["package-preview-2022-02", "enable_reqwest"] +default = ["package-preview-2022-03", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-preview-2022-03" = [] "package-preview-2022-02" = [] "package-2022-01" = [] "package-2021-10-preview" = [] @@ -39,3 +40,4 @@ no-default-tag = [] "package-2021-02-preview" = [] "package-2021-06-preview" = [] "package-2021-12-preview" = [] +"package-2022-03" = [] diff --git a/services/mgmt/dataprotection/README.md b/services/mgmt/dataprotection/README.md index 4cc366480c..a3ff020205 100644 --- a/services/mgmt/dataprotection/README.md +++ b/services/mgmt/dataprotection/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/dataprotec To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-preview-2022-02`. +The default tag is `package-preview-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-preview-2022-03` has 59 operations from 1 API versions: `2022-03-31-preview`. Use crate feature `package-preview-2022-03` to enable. The operations will be in the `package_preview_2022_03` module. - `package-preview-2022-02` has 58 operations from 1 API versions: `2022-02-01-preview`. Use crate feature `package-preview-2022-02` to enable. The operations will be in the `package_preview_2022_02` module. - `package-2022-01` has 58 operations from 1 API versions: `2022-01-01`. Use crate feature `package-2022-01` to enable. The operations will be in the `package_2022_01` module. - `package-2021-10-preview` has 50 operations from 1 API versions: `2021-10-01-preview`. Use crate feature `package-2021-10-preview` to enable. The operations will be in the `package_2021_10_preview` module. @@ -17,4 +18,5 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-2021-01` has 32 operations from 1 API versions: `2021-01-01`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. - `package-2021-02-preview` has 37 operations from 1 API versions: `2021-02-01-preview`. Use crate feature `package-2021-02-preview` to enable. The operations will be in the `package_2021_02_preview` module. - `package-2021-06-preview` has 37 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-2021-06-preview` to enable. The operations will be in the `package_2021_06_preview` module. -- `package-2021-12-preview` has 50 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-2021-12-preview` to enable. The operations will be in the `package_2021_12_preview` module. \ No newline at end of file +- `package-2021-12-preview` has 50 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-2021-12-preview` to enable. The operations will be in the `package_2021_12_preview` module. +- `package-2022-03` has 58 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. \ No newline at end of file diff --git a/services/mgmt/dataprotection/src/lib.rs b/services/mgmt/dataprotection/src/lib.rs index 0947cfdd45..f8c1bcbd84 100644 --- a/services/mgmt/dataprotection/src/lib.rs +++ b/services/mgmt/dataprotection/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-preview-2022-03")] +pub mod package_preview_2022_03; +#[cfg(all(feature = "package-preview-2022-03", not(feature = "no-default-tag")))] +pub use package_preview_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2022-02")] pub mod package_preview_2022_02; #[cfg(all(feature = "package-preview-2022-02", not(feature = "no-default-tag")))] @@ -35,3 +39,7 @@ pub use package_2021_06_preview::{models, operations, operations::Client, operat pub mod package_2021_12_preview; #[cfg(all(feature = "package-2021-12-preview", not(feature = "no-default-tag")))] pub use package_2021_12_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-03")] +pub mod package_2022_03; +#[cfg(all(feature = "package-2022-03", not(feature = "no-default-tag")))] +pub use package_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/dataprotection/src/package_2022_03/mod.rs b/services/mgmt/dataprotection/src/package_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/dataprotection/src/package_2022_03/models.rs b/services/mgmt/dataprotection/src/package_2022_03/models.rs new file mode 100644 index 0000000000..40beb148c3 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2022_03/models.rs @@ -0,0 +1,2579 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Delete option with duration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AbsoluteDeleteOption { + #[serde(flatten)] + pub delete_option: DeleteOption, +} +impl AbsoluteDeleteOption { + pub fn new(delete_option: DeleteOption) -> Self { + Self { delete_option } + } +} +#[doc = "Adhoc backup rules"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdHocBackupRuleOptions { + #[serde(rename = "ruleName")] + pub rule_name: String, + #[doc = "Adhoc backup trigger option"] + #[serde(rename = "triggerOption")] + pub trigger_option: AdhocBackupTriggerOption, +} +impl AdHocBackupRuleOptions { + pub fn new(rule_name: String, trigger_option: AdhocBackupTriggerOption) -> Self { + Self { rule_name, trigger_option } + } +} +#[doc = "Adhoc backup trigger option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdhocBackupTriggerOption { + #[serde(rename = "retentionTagOverride", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_override: Option, +} +impl AdhocBackupTriggerOption { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Adhoc backup tagging criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdhocBasedTaggingCriteria { + #[doc = "Retention tag"] + #[serde(rename = "tagInfo", default, skip_serializing_if = "Option::is_none")] + pub tag_info: Option, +} +impl AdhocBasedTaggingCriteria { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Adhoc trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdhocBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + #[doc = "Adhoc backup tagging criteria"] + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: AdhocBasedTaggingCriteria, +} +impl AdhocBasedTriggerContext { + pub fn new(trigger_context: TriggerContext, tagging_criteria: AdhocBasedTaggingCriteria) -> Self { + Self { + trigger_context, + tagging_criteria, + } + } +} +#[doc = "Base class for different types of authentication credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthCredentials { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl AuthCredentials { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Azure backup discrete RecoveryPoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupDiscreteRecoveryPoint { + #[serde(flatten)] + pub azure_backup_recovery_point: AzureBackupRecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointDataStoresDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_data_stores_details: Vec, + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "retentionTagName", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_name: Option, + #[serde(rename = "retentionTagVersion", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_version: Option, +} +impl AzureBackupDiscreteRecoveryPoint { + pub fn new(azure_backup_recovery_point: AzureBackupRecoveryPoint, recovery_point_time: String) -> Self { + Self { + azure_backup_recovery_point, + friendly_name: None, + recovery_point_data_stores_details: Vec::new(), + recovery_point_time, + policy_name: None, + policy_version: None, + recovery_point_id: None, + recovery_point_type: None, + retention_tag_name: None, + retention_tag_version: None, + } + } +} +#[doc = "List Restore Ranges Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesRequest { + #[doc = "Gets or sets the type of the source data store."] + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_find_restorable_time_ranges_request::SourceDataStoreType, + #[doc = "Start time for the List Restore Ranges request. ISO 8601 format."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "End time for the List Restore Ranges request. ISO 8601 format."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +impl AzureBackupFindRestorableTimeRangesRequest { + pub fn new(source_data_store_type: azure_backup_find_restorable_time_ranges_request::SourceDataStoreType) -> Self { + Self { + source_data_store_type, + start_time: None, + end_time: None, + } + } +} +pub mod azure_backup_find_restorable_time_ranges_request { + use super::*; + #[doc = "Gets or sets the type of the source data store."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "List Restore Ranges Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesRequestResource { + #[serde(flatten)] + pub dpp_worker_request: DppWorkerRequest, + #[doc = "List Restore Ranges Request"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +impl AzureBackupFindRestorableTimeRangesRequestResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List Restore Ranges Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesResponse { + #[doc = "Returns the Restore Ranges available on the Backup Instance."] + #[serde(rename = "restorableTimeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub restorable_time_ranges: Vec, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +impl AzureBackupFindRestorableTimeRangesResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List Restore Ranges Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesResponseResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "List Restore Ranges Response"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupFindRestorableTimeRangesResponseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureBackup Job Class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupJob { + #[doc = "Job Activity Id"] + #[serde(rename = "activityID")] + pub activity_id: String, + #[doc = "Name of the Backup Instance"] + #[serde(rename = "backupInstanceFriendlyName")] + pub backup_instance_friendly_name: String, + #[doc = "ARM ID of the Backup Instance"] + #[serde(rename = "backupInstanceId", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_id: Option, + #[doc = "ARM ID of the DataSource"] + #[serde(rename = "dataSourceId")] + pub data_source_id: String, + #[doc = "Location of the DataSource"] + #[serde(rename = "dataSourceLocation")] + pub data_source_location: String, + #[doc = "User Friendly Name of the DataSource"] + #[serde(rename = "dataSourceName")] + pub data_source_name: String, + #[doc = "Data Source Set Name of the DataSource"] + #[serde(rename = "dataSourceSetName", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_name: Option, + #[doc = "Type of DataSource"] + #[serde(rename = "dataSourceType")] + pub data_source_type: String, + #[doc = "Total run time of the job. ISO 8601 format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "EndTime of the job(in UTC)"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "A List, detailing the errors related to the job"] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Extended Information about the job"] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Indicated that whether the job is adhoc(true) or scheduled(false)"] + #[serde(rename = "isUserTriggered")] + pub is_user_triggered: bool, + #[doc = "It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure"] + pub operation: String, + #[doc = "It indicates the type of Job i.e. Backup/Restore/Tiering/Management"] + #[serde(rename = "operationCategory")] + pub operation_category: String, + #[doc = "ARM ID of the policy"] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Name of the policy"] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Indicated whether progress is enabled for the job"] + #[serde(rename = "progressEnabled")] + pub progress_enabled: bool, + #[doc = "Url which contains job's progress"] + #[serde(rename = "progressUrl", default, skip_serializing_if = "Option::is_none")] + pub progress_url: Option, + #[doc = "It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR"] + #[serde(rename = "restoreType", default, skip_serializing_if = "Option::is_none")] + pub restore_type: Option, + #[doc = "Resource Group Name of the Datasource"] + #[serde(rename = "sourceResourceGroup")] + pub source_resource_group: String, + #[doc = "SubscriptionId corresponding to the DataSource"] + #[serde(rename = "sourceSubscriptionID")] + pub source_subscription_id: String, + #[doc = "StartTime of the job(in UTC)"] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning"] + pub status: String, + #[doc = "Subscription Id of the corresponding backup vault"] + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[doc = "List of supported actions"] + #[serde(rename = "supportedActions")] + pub supported_actions: Vec, + #[doc = "Name of the vault"] + #[serde(rename = "vaultName")] + pub vault_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "sourceDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub source_data_store_name: Option, + #[serde(rename = "destinationDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub destination_data_store_name: Option, +} +impl AzureBackupJob { + pub fn new( + activity_id: String, + backup_instance_friendly_name: String, + data_source_id: String, + data_source_location: String, + data_source_name: String, + data_source_type: String, + is_user_triggered: bool, + operation: String, + operation_category: String, + progress_enabled: bool, + source_resource_group: String, + source_subscription_id: String, + start_time: String, + status: String, + subscription_id: String, + supported_actions: Vec, + vault_name: String, + ) -> Self { + Self { + activity_id, + backup_instance_friendly_name, + backup_instance_id: None, + data_source_id, + data_source_location, + data_source_name, + data_source_set_name: None, + data_source_type, + duration: None, + end_time: None, + error_details: Vec::new(), + extended_info: None, + is_user_triggered, + operation, + operation_category, + policy_id: None, + policy_name: None, + progress_enabled, + progress_url: None, + restore_type: None, + source_resource_group, + source_subscription_id, + start_time, + status, + subscription_id, + supported_actions, + vault_name, + etag: None, + source_data_store_name: None, + destination_data_store_name: None, + } + } +} +#[doc = "AzureBackup Job Resource Class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupJobResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "AzureBackup Job Class"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupJobResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of AzureBackup Job resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupJobResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AzureBackupJobResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure backup parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupParams { + #[serde(flatten)] + pub backup_parameters: BackupParameters, + #[doc = "BackupType ; Full/Incremental etc"] + #[serde(rename = "backupType")] + pub backup_type: String, +} +impl AzureBackupParams { + pub fn new(backup_parameters: BackupParameters, backup_type: String) -> Self { + Self { + backup_parameters, + backup_type, + } + } +} +#[doc = "Azure backup recoveryPoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +impl AzureBackupRecoveryPoint { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Azure backup recoveryPoint based restore request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPointBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, +} +impl AzureBackupRecoveryPointBasedRestoreRequest { + pub fn new(azure_backup_restore_request: AzureBackupRestoreRequest, recovery_point_id: String) -> Self { + Self { + azure_backup_restore_request, + recovery_point_id, + } + } +} +#[doc = "Azure backup recoveryPoint resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupRecoveryPointResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "Azure backup recoveryPoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupRecoveryPointResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure backup recoveryPoint resource list"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupRecoveryPointResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AzureBackupRecoveryPointResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureBackup RecoveryPointTime Based Restore Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryTimeBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[doc = "The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z."] + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, +} +impl AzureBackupRecoveryTimeBasedRestoreRequest { + pub fn new(azure_backup_restore_request: AzureBackupRestoreRequest, recovery_point_time: String) -> Self { + Self { + azure_backup_restore_request, + recovery_point_time, + } + } +} +#[doc = "Azure Backup Rehydrate Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRehydrationRequest { + #[doc = "Id of the recovery point to be recovered"] + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, + #[doc = "Priority to be used for rehydration. Values High or Standard"] + #[serde(rename = "rehydrationPriority", default, skip_serializing_if = "Option::is_none")] + pub rehydration_priority: Option, + #[doc = "Retention duration in ISO 8601 format i.e P10D ."] + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +impl AzureBackupRehydrationRequest { + pub fn new(recovery_point_id: String, rehydration_retention_duration: String) -> Self { + Self { + recovery_point_id, + rehydration_priority: None, + rehydration_retention_duration, + } + } +} +#[doc = "Azure backup restore request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "Base class common to RestoreTargetInfo and RestoreFilesTargetInfo"] + #[serde(rename = "restoreTargetInfo")] + pub restore_target_info: RestoreTargetInfoBase, + #[doc = "Gets or sets the type of the source data store."] + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_restore_request::SourceDataStoreType, + #[doc = "Fully qualified Azure Resource Manager ID of the datasource which is being recovered."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +impl AzureBackupRestoreRequest { + pub fn new( + object_type: String, + restore_target_info: RestoreTargetInfoBase, + source_data_store_type: azure_backup_restore_request::SourceDataStoreType, + ) -> Self { + Self { + object_type, + restore_target_info, + source_data_store_type, + source_resource_id: None, + } + } +} +pub mod azure_backup_restore_request { + use super::*; + #[doc = "Gets or sets the type of the source data store."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } +} +#[doc = "AzureBackup Restore with Rehydration Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreWithRehydrationRequest { + #[serde(flatten)] + pub azure_backup_recovery_point_based_restore_request: AzureBackupRecoveryPointBasedRestoreRequest, + #[doc = "Priority to be used for rehydration. Values High or Standard"] + #[serde(rename = "rehydrationPriority")] + pub rehydration_priority: RehydrationPriority, + #[doc = "Retention duration in ISO 8601 format i.e P10D ."] + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +impl AzureBackupRestoreWithRehydrationRequest { + pub fn new( + azure_backup_recovery_point_based_restore_request: AzureBackupRecoveryPointBasedRestoreRequest, + rehydration_priority: RehydrationPriority, + rehydration_retention_duration: String, + ) -> Self { + Self { + azure_backup_recovery_point_based_restore_request, + rehydration_priority, + rehydration_retention_duration, + } + } +} +#[doc = "Azure backup rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[doc = "BackupParameters base"] + #[serde(rename = "backupParameters", default, skip_serializing_if = "Option::is_none")] + pub backup_parameters: Option, + #[doc = "DataStoreInfo base"] + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, + #[doc = "Trigger context"] + pub trigger: TriggerContext, +} +impl AzureBackupRule { + pub fn new(base_policy_rule: BasePolicyRule, data_store: DataStoreInfoBase, trigger: TriggerContext) -> Self { + Self { + base_policy_rule, + backup_parameters: None, + data_store, + trigger, + } + } +} +#[doc = "Parameters for Operational-Tier DataStore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureOperationalStoreParameters { + #[serde(flatten)] + pub data_store_parameters: DataStoreParameters, + #[doc = "Gets or sets the Snapshot Resource Group Uri."] + #[serde(rename = "resourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub resource_group_id: Option, +} +impl AzureOperationalStoreParameters { + pub fn new(data_store_parameters: DataStoreParameters) -> Self { + Self { + data_store_parameters, + resource_group_id: None, + } + } +} +#[doc = "Azure retention rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureRetentionRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + pub lifecycles: Vec, +} +impl AzureRetentionRule { + pub fn new(base_policy_rule: BasePolicyRule, lifecycles: Vec) -> Self { + Self { + base_policy_rule, + is_default: None, + lifecycles, + } + } +} +#[doc = "BackupCriteria base class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupCriteria { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupCriteria { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Backup Instance"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupInstance { + #[doc = "Gets or sets the Backup Instance friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Datasource to be backed up"] + #[serde(rename = "dataSourceInfo")] + pub data_source_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "dataSourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_info: Option, + #[doc = "Policy Info in backupInstance"] + #[serde(rename = "policyInfo")] + pub policy_info: PolicyInfo, + #[doc = "Protection status details"] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Specifies the current protection state of the resource"] + #[serde(rename = "currentProtectionState", default, skip_serializing_if = "Option::is_none")] + pub current_protection_state: Option, + #[doc = "Error object used by layers that have access to localized content, and propagate that to user"] + #[serde(rename = "protectionErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub protection_error_details: Option, + #[doc = "Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, + #[doc = "Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again."] + #[serde(rename = "validationType", default, skip_serializing_if = "Option::is_none")] + pub validation_type: Option, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupInstance { + pub fn new(data_source_info: Datasource, policy_info: PolicyInfo, object_type: String) -> Self { + Self { + friendly_name: None, + data_source_info, + data_source_set_info: None, + policy_info, + protection_status: None, + current_protection_state: None, + protection_error_details: None, + provisioning_state: None, + datasource_auth_credentials: None, + validation_type: None, + object_type, + } + } +} +pub mod backup_instance { + use super::*; + #[doc = "Specifies the current protection state of the resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentProtectionState { + Invalid, + NotProtected, + ConfiguringProtection, + ProtectionConfigured, + BackupSchedulesSuspended, + RetentionSchedulesSuspended, + ProtectionStopped, + ProtectionError, + ConfiguringProtectionFailed, + SoftDeleting, + SoftDeleted, + UpdatingProtection, + } + #[doc = "Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationType { + ShallowValidation, + DeepValidation, + } +} +#[doc = "BackupInstance Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupInstanceResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "Backup Instance"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupInstanceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupInstance Resource list response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupInstanceResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupInstanceResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupParameters base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupParameters { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupParameters { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Rule based backup policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + #[serde(flatten)] + pub base_backup_policy: BaseBackupPolicy, + #[doc = "Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc"] + #[serde(rename = "policyRules")] + pub policy_rules: Vec, +} +impl BackupPolicy { + pub fn new(base_backup_policy: BaseBackupPolicy, policy_rules: Vec) -> Self { + Self { + base_backup_policy, + policy_rules, + } + } +} +#[doc = "Schedule for backup"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupSchedule { + #[doc = "ISO 8601 repeating time interval format"] + #[serde(rename = "repeatingTimeIntervals")] + pub repeating_time_intervals: Vec, + #[doc = "Time zone for a schedule. Example: Pacific Standard Time"] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl BackupSchedule { + pub fn new(repeating_time_intervals: Vec) -> Self { + Self { + repeating_time_intervals, + time_zone: None, + } + } +} +#[doc = "Backup Vault"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVault { + #[doc = "Provisioning state of the BackupVault resource"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Resource move state for backup vault"] + #[serde(rename = "resourceMoveState", default, skip_serializing_if = "Option::is_none")] + pub resource_move_state: Option, + #[doc = "ResourceMoveDetails will be returned in response to GetResource call from ARM"] + #[serde(rename = "resourceMoveDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_move_details: Option, + #[doc = "Storage Settings"] + #[serde(rename = "storageSettings")] + pub storage_settings: Vec, +} +impl BackupVault { + pub fn new(storage_settings: Vec) -> Self { + Self { + provisioning_state: None, + resource_move_state: None, + resource_move_details: None, + storage_settings, + } + } +} +pub mod backup_vault { + use super::*; + #[doc = "Provisioning state of the BackupVault resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } + #[doc = "Resource move state for backup vault"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceMoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + Failed, + PrepareTimedout, + CommitTimedout, + CriticalFailure, + PartialSuccess, + MoveSucceeded, + } +} +#[doc = "Backup Vault Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVaultResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + #[doc = "Backup Vault"] + pub properties: BackupVault, +} +impl BackupVaultResource { + pub fn new(properties: BackupVault) -> Self { + Self { + dpp_tracked_resource: DppTrackedResource::default(), + properties, + } + } +} +#[doc = "List of BackupVault resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupVaultResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupVaultResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupPolicy base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseBackupPolicy { + #[doc = "Type of datasource for the backup management"] + #[serde(rename = "datasourceTypes")] + pub datasource_types: Vec, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BaseBackupPolicy { + pub fn new(datasource_types: Vec, object_type: String) -> Self { + Self { + datasource_types, + object_type, + } + } +} +#[doc = "BaseBackupPolicy resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BaseBackupPolicyResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "BackupPolicy base"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BaseBackupPolicyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of BaseBackupPolicy resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BaseBackupPolicyResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BaseBackupPolicyResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BasePolicy Rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BasePolicyRule { + pub name: String, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BasePolicyRule { + pub fn new(name: String, object_type: String) -> Self { + Self { name, object_type } + } +} +#[doc = "CheckNameAvailability Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityRequest { + #[doc = "Resource name for which availability needs to be checked"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Describes the Resource type: Microsoft.DataProtection/BackupVaults"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CheckNameAvailabilityRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "CheckNameAvailability Result"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[doc = "Gets or sets the message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Gets or sets a value indicating whether [name available]."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "Gets or sets the reason."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Localized display information of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryDisplay { + #[doc = "Description of the operation having details of what operation is about."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Operations Name itself."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Name of the provider for display purposes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "ResourceType for which this Operation can be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl ClientDiscoveryDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox log specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForLogSpecification { + #[doc = "blob duration of shoebox log specification"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + #[doc = "Localized display name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Name for shoebox log specification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ClientDiscoveryForLogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox properties in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForProperties { + #[doc = "Class to represent shoebox service specification in json client discovery."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl ClientDiscoveryForProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox service specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForServiceSpecification { + #[doc = "List of log specifications of this operation."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +impl ClientDiscoveryForServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations List response which contains list of available APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryResponse { + #[doc = "Link to the next chunk of Response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "List of available operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ClientDiscoveryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryValueForSingleApi { + #[doc = "Localized display information of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Name of the Operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Indicates whether the operation is a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Class to represent shoebox properties in json client discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientDiscoveryValueForSingleApi { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from Azure Backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Copy on Expiry Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOnExpiryOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +impl CopyOnExpiryOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { copy_option } + } +} +#[doc = "Options to copy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOption { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl CopyOption { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Duration based custom options to copy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, + #[doc = "Data copied after given timespan"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, +} +impl CustomCopyOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { + copy_option, + duration: None, + } + } +} +#[doc = "DataStoreInfo base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreInfoBase { + #[doc = "type of datastore; Operational/Vault/Archive"] + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_info_base::DataStoreType, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl DataStoreInfoBase { + pub fn new(data_store_type: data_store_info_base::DataStoreType, object_type: String) -> Self { + Self { + data_store_type, + object_type, + } + } +} +pub mod data_store_info_base { + use super::*; + #[doc = "type of datastore; Operational/Vault/Archive"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "Parameters for DataStore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreParameters { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "type of datastore; Operational/Vault/Archive"] + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_parameters::DataStoreType, +} +impl DataStoreParameters { + pub fn new(object_type: String, data_store_type: data_store_parameters::DataStoreType) -> Self { + Self { + object_type, + data_store_type, + } + } +} +pub mod data_store_parameters { + use super::*; + #[doc = "type of datastore; Operational/Vault/Archive"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "Datasource to be backed up"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Datasource { + #[doc = "DatasourceType of the resource."] + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault."] + #[serde(rename = "resourceID")] + pub resource_id: String, + #[doc = "Location of datasource."] + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[doc = "Unique identifier of the resource in the context of parent."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[doc = "Resource Type of Datasource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Uri of the resource."] + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +impl Datasource { + pub fn new(resource_id: String) -> Self { + Self { + datasource_type: None, + object_type: None, + resource_id, + resource_location: None, + resource_name: None, + resource_type: None, + resource_uri: None, + } + } +} +#[doc = "DatasourceSet details of datasource to be backed up"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasourceSet { + #[doc = "DatasourceType of the resource."] + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault."] + #[serde(rename = "resourceID")] + pub resource_id: String, + #[doc = "Location of datasource."] + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[doc = "Unique identifier of the resource in the context of parent."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[doc = "Resource Type of Datasource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Uri of the resource."] + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +impl DatasourceSet { + pub fn new(resource_id: String) -> Self { + Self { + datasource_type: None, + object_type: None, + resource_id, + resource_location: None, + resource_name: None, + resource_type: None, + resource_uri: None, + } + } +} +#[doc = "Day of the week"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Day { + #[doc = "Date of the month"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub date: Option, + #[doc = "Whether Date is last date of month"] + #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] + pub is_last: Option, +} +impl Day { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delete Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteOption { + #[doc = "Duration of deletion after given timespan"] + pub duration: String, + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl DeleteOption { + pub fn new(duration: String, object_type: String) -> Self { + Self { duration, object_type } + } +} +#[doc = "Base resource under Microsoft.DataProtection provider namespace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppBaseResource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DppBaseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base for all lists of V2 resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppBaseResourceList { + #[doc = "List of Dpp resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppBaseResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppIdentityDetails { + #[doc = "The object ID of the service principal object for the managed identity that is used to grant role-based access to an Azure resource."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identityType which can be either SystemAssigned or None"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DppIdentityDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppResource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DppResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ListResource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppResourceList { + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppTrackedResource { + #[doc = "Optional ETag."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Identity details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DppTrackedResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppTrackedResourceList { + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppTrackedResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppWorkerRequest { + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(rename = "supportedGroupVersions", default, skip_serializing_if = "Vec::is_empty")] + pub supported_group_versions: Vec, + #[serde(rename = "cultureInfo", default, skip_serializing_if = "Option::is_none")] + pub culture_info: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[serde(rename = "httpMethod", default, skip_serializing_if = "Option::is_none")] + pub http_method: Option, +} +impl DppWorkerRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result for export jobs containing blob details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportJobsResult { + #[doc = "URL of the blob into which the serialized string of list of jobs is exported."] + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, + #[doc = "SAS key to access the blob."] + #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] + pub blob_sas_key: Option, + #[doc = "URL of the blob into which the ExcelFile is uploaded."] + #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_url: Option, + #[doc = "SAS key to access the ExcelFile blob."] + #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_sas_key: Option, +} +impl ExportJobsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for feature object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequest { + #[serde(flatten)] + pub feature_validation_request_base: FeatureValidationRequestBase, + #[doc = "backup support feature type."] + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[doc = "backup support feature name."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, +} +impl FeatureValidationRequest { + pub fn new(feature_validation_request_base: FeatureValidationRequestBase) -> Self { + Self { + feature_validation_request_base, + feature_type: None, + feature_name: None, + } + } +} +pub mod feature_validation_request { + use super::*; + #[doc = "backup support feature type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[doc = "Base class for Backup Feature support"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequestBase { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl FeatureValidationRequestBase { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Feature Validation Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponse { + #[serde(flatten)] + pub feature_validation_response_base: FeatureValidationResponseBase, + #[doc = "backup support feature type."] + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[doc = "Response features"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, +} +impl FeatureValidationResponse { + pub fn new(feature_validation_response_base: FeatureValidationResponseBase) -> Self { + Self { + feature_validation_response_base, + feature_type: None, + features: Vec::new(), + } + } +} +pub mod feature_validation_response { + use super::*; + #[doc = "backup support feature type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[doc = "Base class for Backup Feature support"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponseBase { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl FeatureValidationResponseBase { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Immediate copy Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImmediateCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +impl ImmediateCopyOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { copy_option } + } +} +#[doc = "Inner Error"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InnerError { + #[doc = "Any Key value pairs that can be provided to the client for additional verbose information."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, + #[doc = "Unique code for this error"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Inner Error"] + #[serde(rename = "embeddedInnerError", default, skip_serializing_if = "Option::is_none")] + pub embedded_inner_error: Option, +} +impl InnerError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to contain criteria for item level restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreCriteria { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl ItemLevelRestoreCriteria { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Restore target info for Item level restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Restore Criteria"] + #[serde(rename = "restoreCriteria")] + pub restore_criteria: Vec, + #[doc = "Datasource to be backed up"] + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +impl ItemLevelRestoreTargetInfo { + pub fn new( + restore_target_info_base: RestoreTargetInfoBase, + restore_criteria: Vec, + datasource_info: Datasource, + ) -> Self { + Self { + restore_target_info_base, + restore_criteria, + datasource_info, + datasource_set_info: None, + datasource_auth_credentials: None, + } + } +} +#[doc = "Extended Information about the job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobExtendedInfo { + #[doc = "Job's Additional Details"] + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[doc = "State of the Backup Instance"] + #[serde(rename = "backupInstanceState", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_state: Option, + #[doc = "Number of bytes transferred"] + #[serde(rename = "dataTransferredInBytes", default, skip_serializing_if = "Option::is_none")] + pub data_transferred_in_bytes: Option, + #[doc = "Destination where restore is done"] + #[serde(rename = "recoveryDestination", default, skip_serializing_if = "Option::is_none")] + pub recovery_destination: Option, + #[serde(rename = "sourceRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub source_recover_point: Option, + #[doc = "List of Sub Tasks of the job"] + #[serde(rename = "subTasks", default, skip_serializing_if = "Vec::is_empty")] + pub sub_tasks: Vec, + #[serde(rename = "targetRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub target_recover_point: Option, +} +impl JobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of Job's Sub Task"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobSubTask { + #[doc = "Additional details of Sub Tasks"] + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[doc = "Task Id of the Sub Task"] + #[serde(rename = "taskId")] + pub task_id: i32, + #[doc = "Name of the Sub Task"] + #[serde(rename = "taskName")] + pub task_name: String, + #[doc = "Progress of the Sub Task"] + #[serde(rename = "taskProgress", default, skip_serializing_if = "Option::is_none")] + pub task_progress: Option, + #[doc = "Status of the Sub Task"] + #[serde(rename = "taskStatus")] + pub task_status: String, +} +impl JobSubTask { + pub fn new(task_id: i32, task_name: String, task_status: String) -> Self { + Self { + additional_details: None, + task_id, + task_name, + task_progress: None, + task_status, + } + } +} +#[doc = "Item Level kubernetes persistent volume target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesPvRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "Selected persistent volume claim name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Selected storage class name for restore operation"] + #[serde(rename = "storageClassName", default, skip_serializing_if = "Option::is_none")] + pub storage_class_name: Option, +} +impl KubernetesPvRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + name: None, + storage_class_name: None, + } + } +} +#[doc = "Item Level kubernetes storage class target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesStorageClassRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "Selected storage class name"] + #[serde(rename = "selectedStorageClassName", default, skip_serializing_if = "Option::is_none")] + pub selected_storage_class_name: Option, + #[doc = "Provisioner of the storage class"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provisioner: Option, +} +impl KubernetesStorageClassRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + selected_storage_class_name: None, + provisioner: None, + } + } +} +#[doc = "Operation Extended Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationExtendedInfo { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl OperationExtendedInfo { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Operation Job Extended Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationJobExtendedInfo { + #[serde(flatten)] + pub operation_extended_info: OperationExtendedInfo, + #[doc = "Arm Id of the job created for this operation."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +impl OperationJobExtendedInfo { + pub fn new(operation_extended_info: OperationExtendedInfo) -> Self { + Self { + operation_extended_info, + job_id: None, + } + } +} +#[doc = "Operation Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResource { + #[doc = "End time of the operation"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "It should match what is used to GET the operation result"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "It must match the last segment of the \"id\" field, and will typically be a GUID / system generated value"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation Extended Info"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Start time of the operation"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl OperationResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Patch Request content for Microsoft.DataProtection resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchResourceRequestInput { + #[doc = "Identity details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PatchResourceRequestInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy Info in backupInstance"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyInfo { + #[serde(rename = "policyId")] + pub policy_id: String, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[doc = "Parameters in Policy"] + #[serde(rename = "policyParameters", default, skip_serializing_if = "Option::is_none")] + pub policy_parameters: Option, +} +impl PolicyInfo { + pub fn new(policy_id: String) -> Self { + Self { + policy_id, + policy_version: None, + policy_parameters: None, + } + } +} +#[doc = "Parameters in Policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyParameters { + #[doc = "Gets or sets the DataStore Parameters"] + #[serde(rename = "dataStoreParametersList", default, skip_serializing_if = "Vec::is_empty")] + pub data_store_parameters_list: Vec, +} +impl PolicyParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection status details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionStatusDetails { + #[doc = "Error object used by layers that have access to localized content, and propagate that to user"] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Option::is_none")] + pub error_details: Option, + #[doc = "Specifies the protection status of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl ProtectionStatusDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod protection_status_details { + use super::*; + #[doc = "Specifies the protection status of the resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + ConfiguringProtection, + ConfiguringProtectionFailed, + ProtectionConfigured, + ProtectionStopped, + SoftDeleted, + SoftDeleting, + } +} +#[doc = "Item Level target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RangeBasedItemLevelRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "minimum value for range prefix match"] + #[serde(rename = "minMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub min_matching_value: Option, + #[doc = "maximum value for range prefix match"] + #[serde(rename = "maxMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub max_matching_value: Option, +} +impl RangeBasedItemLevelRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + min_matching_value: None, + max_matching_value: None, + } + } +} +#[doc = "RecoveryPoint datastore details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointDataStoreDetails { + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[serde(rename = "expiryTime", default, skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "metaData", default, skip_serializing_if = "Option::is_none")] + pub meta_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible: Option, + #[serde(rename = "rehydrationExpiryTime", default, skip_serializing_if = "Option::is_none")] + pub rehydration_expiry_time: Option, + #[serde(rename = "rehydrationStatus", default, skip_serializing_if = "Option::is_none")] + pub rehydration_status: Option, +} +impl RecoveryPointDataStoreDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod recovery_point_data_store_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RehydrationStatus { + #[serde(rename = "CREATE_IN_PROGRESS")] + CreateInProgress, + #[serde(rename = "COMPLETED")] + Completed, + #[serde(rename = "DELETE_IN_PROGRESS")] + DeleteInProgress, + #[serde(rename = "DELETED")] + Deleted, + #[serde(rename = "FAILED")] + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointsFilters { + #[serde(rename = "restorePointDataStoreId", default, skip_serializing_if = "Option::is_none")] + pub restore_point_data_store_id: Option, + #[serde(rename = "isVisible", default, skip_serializing_if = "Option::is_none")] + pub is_visible: Option, + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "restorePointState", default, skip_serializing_if = "Option::is_none")] + pub restore_point_state: Option, +} +impl RecoveryPointsFilters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Priority to be used for rehydration. Values High or Standard"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RehydrationPriority { + Invalid, + High, + Standard, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuard { + #[doc = "Provisioning state of the BackupVault resource"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "This flag indicates whether auto approval is allowed or not."] + #[serde(rename = "allowAutoApprovals", default, skip_serializing_if = "Option::is_none")] + pub allow_auto_approvals: Option, + #[doc = "{readonly} List of operation details those are protected by the ResourceGuard resource"] + #[serde(rename = "resourceGuardOperations", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operations: Vec, + #[doc = "List of critical operations which are not protected by this resourceGuard"] + #[serde(rename = "vaultCriticalOperationExclusionList", default, skip_serializing_if = "Vec::is_empty")] + pub vault_critical_operation_exclusion_list: Vec, + #[doc = "Description about the pre-req steps to perform all the critical operations."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ResourceGuard { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_guard { + use super::*; + #[doc = "Provisioning state of the BackupVault resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } +} +#[doc = "This class contains all the details about a critical operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardOperation { + #[doc = "Name of the critical operation."] + #[serde(rename = "vaultCriticalOperation", default, skip_serializing_if = "Option::is_none")] + pub vault_critical_operation: Option, + #[doc = "Type of resource request."] + #[serde(rename = "requestResourceType", default, skip_serializing_if = "Option::is_none")] + pub request_resource_type: Option, +} +impl ResourceGuardOperation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResourceGuardResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ResourceGuard resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardResourceList { + #[serde(flatten)] + pub dpp_tracked_resource_list: DppTrackedResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ResourceGuardResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ResourceMoveDetails will be returned in response to GetResource call from ARM"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceMoveDetails { + #[doc = "CorrelationId of latest ResourceMove operation attempted"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format."] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format."] + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[doc = "ARM resource path of source resource"] + #[serde(rename = "sourceResourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_resource_path: Option, + #[doc = "ARM resource path of target resource used in latest ResourceMove operation"] + #[serde(rename = "targetResourcePath", default, skip_serializing_if = "Option::is_none")] + pub target_resource_path: Option, +} +impl ResourceMoveDetails { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorableTimeRange { + #[doc = "Start time for the available restore range"] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "End time for the available restore range"] + #[serde(rename = "endTime")] + pub end_time: String, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +impl RestorableTimeRange { + pub fn new(start_time: String, end_time: String) -> Self { + Self { + start_time, + end_time, + object_type: None, + } + } +} +#[doc = "Class encapsulating restore as files target parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFilesTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Class encapsulating target details, used where the destination is not a datasource"] + #[serde(rename = "targetDetails")] + pub target_details: TargetDetails, +} +impl RestoreFilesTargetInfo { + pub fn new(restore_target_info_base: RestoreTargetInfoBase, target_details: TargetDetails) -> Self { + Self { + restore_target_info_base, + target_details, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestoreJobRecoveryPointDetails { + #[serde(rename = "recoveryPointID", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, +} +impl RestoreJobRecoveryPointDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class encapsulating restore target parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Datasource to be backed up"] + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +impl RestoreTargetInfo { + pub fn new(restore_target_info_base: RestoreTargetInfoBase, datasource_info: Datasource) -> Self { + Self { + restore_target_info_base, + datasource_info, + datasource_set_info: None, + datasource_auth_credentials: None, + } + } +} +#[doc = "Base class common to RestoreTargetInfo and RestoreFilesTargetInfo"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfoBase { + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "Recovery Option"] + #[serde(rename = "recoveryOption")] + pub recovery_option: restore_target_info_base::RecoveryOption, + #[doc = "Target Restore region"] + #[serde(rename = "restoreLocation", default, skip_serializing_if = "Option::is_none")] + pub restore_location: Option, +} +impl RestoreTargetInfoBase { + pub fn new(object_type: String, recovery_option: restore_target_info_base::RecoveryOption) -> Self { + Self { + object_type, + recovery_option, + restore_location: None, + } + } +} +pub mod restore_target_info_base { + use super::*; + #[doc = "Recovery Option"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryOption { + FailIfExists, + } +} +#[doc = "Retention tag"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionTag { + #[doc = "Retention Tag version."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Retention Tag version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Retention Tag Name to relate it to retention rule."] + #[serde(rename = "tagName")] + pub tag_name: String, +} +impl RetentionTag { + pub fn new(tag_name: String) -> Self { + Self { + e_tag: None, + id: None, + tag_name, + } + } +} +#[doc = "Schedule based backup criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedBackupCriteria { + #[serde(flatten)] + pub backup_criteria: BackupCriteria, + #[doc = "it contains absolute values like \"AllBackup\" / \"FirstOfDay\" / \"FirstOfWeek\" / \"FirstOfMonth\"\r\nand should be part of AbsoluteMarker enum"] + #[serde(rename = "absoluteCriteria", default, skip_serializing_if = "Vec::is_empty")] + pub absolute_criteria: Vec, + #[doc = "This is day of the month from 1 to 28 other wise last of month"] + #[serde(rename = "daysOfMonth", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_month: Vec, + #[doc = "It should be Sunday/Monday/T..../Saturday"] + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[doc = "It should be January/February/....../December"] + #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] + pub months_of_year: Vec, + #[doc = "List of schedule times for backup"] + #[serde(rename = "scheduleTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_times: Vec, + #[doc = "It should be First/Second/Third/Fourth/Last"] + #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_the_month: Vec, +} +impl ScheduleBasedBackupCriteria { + pub fn new(backup_criteria: BackupCriteria) -> Self { + Self { + backup_criteria, + absolute_criteria: Vec::new(), + days_of_month: Vec::new(), + days_of_the_week: Vec::new(), + months_of_year: Vec::new(), + schedule_times: Vec::new(), + weeks_of_the_month: Vec::new(), + } + } +} +#[doc = "Schedule based trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + #[doc = "Schedule for backup"] + pub schedule: BackupSchedule, + #[doc = "List of tags that can be applicable for given schedule."] + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: Vec, +} +impl ScheduleBasedTriggerContext { + pub fn new(trigger_context: TriggerContext, schedule: BackupSchedule, tagging_criteria: Vec) -> Self { + Self { + trigger_context, + schedule, + tagging_criteria, + } + } +} +#[doc = "Secret store based authentication credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreBasedAuthCredentials { + #[serde(flatten)] + pub auth_credentials: AuthCredentials, + #[doc = "Class representing a secret store resource."] + #[serde(rename = "secretStoreResource", default, skip_serializing_if = "Option::is_none")] + pub secret_store_resource: Option, +} +impl SecretStoreBasedAuthCredentials { + pub fn new(auth_credentials: AuthCredentials) -> Self { + Self { + auth_credentials, + secret_store_resource: None, + } + } +} +#[doc = "Class representing a secret store resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreResource { + #[doc = "Uri to get to the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[doc = "Gets or sets the type of secret store"] + #[serde(rename = "secretStoreType")] + pub secret_store_type: secret_store_resource::SecretStoreType, + #[doc = "Gets or sets value stored in secret store resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SecretStoreResource { + pub fn new(secret_store_type: secret_store_resource::SecretStoreType) -> Self { + Self { + uri: None, + secret_store_type, + value: None, + } + } +} +pub mod secret_store_resource { + use super::*; + #[doc = "Gets or sets the type of secret store"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SecretStoreType { + Invalid, + AzureKeyVault, + } +} +#[doc = "Source LifeCycle"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceLifeCycle { + #[doc = "Delete Option"] + #[serde(rename = "deleteAfter")] + pub delete_after: DeleteOption, + #[doc = "DataStoreInfo base"] + #[serde(rename = "sourceDataStore")] + pub source_data_store: DataStoreInfoBase, + #[serde(rename = "targetDataStoreCopySettings", default, skip_serializing_if = "Vec::is_empty")] + pub target_data_store_copy_settings: Vec, +} +impl SourceLifeCycle { + pub fn new(delete_after: DeleteOption, source_data_store: DataStoreInfoBase) -> Self { + Self { + delete_after, + source_data_store, + target_data_store_copy_settings: Vec::new(), + } + } +} +#[doc = "Storage setting"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageSetting { + #[doc = "Gets or sets the type of the datastore."] + #[serde(rename = "datastoreType", default, skip_serializing_if = "Option::is_none")] + pub datastore_type: Option, + #[doc = "Gets or sets the type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl StorageSetting { + pub fn new() -> Self { + Self::default() + } +} +pub mod storage_setting { + use super::*; + #[doc = "Gets or sets the type of the datastore."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DatastoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } + #[doc = "Gets or sets the type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + GeoRedundant, + LocallyRedundant, + } +} +#[doc = "Elements class for feature request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedFeature { + #[doc = "support feature type."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, + #[doc = "feature support status"] + #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] + pub support_status: Option, + #[doc = "support feature type."] + #[serde(rename = "exposureControlledFeatures", default, skip_serializing_if = "Vec::is_empty")] + pub exposure_controlled_features: Vec, +} +impl SupportedFeature { + pub fn new() -> Self { + Self::default() + } +} +pub mod supported_feature { + use super::*; + #[doc = "feature support status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportStatus { + Invalid, + NotSupported, + AlphaPreview, + PrivatePreview, + PublicPreview, + GenerallyAvailable, + } +} +#[doc = "Sync BackupInstance Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SyncBackupInstanceRequest { + #[doc = "Field indicating sync type e.g. to sync only in case of failure or in all cases"] + #[serde(rename = "syncType", default, skip_serializing_if = "Option::is_none")] + pub sync_type: Option, +} +impl SyncBackupInstanceRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod sync_backup_instance_request { + use super::*; + #[doc = "Field indicating sync type e.g. to sync only in case of failure or in all cases"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SyncType { + Default, + ForceResync, + } +} +#[doc = "Tagging criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaggingCriteria { + #[doc = "Criteria which decides whether the tag can be applied to a triggered backup."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub criteria: Vec, + #[doc = "Specifies if tag is default."] + #[serde(rename = "isDefault")] + pub is_default: bool, + #[doc = "Retention Tag priority."] + #[serde(rename = "taggingPriority")] + pub tagging_priority: i64, + #[doc = "Retention tag"] + #[serde(rename = "tagInfo")] + pub tag_info: RetentionTag, +} +impl TaggingCriteria { + pub fn new(is_default: bool, tagging_priority: i64, tag_info: RetentionTag) -> Self { + Self { + criteria: Vec::new(), + is_default, + tagging_priority, + tag_info, + } + } +} +#[doc = "Target copy settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetCopySetting { + #[doc = "Options to copy"] + #[serde(rename = "copyAfter")] + pub copy_after: CopyOption, + #[doc = "DataStoreInfo base"] + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, +} +impl TargetCopySetting { + pub fn new(copy_after: CopyOption, data_store: DataStoreInfoBase) -> Self { + Self { copy_after, data_store } + } +} +#[doc = "Class encapsulating target details, used where the destination is not a datasource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetDetails { + #[doc = "Restore operation may create multiple files inside location pointed by Url\r\nBelow will be the common prefix for all of them"] + #[serde(rename = "filePrefix")] + pub file_prefix: String, + #[doc = "Denotes the target location where the data will be restored,\r\nstring value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}"] + #[serde(rename = "restoreTargetLocationType")] + pub restore_target_location_type: target_details::RestoreTargetLocationType, + #[doc = "Url denoting the restore destination. It can point to container / file share etc"] + pub url: String, +} +impl TargetDetails { + pub fn new(file_prefix: String, restore_target_location_type: target_details::RestoreTargetLocationType, url: String) -> Self { + Self { + file_prefix, + restore_target_location_type, + url, + } + } +} +pub mod target_details { + use super::*; + #[doc = "Denotes the target location where the data will be restored,\r\nstring value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreTargetLocationType { + Invalid, + AzureBlobs, + AzureFiles, + } +} +#[doc = "Trigger backup request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerBackupRequest { + #[doc = "Adhoc backup rules"] + #[serde(rename = "backupRuleOptions")] + pub backup_rule_options: AdHocBackupRuleOptions, +} +impl TriggerBackupRequest { + pub fn new(backup_rule_options: AdHocBackupRuleOptions) -> Self { + Self { backup_rule_options } + } +} +#[doc = "Trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerContext { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl TriggerContext { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Error object used by layers that have access to localized content, and propagate that to user"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserFacingError { + #[doc = "Unique code for this error"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Additional related Errors"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "Inner Error"] + #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")] + pub inner_error: Option, + #[doc = "Whether the operation will be retryable or not"] + #[serde(rename = "isRetryable", default, skip_serializing_if = "Option::is_none")] + pub is_retryable: Option, + #[doc = "Whether the operation is due to a user error or service error"] + #[serde(rename = "isUserError", default, skip_serializing_if = "Option::is_none")] + pub is_user_error: Option, + #[doc = "Any key value pairs that can be injected inside error object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "RecommendedAction � localized."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Vec::is_empty")] + pub recommended_action: Vec, + #[doc = "Target of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl UserFacingError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Validate for backup request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateForBackupRequest { + #[doc = "Backup Instance"] + #[serde(rename = "backupInstance")] + pub backup_instance: BackupInstance, +} +impl ValidateForBackupRequest { + pub fn new(backup_instance: BackupInstance) -> Self { + Self { backup_instance } + } +} +#[doc = "Validate restore request object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateRestoreRequestObject { + #[doc = "Azure backup restore request"] + #[serde(rename = "restoreRequestObject")] + pub restore_request_object: AzureBackupRestoreRequest, +} +impl ValidateRestoreRequestObject { + pub fn new(restore_request_object: AzureBackupRestoreRequest) -> Self { + Self { restore_request_object } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/dataprotection/src/package_2022_03/operations.rs b/services/mgmt/dataprotection/src/package_2022_03/operations.rs new file mode 100644 index 0000000000..5469c4fa7b --- /dev/null +++ b/services/mgmt/dataprotection/src/package_2022_03/operations.rs @@ -0,0 +1,5703 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn backup_instances(&self) -> backup_instances::Client { + backup_instances::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backup_vault_operation_results(&self) -> backup_vault_operation_results::Client { + backup_vault_operation_results::Client(self.clone()) + } + pub fn backup_vaults(&self) -> backup_vaults::Client { + backup_vaults::Client(self.clone()) + } + pub fn data_protection(&self) -> data_protection::Client { + data_protection::Client(self.clone()) + } + pub fn data_protection_operations(&self) -> data_protection_operations::Client { + data_protection_operations::Client(self.clone()) + } + pub fn export_jobs(&self) -> export_jobs::Client { + export_jobs::Client(self.clone()) + } + pub fn export_jobs_operation_result(&self) -> export_jobs_operation_result::Client { + export_jobs_operation_result::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operation_result(&self) -> operation_result::Client { + operation_result::Client(self.clone()) + } + pub fn operation_status(&self) -> operation_status::Client { + operation_status::Client(self.clone()) + } + pub fn operation_status_backup_vault_context(&self) -> operation_status_backup_vault_context::Client { + operation_status_backup_vault_context::Client(self.clone()) + } + pub fn operation_status_resource_group_context(&self) -> operation_status_resource_group_context::Client { + operation_status_resource_group_context::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn resource_guards(&self) -> resource_guards::Client { + resource_guards::Client(self.clone()) + } + pub fn restorable_time_ranges(&self) -> restorable_time_ranges::Client { + restorable_time_ranges::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupVaults_GetInSubscription(#[from] backup_vaults::get_in_subscription::Error), + #[error(transparent)] + OperationResult_Get(#[from] operation_result::get::Error), + #[error(transparent)] + OperationStatus_Get(#[from] operation_status::get::Error), + #[error(transparent)] + OperationStatusBackupVaultContext_Get(#[from] operation_status_backup_vault_context::get::Error), + #[error(transparent)] + OperationStatusResourceGroupContext_Get(#[from] operation_status_resource_group_context::get::Error), + #[error(transparent)] + BackupVaults_GetInResourceGroup(#[from] backup_vaults::get_in_resource_group::Error), + #[error(transparent)] + BackupVaults_Get(#[from] backup_vaults::get::Error), + #[error(transparent)] + BackupVaults_CreateOrUpdate(#[from] backup_vaults::create_or_update::Error), + #[error(transparent)] + BackupVaults_Update(#[from] backup_vaults::update::Error), + #[error(transparent)] + BackupVaults_Delete(#[from] backup_vaults::delete::Error), + #[error(transparent)] + BackupVaultOperationResults_Get(#[from] backup_vault_operation_results::get::Error), + #[error(transparent)] + BackupVaults_CheckNameAvailability(#[from] backup_vaults::check_name_availability::Error), + #[error(transparent)] + DataProtection_CheckFeatureSupport(#[from] data_protection::check_feature_support::Error), + #[error(transparent)] + DataProtectionOperations_List(#[from] data_protection_operations::list::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + BackupPolicies_Get(#[from] backup_policies::get::Error), + #[error(transparent)] + BackupPolicies_CreateOrUpdate(#[from] backup_policies::create_or_update::Error), + #[error(transparent)] + BackupPolicies_Delete(#[from] backup_policies::delete::Error), + #[error(transparent)] + BackupInstances_List(#[from] backup_instances::list::Error), + #[error(transparent)] + BackupInstances_Get(#[from] backup_instances::get::Error), + #[error(transparent)] + BackupInstances_CreateOrUpdate(#[from] backup_instances::create_or_update::Error), + #[error(transparent)] + BackupInstances_Delete(#[from] backup_instances::delete::Error), + #[error(transparent)] + BackupInstances_AdhocBackup(#[from] backup_instances::adhoc_backup::Error), + #[error(transparent)] + BackupInstances_ValidateForBackup(#[from] backup_instances::validate_for_backup::Error), + #[error(transparent)] + BackupInstances_GetBackupInstanceOperationResult(#[from] backup_instances::get_backup_instance_operation_result::Error), + #[error(transparent)] + RecoveryPoints_List(#[from] recovery_points::list::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + BackupInstances_TriggerRehydrate(#[from] backup_instances::trigger_rehydrate::Error), + #[error(transparent)] + BackupInstances_TriggerRestore(#[from] backup_instances::trigger_restore::Error), + #[error(transparent)] + BackupInstances_ResumeBackups(#[from] backup_instances::resume_backups::Error), + #[error(transparent)] + BackupInstances_ResumeProtection(#[from] backup_instances::resume_protection::Error), + #[error(transparent)] + BackupInstances_StopProtection(#[from] backup_instances::stop_protection::Error), + #[error(transparent)] + BackupInstances_SuspendBackups(#[from] backup_instances::suspend_backups::Error), + #[error(transparent)] + BackupInstances_SyncBackupInstance(#[from] backup_instances::sync_backup_instance::Error), + #[error(transparent)] + BackupInstances_ValidateForRestore(#[from] backup_instances::validate_for_restore::Error), + #[error(transparent)] + Jobs_List(#[from] jobs::list::Error), + #[error(transparent)] + RestorableTimeRanges_Find(#[from] restorable_time_ranges::find::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + ExportJobs_Trigger(#[from] export_jobs::trigger::Error), + #[error(transparent)] + ExportJobsOperationResult_Get(#[from] export_jobs_operation_result::get::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInSubscription(#[from] resource_guards::get_resources_in_subscription::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInResourceGroup(#[from] resource_guards::get_resources_in_resource_group::Error), + #[error(transparent)] + ResourceGuards_Get(#[from] resource_guards::get::Error), + #[error(transparent)] + ResourceGuards_Put(#[from] resource_guards::put::Error), + #[error(transparent)] + ResourceGuards_Patch(#[from] resource_guards::patch::Error), + #[error(transparent)] + ResourceGuards_Delete(#[from] resource_guards::delete::Error), + #[error(transparent)] + ResourceGuards_GetDisableSoftDeleteRequestsObjects(#[from] resource_guards::get_disable_soft_delete_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteResourceGuardProxyRequestsObjects( + #[from] resource_guards::get_delete_resource_guard_proxy_requests_objects::Error, + ), + #[error(transparent)] + ResourceGuards_GetBackupSecurityPinRequestsObjects(#[from] resource_guards::get_backup_security_pin_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteProtectedItemRequestsObjects(#[from] resource_guards::get_delete_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectionPolicyRequestsObjects(#[from] resource_guards::get_update_protection_policy_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectedItemRequestsObjects(#[from] resource_guards::get_update_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDefaultDisableSoftDeleteRequestsObject( + #[from] resource_guards::get_default_disable_soft_delete_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteResourceGuardProxyRequestsObject( + #[from] resource_guards::get_default_delete_resource_guard_proxy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultBackupSecurityPinRequestsObject( + #[from] resource_guards::get_default_backup_security_pin_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteProtectedItemRequestsObject( + #[from] resource_guards::get_default_delete_protected_item_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectionPolicyRequestsObject( + #[from] resource_guards::get_default_update_protection_policy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectedItemRequestsObject( + #[from] resource_guards::get_default_update_protected_item_requests_object::Error, + ), +} +pub mod backup_vaults { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_in_subscription(&self, subscription_id: impl Into) -> get_in_subscription::Builder { + get_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_in_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get_in_resource_group::Builder { + get_in_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "API to check for resource name availability"] + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod get_in_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_in_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Created201(models::BackupVaultResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::BackupVaultResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + operation_id: impl Into, + location: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + location: location.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationJobExtendedInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status_backup_vault_context { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for an operation over a BackupVault's context."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status_resource_group_context { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for an operation over a ResourceGroup's context."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_vault_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Validates if a feature is supported"] + pub fn check_feature_support( + &self, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_feature_support::Builder { + check_feature_support::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod check_feature_support { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::FeatureValidationRequestBase, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/checkFeatureSupport", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FeatureValidationResponseBase = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection_operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DataProtection/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "Gets a backup policy belonging to a backup vault"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + #[doc = "Creates or Updates a backup policy belonging to a backup vault"] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a backup policy belonging to a backup vault"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + pub(crate) parameters: models::BaseBackupPolicyResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_instances { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn adhoc_backup( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> adhoc_backup::Builder { + adhoc_backup::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_backup( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> validate_for_backup::Builder { + validate_for_backup::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn get_backup_instance_operation_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + operation_id: impl Into, + ) -> get_backup_instance_operation_result::Builder { + get_backup_instance_operation_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + operation_id: operation_id.into(), + } + } + pub fn trigger_rehydrate( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_name: impl Into, + parameters: impl Into, + backup_instance_name: impl Into, + ) -> trigger_rehydrate::Builder { + trigger_rehydrate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn trigger_restore( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> trigger_restore::Builder { + trigger_restore::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn resume_backups( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> resume_backups::Builder { + resume_backups::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn resume_protection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> resume_protection::Builder { + resume_protection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn stop_protection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> stop_protection::Builder { + stop_protection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn suspend_backups( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> suspend_backups::Builder { + suspend_backups::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn sync_backup_instance( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> sync_backup_instance::Builder { + sync_backup_instance::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_restore( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> validate_for_restore::Builder { + validate_for_restore::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInstanceResource), + Created201(models::BackupInstanceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::BackupInstanceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod adhoc_backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::TriggerBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::ValidateForBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/validateForBackup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup_instance_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInstanceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_rehydrate { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::AzureBackupRehydrationRequest, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/rehydrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupRestoreRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume_backups { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/resumeBackups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume_protection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/resumeProtection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_protection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/stopProtection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod suspend_backups { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/suspendBackups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod sync_backup_instance { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::SyncBackupInstanceRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/sync", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::ValidateRestoreRequestObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/validateRestore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + filter: None, + skip_token: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + recovery_point_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + job_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + job_id: job_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_time_ranges { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn find( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> find::Builder { + find::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod find { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupFindRestorableTimeRangesRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/findRestorableTimeRanges" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupFindRestorableTimeRangesResponseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/exportBackupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs_operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExportJobsResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportJobsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guards { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns ResourceGuards collection belonging to a subscription."] + pub fn get_resources_in_subscription(&self, subscription_id: impl Into) -> get_resources_in_subscription::Builder { + get_resources_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Returns ResourceGuards collection belonging to a ResourceGroup."] + pub fn get_resources_in_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_resources_in_resource_group::Builder { + get_resources_in_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Returns a ResourceGuard belonging to a resource group."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Creates or updates a ResourceGuard resource belonging to a resource group."] + pub fn put( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource."] + pub fn patch( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a ResourceGuard resource from the resource group."] + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_disable_soft_delete_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_disable_soft_delete_requests_objects::Builder { + get_disable_soft_delete_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_resource_guard_proxy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_resource_guard_proxy_requests_objects::Builder { + get_delete_resource_guard_proxy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_backup_security_pin_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_backup_security_pin_requests_objects::Builder { + get_backup_security_pin_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_protected_item_requests_objects::Builder { + get_delete_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protection_policy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protection_policy_requests_objects::Builder { + get_update_protection_policy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protected_item_requests_objects::Builder { + get_update_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_disable_soft_delete_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_disable_soft_delete_requests_object::Builder { + get_default_disable_soft_delete_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_resource_guard_proxy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_resource_guard_proxy_requests_object::Builder { + get_default_delete_resource_guard_proxy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_backup_security_pin_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_backup_security_pin_requests_object::Builder { + get_default_backup_security_pin_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_protected_item_requests_object::Builder { + get_default_delete_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protection_policy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protection_policy_requests_object::Builder { + get_default_update_protection_policy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protected_item_requests_object::Builder { + get_default_update_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + } + pub mod get_resources_in_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_resources_in_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::ResourceGuardResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_disable_soft_delete_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_resource_guard_proxy_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup_security_pin_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_protected_item_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protection_policy_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protected_item_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_disable_soft_delete_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_resource_guard_proxy_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_backup_security_pin_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_protected_item_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protection_policy_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protected_item_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/dataprotection/src/package_preview_2022_03/mod.rs b/services/mgmt/dataprotection/src/package_preview_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_preview_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/dataprotection/src/package_preview_2022_03/models.rs b/services/mgmt/dataprotection/src/package_preview_2022_03/models.rs new file mode 100644 index 0000000000..1c2d588cf0 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_preview_2022_03/models.rs @@ -0,0 +1,2647 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Delete option with duration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AbsoluteDeleteOption { + #[serde(flatten)] + pub delete_option: DeleteOption, +} +impl AbsoluteDeleteOption { + pub fn new(delete_option: DeleteOption) -> Self { + Self { delete_option } + } +} +#[doc = "Adhoc backup rules"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdHocBackupRuleOptions { + #[serde(rename = "ruleName")] + pub rule_name: String, + #[doc = "Adhoc backup trigger option"] + #[serde(rename = "triggerOption")] + pub trigger_option: AdhocBackupTriggerOption, +} +impl AdHocBackupRuleOptions { + pub fn new(rule_name: String, trigger_option: AdhocBackupTriggerOption) -> Self { + Self { rule_name, trigger_option } + } +} +#[doc = "Adhoc backup trigger option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdhocBackupTriggerOption { + #[serde(rename = "retentionTagOverride", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_override: Option, +} +impl AdhocBackupTriggerOption { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Adhoc backup tagging criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdhocBasedTaggingCriteria { + #[doc = "Retention tag"] + #[serde(rename = "tagInfo", default, skip_serializing_if = "Option::is_none")] + pub tag_info: Option, +} +impl AdhocBasedTaggingCriteria { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Adhoc trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdhocBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + #[doc = "Adhoc backup tagging criteria"] + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: AdhocBasedTaggingCriteria, +} +impl AdhocBasedTriggerContext { + pub fn new(trigger_context: TriggerContext, tagging_criteria: AdhocBasedTaggingCriteria) -> Self { + Self { + trigger_context, + tagging_criteria, + } + } +} +#[doc = "Base class for different types of authentication credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthCredentials { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl AuthCredentials { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoHealSettings { + #[serde(rename = "autoHealStatus", default, skip_serializing_if = "Option::is_none")] + pub auto_heal_status: Option, +} +impl AutoHealSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod auto_heal_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoHealStatus { + Off, + On, + } +} +#[doc = "Azure backup discrete RecoveryPoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupDiscreteRecoveryPoint { + #[serde(flatten)] + pub azure_backup_recovery_point: AzureBackupRecoveryPoint, + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[serde(rename = "recoveryPointDataStoresDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_data_stores_details: Vec, + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[serde(rename = "retentionTagName", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_name: Option, + #[serde(rename = "retentionTagVersion", default, skip_serializing_if = "Option::is_none")] + pub retention_tag_version: Option, +} +impl AzureBackupDiscreteRecoveryPoint { + pub fn new(azure_backup_recovery_point: AzureBackupRecoveryPoint, recovery_point_time: String) -> Self { + Self { + azure_backup_recovery_point, + friendly_name: None, + recovery_point_data_stores_details: Vec::new(), + recovery_point_time, + policy_name: None, + policy_version: None, + recovery_point_id: None, + recovery_point_type: None, + retention_tag_name: None, + retention_tag_version: None, + } + } +} +#[doc = "List Restore Ranges Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupFindRestorableTimeRangesRequest { + #[doc = "Gets or sets the type of the source data store."] + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_find_restorable_time_ranges_request::SourceDataStoreType, + #[doc = "Start time for the List Restore Ranges request. ISO 8601 format."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "End time for the List Restore Ranges request. ISO 8601 format."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +impl AzureBackupFindRestorableTimeRangesRequest { + pub fn new(source_data_store_type: azure_backup_find_restorable_time_ranges_request::SourceDataStoreType) -> Self { + Self { + source_data_store_type, + start_time: None, + end_time: None, + } + } +} +pub mod azure_backup_find_restorable_time_ranges_request { + use super::*; + #[doc = "Gets or sets the type of the source data store."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "List Restore Ranges Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesRequestResource { + #[serde(flatten)] + pub dpp_worker_request: DppWorkerRequest, + #[doc = "List Restore Ranges Request"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +impl AzureBackupFindRestorableTimeRangesRequestResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List Restore Ranges Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesResponse { + #[doc = "Returns the Restore Ranges available on the Backup Instance."] + #[serde(rename = "restorableTimeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub restorable_time_ranges: Vec, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +impl AzureBackupFindRestorableTimeRangesResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List Restore Ranges Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupFindRestorableTimeRangesResponseResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "List Restore Ranges Response"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupFindRestorableTimeRangesResponseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureBackup Job Class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupJob { + #[doc = "Job Activity Id"] + #[serde(rename = "activityID")] + pub activity_id: String, + #[doc = "Name of the Backup Instance"] + #[serde(rename = "backupInstanceFriendlyName")] + pub backup_instance_friendly_name: String, + #[doc = "ARM ID of the Backup Instance"] + #[serde(rename = "backupInstanceId", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_id: Option, + #[doc = "ARM ID of the DataSource"] + #[serde(rename = "dataSourceId")] + pub data_source_id: String, + #[doc = "Location of the DataSource"] + #[serde(rename = "dataSourceLocation")] + pub data_source_location: String, + #[doc = "User Friendly Name of the DataSource"] + #[serde(rename = "dataSourceName")] + pub data_source_name: String, + #[doc = "Data Source Set Name of the DataSource"] + #[serde(rename = "dataSourceSetName", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_name: Option, + #[doc = "Type of DataSource"] + #[serde(rename = "dataSourceType")] + pub data_source_type: String, + #[doc = "Total run time of the job. ISO 8601 format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "EndTime of the job(in UTC)"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "A List, detailing the errors related to the job"] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Extended Information about the job"] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Indicated that whether the job is adhoc(true) or scheduled(false)"] + #[serde(rename = "isUserTriggered")] + pub is_user_triggered: bool, + #[doc = "It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure"] + pub operation: String, + #[doc = "It indicates the type of Job i.e. Backup/Restore/Tiering/Management"] + #[serde(rename = "operationCategory")] + pub operation_category: String, + #[doc = "ARM ID of the policy"] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Name of the policy"] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Indicated whether progress is enabled for the job"] + #[serde(rename = "progressEnabled")] + pub progress_enabled: bool, + #[doc = "Url which contains job's progress"] + #[serde(rename = "progressUrl", default, skip_serializing_if = "Option::is_none")] + pub progress_url: Option, + #[doc = "It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR"] + #[serde(rename = "restoreType", default, skip_serializing_if = "Option::is_none")] + pub restore_type: Option, + #[doc = "Resource Group Name of the Datasource"] + #[serde(rename = "sourceResourceGroup")] + pub source_resource_group: String, + #[doc = "SubscriptionId corresponding to the DataSource"] + #[serde(rename = "sourceSubscriptionID")] + pub source_subscription_id: String, + #[doc = "StartTime of the job(in UTC)"] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning"] + pub status: String, + #[doc = "Subscription Id of the corresponding backup vault"] + #[serde(rename = "subscriptionId")] + pub subscription_id: String, + #[doc = "List of supported actions"] + #[serde(rename = "supportedActions")] + pub supported_actions: Vec, + #[doc = "Name of the vault"] + #[serde(rename = "vaultName")] + pub vault_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(rename = "sourceDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub source_data_store_name: Option, + #[serde(rename = "destinationDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub destination_data_store_name: Option, +} +impl AzureBackupJob { + pub fn new( + activity_id: String, + backup_instance_friendly_name: String, + data_source_id: String, + data_source_location: String, + data_source_name: String, + data_source_type: String, + is_user_triggered: bool, + operation: String, + operation_category: String, + progress_enabled: bool, + source_resource_group: String, + source_subscription_id: String, + start_time: String, + status: String, + subscription_id: String, + supported_actions: Vec, + vault_name: String, + ) -> Self { + Self { + activity_id, + backup_instance_friendly_name, + backup_instance_id: None, + data_source_id, + data_source_location, + data_source_name, + data_source_set_name: None, + data_source_type, + duration: None, + end_time: None, + error_details: Vec::new(), + extended_info: None, + is_user_triggered, + operation, + operation_category, + policy_id: None, + policy_name: None, + progress_enabled, + progress_url: None, + restore_type: None, + source_resource_group, + source_subscription_id, + start_time, + status, + subscription_id, + supported_actions, + vault_name, + etag: None, + source_data_store_name: None, + destination_data_store_name: None, + } + } +} +#[doc = "AzureBackup Job Resource Class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupJobResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "AzureBackup Job Class"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupJobResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of AzureBackup Job resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupJobResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AzureBackupJobResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure backup parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupParams { + #[serde(flatten)] + pub backup_parameters: BackupParameters, + #[doc = "BackupType ; Full/Incremental etc"] + #[serde(rename = "backupType")] + pub backup_type: String, +} +impl AzureBackupParams { + pub fn new(backup_parameters: BackupParameters, backup_type: String) -> Self { + Self { + backup_parameters, + backup_type, + } + } +} +#[doc = "Azure backup recoveryPoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPoint { + #[serde(rename = "objectType")] + pub object_type: String, +} +impl AzureBackupRecoveryPoint { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Azure backup recoveryPoint based restore request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryPointBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, +} +impl AzureBackupRecoveryPointBasedRestoreRequest { + pub fn new(azure_backup_restore_request: AzureBackupRestoreRequest, recovery_point_id: String) -> Self { + Self { + azure_backup_restore_request, + recovery_point_id, + } + } +} +#[doc = "Azure backup recoveryPoint resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupRecoveryPointResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "Azure backup recoveryPoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureBackupRecoveryPointResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure backup recoveryPoint resource list"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBackupRecoveryPointResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AzureBackupRecoveryPointResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureBackup RecoveryPointTime Based Restore Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRecoveryTimeBasedRestoreRequest { + #[serde(flatten)] + pub azure_backup_restore_request: AzureBackupRestoreRequest, + #[doc = "The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z."] + #[serde(rename = "recoveryPointTime")] + pub recovery_point_time: String, +} +impl AzureBackupRecoveryTimeBasedRestoreRequest { + pub fn new(azure_backup_restore_request: AzureBackupRestoreRequest, recovery_point_time: String) -> Self { + Self { + azure_backup_restore_request, + recovery_point_time, + } + } +} +#[doc = "Azure Backup Rehydrate Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRehydrationRequest { + #[doc = "Id of the recovery point to be recovered"] + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, + #[doc = "Priority to be used for rehydration. Values High or Standard"] + #[serde(rename = "rehydrationPriority", default, skip_serializing_if = "Option::is_none")] + pub rehydration_priority: Option, + #[doc = "Retention duration in ISO 8601 format i.e P10D ."] + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +impl AzureBackupRehydrationRequest { + pub fn new(recovery_point_id: String, rehydration_retention_duration: String) -> Self { + Self { + recovery_point_id, + rehydration_priority: None, + rehydration_retention_duration, + } + } +} +#[doc = "Azure backup restore request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreRequest { + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "Base class common to RestoreTargetInfo and RestoreFilesTargetInfo"] + #[serde(rename = "restoreTargetInfo")] + pub restore_target_info: RestoreTargetInfoBase, + #[doc = "Gets or sets the type of the source data store."] + #[serde(rename = "sourceDataStoreType")] + pub source_data_store_type: azure_backup_restore_request::SourceDataStoreType, + #[doc = "Fully qualified Azure Resource Manager ID of the datasource which is being recovered."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +impl AzureBackupRestoreRequest { + pub fn new( + object_type: String, + restore_target_info: RestoreTargetInfoBase, + source_data_store_type: azure_backup_restore_request::SourceDataStoreType, + ) -> Self { + Self { + object_type, + restore_target_info, + source_data_store_type, + source_resource_id: None, + } + } +} +pub mod azure_backup_restore_request { + use super::*; + #[doc = "Gets or sets the type of the source data store."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceDataStoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } +} +#[doc = "AzureBackup Restore with Rehydration Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRestoreWithRehydrationRequest { + #[serde(flatten)] + pub azure_backup_recovery_point_based_restore_request: AzureBackupRecoveryPointBasedRestoreRequest, + #[doc = "Priority to be used for rehydration. Values High or Standard"] + #[serde(rename = "rehydrationPriority")] + pub rehydration_priority: RehydrationPriority, + #[doc = "Retention duration in ISO 8601 format i.e P10D ."] + #[serde(rename = "rehydrationRetentionDuration")] + pub rehydration_retention_duration: String, +} +impl AzureBackupRestoreWithRehydrationRequest { + pub fn new( + azure_backup_recovery_point_based_restore_request: AzureBackupRecoveryPointBasedRestoreRequest, + rehydration_priority: RehydrationPriority, + rehydration_retention_duration: String, + ) -> Self { + Self { + azure_backup_recovery_point_based_restore_request, + rehydration_priority, + rehydration_retention_duration, + } + } +} +#[doc = "Azure backup rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[doc = "BackupParameters base"] + #[serde(rename = "backupParameters", default, skip_serializing_if = "Option::is_none")] + pub backup_parameters: Option, + #[doc = "DataStoreInfo base"] + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, + #[doc = "Trigger context"] + pub trigger: TriggerContext, +} +impl AzureBackupRule { + pub fn new(base_policy_rule: BasePolicyRule, data_store: DataStoreInfoBase, trigger: TriggerContext) -> Self { + Self { + base_policy_rule, + backup_parameters: None, + data_store, + trigger, + } + } +} +#[doc = "Settings for Azure Monitor based alerts"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMonitorAlertSettings { + #[serde(rename = "alertsForAllJobFailures", default, skip_serializing_if = "Option::is_none")] + pub alerts_for_all_job_failures: Option, +} +impl AzureMonitorAlertSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod azure_monitor_alert_settings { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AlertsForAllJobFailures { + Enabled, + Disabled, + } +} +#[doc = "Parameters for Operational-Tier DataStore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureOperationalStoreParameters { + #[serde(flatten)] + pub data_store_parameters: DataStoreParameters, + #[doc = "Gets or sets the Snapshot Resource Group Uri."] + #[serde(rename = "resourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub resource_group_id: Option, +} +impl AzureOperationalStoreParameters { + pub fn new(data_store_parameters: DataStoreParameters) -> Self { + Self { + data_store_parameters, + resource_group_id: None, + } + } +} +#[doc = "Azure retention rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureRetentionRule { + #[serde(flatten)] + pub base_policy_rule: BasePolicyRule, + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + pub lifecycles: Vec, +} +impl AzureRetentionRule { + pub fn new(base_policy_rule: BasePolicyRule, lifecycles: Vec) -> Self { + Self { + base_policy_rule, + is_default: None, + lifecycles, + } + } +} +#[doc = "BackupCriteria base class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupCriteria { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupCriteria { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Backup Instance"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupInstance { + #[doc = "Gets or sets the Backup Instance friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Datasource to be backed up"] + #[serde(rename = "dataSourceInfo")] + pub data_source_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "dataSourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub data_source_set_info: Option, + #[doc = "Policy Info in backupInstance"] + #[serde(rename = "policyInfo")] + pub policy_info: PolicyInfo, + #[doc = "Protection status details"] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Specifies the current protection state of the resource"] + #[serde(rename = "currentProtectionState", default, skip_serializing_if = "Option::is_none")] + pub current_protection_state: Option, + #[doc = "Error object used by layers that have access to localized content, and propagate that to user"] + #[serde(rename = "protectionErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub protection_error_details: Option, + #[doc = "Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, + #[doc = "Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again."] + #[serde(rename = "validationType", default, skip_serializing_if = "Option::is_none")] + pub validation_type: Option, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupInstance { + pub fn new(data_source_info: Datasource, policy_info: PolicyInfo, object_type: String) -> Self { + Self { + friendly_name: None, + data_source_info, + data_source_set_info: None, + policy_info, + protection_status: None, + current_protection_state: None, + protection_error_details: None, + provisioning_state: None, + datasource_auth_credentials: None, + validation_type: None, + object_type, + } + } +} +pub mod backup_instance { + use super::*; + #[doc = "Specifies the current protection state of the resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentProtectionState { + Invalid, + NotProtected, + ConfiguringProtection, + ProtectionConfigured, + BackupSchedulesSuspended, + RetentionSchedulesSuspended, + ProtectionStopped, + ProtectionError, + ConfiguringProtectionFailed, + SoftDeleting, + SoftDeleted, + UpdatingProtection, + } + #[doc = "Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ValidationType { + ShallowValidation, + DeepValidation, + } +} +#[doc = "BackupInstance Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupInstanceResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "Backup Instance"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupInstanceResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupInstance Resource list response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupInstanceResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupInstanceResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupParameters base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupParameters { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupParameters { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Rule based backup policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + #[serde(flatten)] + pub base_backup_policy: BaseBackupPolicy, + #[doc = "Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc"] + #[serde(rename = "policyRules")] + pub policy_rules: Vec, +} +impl BackupPolicy { + pub fn new(base_backup_policy: BaseBackupPolicy, policy_rules: Vec) -> Self { + Self { + base_backup_policy, + policy_rules, + } + } +} +#[doc = "Schedule for backup"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupSchedule { + #[doc = "ISO 8601 repeating time interval format"] + #[serde(rename = "repeatingTimeIntervals")] + pub repeating_time_intervals: Vec, + #[doc = "Time zone for a schedule. Example: Pacific Standard Time"] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl BackupSchedule { + pub fn new(repeating_time_intervals: Vec) -> Self { + Self { + repeating_time_intervals, + time_zone: None, + } + } +} +#[doc = "Backup Vault"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVault { + #[doc = "Provisioning state of the BackupVault resource"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Resource move state for backup vault"] + #[serde(rename = "resourceMoveState", default, skip_serializing_if = "Option::is_none")] + pub resource_move_state: Option, + #[doc = "ResourceMoveDetails will be returned in response to GetResource call from ARM"] + #[serde(rename = "resourceMoveDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_move_details: Option, + #[doc = "Storage Settings"] + #[serde(rename = "storageSettings")] + pub storage_settings: Vec, + #[doc = "Monitoring Settings"] + #[serde(rename = "monitoringSettings", default, skip_serializing_if = "Option::is_none")] + pub monitoring_settings: Option, +} +impl BackupVault { + pub fn new(storage_settings: Vec) -> Self { + Self { + provisioning_state: None, + resource_move_state: None, + resource_move_details: None, + storage_settings, + monitoring_settings: None, + } + } +} +pub mod backup_vault { + use super::*; + #[doc = "Provisioning state of the BackupVault resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } + #[doc = "Resource move state for backup vault"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceMoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + Failed, + PrepareTimedout, + CommitTimedout, + CriticalFailure, + PartialSuccess, + MoveSucceeded, + } +} +#[doc = "Backup Vault Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupVaultResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + #[doc = "Backup Vault"] + pub properties: BackupVault, +} +impl BackupVaultResource { + pub fn new(properties: BackupVault) -> Self { + Self { + dpp_tracked_resource: DppTrackedResource::default(), + properties, + } + } +} +#[doc = "List of BackupVault resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupVaultResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupVaultResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupPolicy base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BaseBackupPolicy { + #[doc = "Type of datasource for the backup management"] + #[serde(rename = "datasourceTypes")] + pub datasource_types: Vec, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BaseBackupPolicy { + pub fn new(datasource_types: Vec, object_type: String) -> Self { + Self { + datasource_types, + object_type, + } + } +} +#[doc = "BaseBackupPolicy resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BaseBackupPolicyResource { + #[serde(flatten)] + pub dpp_resource: DppResource, + #[doc = "BackupPolicy base"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BaseBackupPolicyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of BaseBackupPolicy resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BaseBackupPolicyResourceList { + #[serde(flatten)] + pub dpp_resource_list: DppResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BaseBackupPolicyResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BasePolicy Rule"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BasePolicyRule { + pub name: String, + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BasePolicyRule { + pub fn new(name: String, object_type: String) -> Self { + Self { name, object_type } + } +} +#[doc = "CheckNameAvailability Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityRequest { + #[doc = "Resource name for which availability needs to be checked"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Describes the Resource type: Microsoft.DataProtection/BackupVaults"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CheckNameAvailabilityRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "CheckNameAvailability Result"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[doc = "Gets or sets the message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Gets or sets a value indicating whether [name available]."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "Gets or sets the reason."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Localized display information of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryDisplay { + #[doc = "Description of the operation having details of what operation is about."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Operations Name itself."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Name of the provider for display purposes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "ResourceType for which this Operation can be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl ClientDiscoveryDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox log specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForLogSpecification { + #[doc = "blob duration of shoebox log specification"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + #[doc = "Localized display name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Name for shoebox log specification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ClientDiscoveryForLogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox properties in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForProperties { + #[doc = "Class to represent shoebox service specification in json client discovery."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl ClientDiscoveryForProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox service specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForServiceSpecification { + #[doc = "List of log specifications of this operation."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +impl ClientDiscoveryForServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations List response which contains list of available APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryResponse { + #[doc = "Link to the next chunk of Response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "List of available operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ClientDiscoveryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryValueForSingleApi { + #[doc = "Localized display information of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Name of the Operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Indicates whether the operation is a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Class to represent shoebox properties in json client discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientDiscoveryValueForSingleApi { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from Azure Backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Copy on Expiry Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOnExpiryOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +impl CopyOnExpiryOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { copy_option } + } +} +#[doc = "Options to copy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyOption { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl CopyOption { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Duration based custom options to copy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, + #[doc = "Data copied after given timespan"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, +} +impl CustomCopyOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { + copy_option, + duration: None, + } + } +} +#[doc = "DataStoreInfo base"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreInfoBase { + #[doc = "type of datastore; Operational/Vault/Archive"] + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_info_base::DataStoreType, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl DataStoreInfoBase { + pub fn new(data_store_type: data_store_info_base::DataStoreType, object_type: String) -> Self { + Self { + data_store_type, + object_type, + } + } +} +pub mod data_store_info_base { + use super::*; + #[doc = "type of datastore; Operational/Vault/Archive"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "Parameters for DataStore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataStoreParameters { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "type of datastore; Operational/Vault/Archive"] + #[serde(rename = "dataStoreType")] + pub data_store_type: data_store_parameters::DataStoreType, +} +impl DataStoreParameters { + pub fn new(object_type: String, data_store_type: data_store_parameters::DataStoreType) -> Self { + Self { + object_type, + data_store_type, + } + } +} +pub mod data_store_parameters { + use super::*; + #[doc = "type of datastore; Operational/Vault/Archive"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataStoreType { + OperationalStore, + VaultStore, + ArchiveStore, + } +} +#[doc = "Datasource to be backed up"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Datasource { + #[doc = "DatasourceType of the resource."] + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault."] + #[serde(rename = "resourceID")] + pub resource_id: String, + #[doc = "Location of datasource."] + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[doc = "Unique identifier of the resource in the context of parent."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[doc = "Resource Type of Datasource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Uri of the resource."] + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +impl Datasource { + pub fn new(resource_id: String) -> Self { + Self { + datasource_type: None, + object_type: None, + resource_id, + resource_location: None, + resource_name: None, + resource_type: None, + resource_uri: None, + } + } +} +#[doc = "DatasourceSet details of datasource to be backed up"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasourceSet { + #[doc = "DatasourceType of the resource."] + #[serde(rename = "datasourceType", default, skip_serializing_if = "Option::is_none")] + pub datasource_type: Option, + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault."] + #[serde(rename = "resourceID")] + pub resource_id: String, + #[doc = "Location of datasource."] + #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")] + pub resource_location: Option, + #[doc = "Unique identifier of the resource in the context of parent."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[doc = "Resource Type of Datasource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Uri of the resource."] + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, +} +impl DatasourceSet { + pub fn new(resource_id: String) -> Self { + Self { + datasource_type: None, + object_type: None, + resource_id, + resource_location: None, + resource_name: None, + resource_type: None, + resource_uri: None, + } + } +} +#[doc = "Day of the week"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Day { + #[doc = "Date of the month"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub date: Option, + #[doc = "Whether Date is last date of month"] + #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] + pub is_last: Option, +} +impl Day { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delete Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteOption { + #[doc = "Duration of deletion after given timespan"] + pub duration: String, + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl DeleteOption { + pub fn new(duration: String, object_type: String) -> Self { + Self { duration, object_type } + } +} +#[doc = "Base resource under Microsoft.DataProtection provider namespace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppBaseResource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DppBaseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base for all lists of V2 resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppBaseResourceList { + #[doc = "List of Dpp resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppBaseResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppIdentityDetails { + #[doc = "The object ID of the service principal object for the managed identity that is used to grant role-based access to an Azure resource."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identityType which can be either SystemAssigned or None"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DppIdentityDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource class"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppResource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DppResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ListResource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppResourceList { + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppTrackedResource { + #[doc = "Optional ETag."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Identity details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DppTrackedResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppTrackedResourceList { + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DppTrackedResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DppWorkerRequest { + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[serde(rename = "supportedGroupVersions", default, skip_serializing_if = "Vec::is_empty")] + pub supported_group_versions: Vec, + #[serde(rename = "cultureInfo", default, skip_serializing_if = "Option::is_none")] + pub culture_info: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[serde(rename = "httpMethod", default, skip_serializing_if = "Option::is_none")] + pub http_method: Option, +} +impl DppWorkerRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result for export jobs containing blob details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExportJobsResult { + #[doc = "URL of the blob into which the serialized string of list of jobs is exported."] + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, + #[doc = "SAS key to access the blob."] + #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] + pub blob_sas_key: Option, + #[doc = "URL of the blob into which the ExcelFile is uploaded."] + #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_url: Option, + #[doc = "SAS key to access the ExcelFile blob."] + #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_sas_key: Option, +} +impl ExportJobsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for feature object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequest { + #[serde(flatten)] + pub feature_validation_request_base: FeatureValidationRequestBase, + #[doc = "backup support feature type."] + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[doc = "backup support feature name."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, +} +impl FeatureValidationRequest { + pub fn new(feature_validation_request_base: FeatureValidationRequestBase) -> Self { + Self { + feature_validation_request_base, + feature_type: None, + feature_name: None, + } + } +} +pub mod feature_validation_request { + use super::*; + #[doc = "backup support feature type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[doc = "Base class for Backup Feature support"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationRequestBase { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl FeatureValidationRequestBase { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Feature Validation Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponse { + #[serde(flatten)] + pub feature_validation_response_base: FeatureValidationResponseBase, + #[doc = "backup support feature type."] + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, + #[doc = "Response features"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub features: Vec, +} +impl FeatureValidationResponse { + pub fn new(feature_validation_response_base: FeatureValidationResponseBase) -> Self { + Self { + feature_validation_response_base, + feature_type: None, + features: Vec::new(), + } + } +} +pub mod feature_validation_response { + use super::*; + #[doc = "backup support feature type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FeatureType { + Invalid, + DataSourceType, + } +} +#[doc = "Base class for Backup Feature support"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureValidationResponseBase { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl FeatureValidationResponseBase { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Immediate copy Option"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImmediateCopyOption { + #[serde(flatten)] + pub copy_option: CopyOption, +} +impl ImmediateCopyOption { + pub fn new(copy_option: CopyOption) -> Self { + Self { copy_option } + } +} +#[doc = "Inner Error"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InnerError { + #[doc = "Any Key value pairs that can be provided to the client for additional verbose information."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, + #[doc = "Unique code for this error"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Inner Error"] + #[serde(rename = "embeddedInnerError", default, skip_serializing_if = "Option::is_none")] + pub embedded_inner_error: Box>, +} +impl InnerError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to contain criteria for item level restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreCriteria { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl ItemLevelRestoreCriteria { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Restore target info for Item level restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItemLevelRestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Restore Criteria"] + #[serde(rename = "restoreCriteria")] + pub restore_criteria: Vec, + #[doc = "Datasource to be backed up"] + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +impl ItemLevelRestoreTargetInfo { + pub fn new( + restore_target_info_base: RestoreTargetInfoBase, + restore_criteria: Vec, + datasource_info: Datasource, + ) -> Self { + Self { + restore_target_info_base, + restore_criteria, + datasource_info, + datasource_set_info: None, + datasource_auth_credentials: None, + } + } +} +#[doc = "Extended Information about the job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobExtendedInfo { + #[doc = "Job's Additional Details"] + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[doc = "State of the Backup Instance"] + #[serde(rename = "backupInstanceState", default, skip_serializing_if = "Option::is_none")] + pub backup_instance_state: Option, + #[doc = "Number of bytes transferred"] + #[serde(rename = "dataTransferredInBytes", default, skip_serializing_if = "Option::is_none")] + pub data_transferred_in_bytes: Option, + #[doc = "Destination where restore is done"] + #[serde(rename = "recoveryDestination", default, skip_serializing_if = "Option::is_none")] + pub recovery_destination: Option, + #[serde(rename = "sourceRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub source_recover_point: Option, + #[doc = "List of Sub Tasks of the job"] + #[serde(rename = "subTasks", default, skip_serializing_if = "Vec::is_empty")] + pub sub_tasks: Vec, + #[serde(rename = "targetRecoverPoint", default, skip_serializing_if = "Option::is_none")] + pub target_recover_point: Option, +} +impl JobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of Job's Sub Task"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobSubTask { + #[doc = "Additional details of Sub Tasks"] + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, + #[doc = "Task Id of the Sub Task"] + #[serde(rename = "taskId")] + pub task_id: i32, + #[doc = "Name of the Sub Task"] + #[serde(rename = "taskName")] + pub task_name: String, + #[doc = "Progress of the Sub Task"] + #[serde(rename = "taskProgress", default, skip_serializing_if = "Option::is_none")] + pub task_progress: Option, + #[doc = "Status of the Sub Task"] + #[serde(rename = "taskStatus")] + pub task_status: String, +} +impl JobSubTask { + pub fn new(task_id: i32, task_name: String, task_status: String) -> Self { + Self { + additional_details: None, + task_id, + task_name, + task_progress: None, + task_status, + } + } +} +#[doc = "Item Level kubernetes persistent volume target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesPvRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "Selected persistent volume claim name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Selected storage class name for restore operation"] + #[serde(rename = "storageClassName", default, skip_serializing_if = "Option::is_none")] + pub storage_class_name: Option, +} +impl KubernetesPvRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + name: None, + storage_class_name: None, + } + } +} +#[doc = "Item Level kubernetes storage class target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KubernetesStorageClassRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "Selected storage class name"] + #[serde(rename = "selectedStorageClassName", default, skip_serializing_if = "Option::is_none")] + pub selected_storage_class_name: Option, + #[doc = "Provisioner of the storage class"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provisioner: Option, +} +impl KubernetesStorageClassRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + selected_storage_class_name: None, + provisioner: None, + } + } +} +#[doc = "Monitoring Settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MonitoringSettings { + #[doc = "Settings for Azure Monitor based alerts"] + #[serde(rename = "azureMonitorAlertSettings", default, skip_serializing_if = "Option::is_none")] + pub azure_monitor_alert_settings: Option, +} +impl MonitoringSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Extended Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationExtendedInfo { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl OperationExtendedInfo { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Operation Job Extended Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationJobExtendedInfo { + #[serde(flatten)] + pub operation_extended_info: OperationExtendedInfo, + #[doc = "Arm Id of the job created for this operation."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +impl OperationJobExtendedInfo { + pub fn new(operation_extended_info: OperationExtendedInfo) -> Self { + Self { + operation_extended_info, + job_id: None, + } + } +} +#[doc = "Operation Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResource { + #[doc = "End time of the operation"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "It should match what is used to GET the operation result"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "It must match the last segment of the \"id\" field, and will typically be a GUID / system generated value"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation Extended Info"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Start time of the operation"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl OperationResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backup Vault Contract for Patch Backup Vault API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchBackupVaultInput { + #[doc = "Monitoring Settings"] + #[serde(rename = "monitoringSettings", default, skip_serializing_if = "Option::is_none")] + pub monitoring_settings: Option, +} +impl PatchBackupVaultInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Patch Request content for Microsoft.DataProtection resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchResourceRequestInput { + #[doc = "Identity details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Backup Vault Contract for Patch Backup Vault API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PatchResourceRequestInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy Info in backupInstance"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyInfo { + #[serde(rename = "policyId")] + pub policy_id: String, + #[serde(rename = "policyVersion", default, skip_serializing_if = "Option::is_none")] + pub policy_version: Option, + #[doc = "Parameters in Policy"] + #[serde(rename = "policyParameters", default, skip_serializing_if = "Option::is_none")] + pub policy_parameters: Option, +} +impl PolicyInfo { + pub fn new(policy_id: String) -> Self { + Self { + policy_id, + policy_version: None, + policy_parameters: None, + } + } +} +#[doc = "Parameters in Policy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyParameters { + #[doc = "Gets or sets the DataStore Parameters"] + #[serde(rename = "dataStoreParametersList", default, skip_serializing_if = "Vec::is_empty")] + pub data_store_parameters_list: Vec, +} +impl PolicyParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection status details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionStatusDetails { + #[doc = "Error object used by layers that have access to localized content, and propagate that to user"] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Option::is_none")] + pub error_details: Option, + #[doc = "Specifies the protection status of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl ProtectionStatusDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod protection_status_details { + use super::*; + #[doc = "Specifies the protection status of the resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + ConfiguringProtection, + ConfiguringProtectionFailed, + ProtectionConfigured, + ProtectionStopped, + SoftDeleted, + SoftDeleting, + } +} +#[doc = "Item Level target info for restore operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RangeBasedItemLevelRestoreCriteria { + #[serde(flatten)] + pub item_level_restore_criteria: ItemLevelRestoreCriteria, + #[doc = "minimum value for range prefix match"] + #[serde(rename = "minMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub min_matching_value: Option, + #[doc = "maximum value for range prefix match"] + #[serde(rename = "maxMatchingValue", default, skip_serializing_if = "Option::is_none")] + pub max_matching_value: Option, +} +impl RangeBasedItemLevelRestoreCriteria { + pub fn new(item_level_restore_criteria: ItemLevelRestoreCriteria) -> Self { + Self { + item_level_restore_criteria, + min_matching_value: None, + max_matching_value: None, + } + } +} +#[doc = "RecoveryPoint datastore details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointDataStoreDetails { + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[serde(rename = "expiryTime", default, skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "metaData", default, skip_serializing_if = "Option::is_none")] + pub meta_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible: Option, + #[serde(rename = "rehydrationExpiryTime", default, skip_serializing_if = "Option::is_none")] + pub rehydration_expiry_time: Option, + #[serde(rename = "rehydrationStatus", default, skip_serializing_if = "Option::is_none")] + pub rehydration_status: Option, +} +impl RecoveryPointDataStoreDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod recovery_point_data_store_details { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RehydrationStatus { + #[serde(rename = "CREATE_IN_PROGRESS")] + CreateInProgress, + #[serde(rename = "COMPLETED")] + Completed, + #[serde(rename = "DELETE_IN_PROGRESS")] + DeleteInProgress, + #[serde(rename = "DELETED")] + Deleted, + #[serde(rename = "FAILED")] + Failed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointsFilters { + #[serde(rename = "restorePointDataStoreId", default, skip_serializing_if = "Option::is_none")] + pub restore_point_data_store_id: Option, + #[serde(rename = "isVisible", default, skip_serializing_if = "Option::is_none")] + pub is_visible: Option, + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[serde(rename = "restorePointState", default, skip_serializing_if = "Option::is_none")] + pub restore_point_state: Option, +} +impl RecoveryPointsFilters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Priority to be used for rehydration. Values High or Standard"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RehydrationPriority { + Invalid, + High, + Standard, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuard { + #[doc = "Provisioning state of the BackupVault resource"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "This flag indicates whether auto approval is allowed or not."] + #[serde(rename = "allowAutoApprovals", default, skip_serializing_if = "Option::is_none")] + pub allow_auto_approvals: Option, + #[doc = "{readonly} List of operation details those are protected by the ResourceGuard resource"] + #[serde(rename = "resourceGuardOperations", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operations: Vec, + #[doc = "List of critical operations which are not protected by this resourceGuard"] + #[serde(rename = "vaultCriticalOperationExclusionList", default, skip_serializing_if = "Vec::is_empty")] + pub vault_critical_operation_exclusion_list: Vec, + #[doc = "Description about the pre-req steps to perform all the critical operations."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ResourceGuard { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_guard { + use super::*; + #[doc = "Provisioning state of the BackupVault resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Failed, + Provisioning, + Succeeded, + Unknown, + Updating, + } +} +#[doc = "This class contains all the details about a critical operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardOperation { + #[doc = "Name of the critical operation."] + #[serde(rename = "vaultCriticalOperation", default, skip_serializing_if = "Option::is_none")] + pub vault_critical_operation: Option, + #[doc = "Type of resource request."] + #[serde(rename = "requestResourceType", default, skip_serializing_if = "Option::is_none")] + pub request_resource_type: Option, +} +impl ResourceGuardOperation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardResource { + #[serde(flatten)] + pub dpp_tracked_resource: DppTrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResourceGuardResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ResourceGuard resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardResourceList { + #[serde(flatten)] + pub dpp_tracked_resource_list: DppTrackedResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ResourceGuardResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ResourceMoveDetails will be returned in response to GetResource call from ARM"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceMoveDetails { + #[doc = "CorrelationId of latest ResourceMove operation attempted"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format."] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format."] + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[doc = "ARM resource path of source resource"] + #[serde(rename = "sourceResourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_resource_path: Option, + #[doc = "ARM resource path of target resource used in latest ResourceMove operation"] + #[serde(rename = "targetResourcePath", default, skip_serializing_if = "Option::is_none")] + pub target_resource_path: Option, +} +impl ResourceMoveDetails { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestorableTimeRange { + #[doc = "Start time for the available restore range"] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "End time for the available restore range"] + #[serde(rename = "endTime")] + pub end_time: String, + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, +} +impl RestorableTimeRange { + pub fn new(start_time: String, end_time: String) -> Self { + Self { + start_time, + end_time, + object_type: None, + } + } +} +#[doc = "Class encapsulating restore as files target parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreFilesTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Class encapsulating target details, used where the destination is not a datasource"] + #[serde(rename = "targetDetails")] + pub target_details: TargetDetails, +} +impl RestoreFilesTargetInfo { + pub fn new(restore_target_info_base: RestoreTargetInfoBase, target_details: TargetDetails) -> Self { + Self { + restore_target_info_base, + target_details, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestoreJobRecoveryPointDetails { + #[serde(rename = "recoveryPointID", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, +} +impl RestoreJobRecoveryPointDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class encapsulating restore target parameters"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfo { + #[serde(flatten)] + pub restore_target_info_base: RestoreTargetInfoBase, + #[doc = "Datasource to be backed up"] + #[serde(rename = "datasourceInfo")] + pub datasource_info: Datasource, + #[doc = "DatasourceSet details of datasource to be backed up"] + #[serde(rename = "datasourceSetInfo", default, skip_serializing_if = "Option::is_none")] + pub datasource_set_info: Option, + #[doc = "Base class for different types of authentication credentials."] + #[serde(rename = "datasourceAuthCredentials", default, skip_serializing_if = "Option::is_none")] + pub datasource_auth_credentials: Option, +} +impl RestoreTargetInfo { + pub fn new(restore_target_info_base: RestoreTargetInfoBase, datasource_info: Datasource) -> Self { + Self { + restore_target_info_base, + datasource_info, + datasource_set_info: None, + datasource_auth_credentials: None, + } + } +} +#[doc = "Base class common to RestoreTargetInfo and RestoreFilesTargetInfo"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreTargetInfoBase { + #[doc = "Type of Datasource object, used to initialize the right inherited type"] + #[serde(rename = "objectType")] + pub object_type: String, + #[doc = "Recovery Option"] + #[serde(rename = "recoveryOption")] + pub recovery_option: restore_target_info_base::RecoveryOption, + #[doc = "Target Restore region"] + #[serde(rename = "restoreLocation", default, skip_serializing_if = "Option::is_none")] + pub restore_location: Option, +} +impl RestoreTargetInfoBase { + pub fn new(object_type: String, recovery_option: restore_target_info_base::RecoveryOption) -> Self { + Self { + object_type, + recovery_option, + restore_location: None, + } + } +} +pub mod restore_target_info_base { + use super::*; + #[doc = "Recovery Option"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryOption { + FailIfExists, + } +} +#[doc = "Retention tag"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionTag { + #[doc = "Retention Tag version."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, + #[doc = "Retention Tag version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Retention Tag Name to relate it to retention rule."] + #[serde(rename = "tagName")] + pub tag_name: String, +} +impl RetentionTag { + pub fn new(tag_name: String) -> Self { + Self { + e_tag: None, + id: None, + tag_name, + } + } +} +#[doc = "Schedule based backup criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedBackupCriteria { + #[serde(flatten)] + pub backup_criteria: BackupCriteria, + #[doc = "it contains absolute values like \"AllBackup\" / \"FirstOfDay\" / \"FirstOfWeek\" / \"FirstOfMonth\"\r\nand should be part of AbsoluteMarker enum"] + #[serde(rename = "absoluteCriteria", default, skip_serializing_if = "Vec::is_empty")] + pub absolute_criteria: Vec, + #[doc = "This is day of the month from 1 to 28 other wise last of month"] + #[serde(rename = "daysOfMonth", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_month: Vec, + #[doc = "It should be Sunday/Monday/T..../Saturday"] + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[doc = "It should be January/February/....../December"] + #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] + pub months_of_year: Vec, + #[doc = "List of schedule times for backup"] + #[serde(rename = "scheduleTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_times: Vec, + #[doc = "It should be First/Second/Third/Fourth/Last"] + #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_the_month: Vec, +} +impl ScheduleBasedBackupCriteria { + pub fn new(backup_criteria: BackupCriteria) -> Self { + Self { + backup_criteria, + absolute_criteria: Vec::new(), + days_of_month: Vec::new(), + days_of_the_week: Vec::new(), + months_of_year: Vec::new(), + schedule_times: Vec::new(), + weeks_of_the_month: Vec::new(), + } + } +} +#[doc = "Schedule based trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleBasedTriggerContext { + #[serde(flatten)] + pub trigger_context: TriggerContext, + #[doc = "Schedule for backup"] + pub schedule: BackupSchedule, + #[doc = "List of tags that can be applicable for given schedule."] + #[serde(rename = "taggingCriteria")] + pub tagging_criteria: Vec, +} +impl ScheduleBasedTriggerContext { + pub fn new(trigger_context: TriggerContext, schedule: BackupSchedule, tagging_criteria: Vec) -> Self { + Self { + trigger_context, + schedule, + tagging_criteria, + } + } +} +#[doc = "Secret store based authentication credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreBasedAuthCredentials { + #[serde(flatten)] + pub auth_credentials: AuthCredentials, + #[doc = "Class representing a secret store resource."] + #[serde(rename = "secretStoreResource", default, skip_serializing_if = "Option::is_none")] + pub secret_store_resource: Option, +} +impl SecretStoreBasedAuthCredentials { + pub fn new(auth_credentials: AuthCredentials) -> Self { + Self { + auth_credentials, + secret_store_resource: None, + } + } +} +#[doc = "Class representing a secret store resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretStoreResource { + #[doc = "Uri to get to the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, + #[doc = "Gets or sets the type of secret store"] + #[serde(rename = "secretStoreType")] + pub secret_store_type: secret_store_resource::SecretStoreType, + #[doc = "Gets or sets value stored in secret store resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SecretStoreResource { + pub fn new(secret_store_type: secret_store_resource::SecretStoreType) -> Self { + Self { + uri: None, + secret_store_type, + value: None, + } + } +} +pub mod secret_store_resource { + use super::*; + #[doc = "Gets or sets the type of secret store"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SecretStoreType { + Invalid, + AzureKeyVault, + } +} +#[doc = "Source LifeCycle"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceLifeCycle { + #[doc = "Delete Option"] + #[serde(rename = "deleteAfter")] + pub delete_after: DeleteOption, + #[doc = "DataStoreInfo base"] + #[serde(rename = "sourceDataStore")] + pub source_data_store: DataStoreInfoBase, + #[serde(rename = "targetDataStoreCopySettings", default, skip_serializing_if = "Vec::is_empty")] + pub target_data_store_copy_settings: Vec, +} +impl SourceLifeCycle { + pub fn new(delete_after: DeleteOption, source_data_store: DataStoreInfoBase) -> Self { + Self { + delete_after, + source_data_store, + target_data_store_copy_settings: Vec::new(), + } + } +} +#[doc = "Storage setting"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageSetting { + #[doc = "Gets or sets the type of the datastore."] + #[serde(rename = "datastoreType", default, skip_serializing_if = "Option::is_none")] + pub datastore_type: Option, + #[doc = "Gets or sets the type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl StorageSetting { + pub fn new() -> Self { + Self::default() + } +} +pub mod storage_setting { + use super::*; + #[doc = "Gets or sets the type of the datastore."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DatastoreType { + ArchiveStore, + SnapshotStore, + VaultStore, + } + #[doc = "Gets or sets the type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + GeoRedundant, + LocallyRedundant, + } +} +#[doc = "Elements class for feature request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedFeature { + #[doc = "support feature type."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, + #[doc = "feature support status"] + #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] + pub support_status: Option, + #[doc = "support feature type."] + #[serde(rename = "exposureControlledFeatures", default, skip_serializing_if = "Vec::is_empty")] + pub exposure_controlled_features: Vec, +} +impl SupportedFeature { + pub fn new() -> Self { + Self::default() + } +} +pub mod supported_feature { + use super::*; + #[doc = "feature support status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportStatus { + Invalid, + NotSupported, + AlphaPreview, + PrivatePreview, + PublicPreview, + GenerallyAvailable, + } +} +#[doc = "Sync BackupInstance Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SyncBackupInstanceRequest { + #[doc = "Field indicating sync type e.g. to sync only in case of failure or in all cases"] + #[serde(rename = "syncType", default, skip_serializing_if = "Option::is_none")] + pub sync_type: Option, +} +impl SyncBackupInstanceRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod sync_backup_instance_request { + use super::*; + #[doc = "Field indicating sync type e.g. to sync only in case of failure or in all cases"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SyncType { + Default, + ForceResync, + } +} +#[doc = "Tagging criteria"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaggingCriteria { + #[doc = "Criteria which decides whether the tag can be applied to a triggered backup."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub criteria: Vec, + #[doc = "Specifies if tag is default."] + #[serde(rename = "isDefault")] + pub is_default: bool, + #[doc = "Retention Tag priority."] + #[serde(rename = "taggingPriority")] + pub tagging_priority: i64, + #[doc = "Retention tag"] + #[serde(rename = "tagInfo")] + pub tag_info: RetentionTag, +} +impl TaggingCriteria { + pub fn new(is_default: bool, tagging_priority: i64, tag_info: RetentionTag) -> Self { + Self { + criteria: Vec::new(), + is_default, + tagging_priority, + tag_info, + } + } +} +#[doc = "Target copy settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetCopySetting { + #[doc = "Options to copy"] + #[serde(rename = "copyAfter")] + pub copy_after: CopyOption, + #[doc = "DataStoreInfo base"] + #[serde(rename = "dataStore")] + pub data_store: DataStoreInfoBase, +} +impl TargetCopySetting { + pub fn new(copy_after: CopyOption, data_store: DataStoreInfoBase) -> Self { + Self { copy_after, data_store } + } +} +#[doc = "Class encapsulating target details, used where the destination is not a datasource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetDetails { + #[doc = "Restore operation may create multiple files inside location pointed by Url\r\nBelow will be the common prefix for all of them"] + #[serde(rename = "filePrefix")] + pub file_prefix: String, + #[doc = "Denotes the target location where the data will be restored,\r\nstring value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}"] + #[serde(rename = "restoreTargetLocationType")] + pub restore_target_location_type: target_details::RestoreTargetLocationType, + #[doc = "Url denoting the restore destination. It can point to container / file share etc"] + pub url: String, +} +impl TargetDetails { + pub fn new(file_prefix: String, restore_target_location_type: target_details::RestoreTargetLocationType, url: String) -> Self { + Self { + file_prefix, + restore_target_location_type, + url, + } + } +} +pub mod target_details { + use super::*; + #[doc = "Denotes the target location where the data will be restored,\r\nstring value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreTargetLocationType { + Invalid, + AzureBlobs, + AzureFiles, + } +} +#[doc = "Trigger backup request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerBackupRequest { + #[doc = "Adhoc backup rules"] + #[serde(rename = "backupRuleOptions")] + pub backup_rule_options: AdHocBackupRuleOptions, +} +impl TriggerBackupRequest { + pub fn new(backup_rule_options: AdHocBackupRuleOptions) -> Self { + Self { backup_rule_options } + } +} +#[doc = "Trigger context"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerContext { + #[doc = "Type of the specific object - used for deserializing"] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl TriggerContext { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Error object used by layers that have access to localized content, and propagate that to user"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserFacingError { + #[doc = "Unique code for this error"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Additional related Errors"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "Inner Error"] + #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")] + pub inner_error: Option, + #[doc = "Whether the operation will be retryable or not"] + #[serde(rename = "isRetryable", default, skip_serializing_if = "Option::is_none")] + pub is_retryable: Option, + #[doc = "Whether the operation is due to a user error or service error"] + #[serde(rename = "isUserError", default, skip_serializing_if = "Option::is_none")] + pub is_user_error: Option, + #[doc = "Any key value pairs that can be injected inside error object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "RecommendedAction � localized."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Vec::is_empty")] + pub recommended_action: Vec, + #[doc = "Target of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl UserFacingError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Validate for backup request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateForBackupRequest { + #[doc = "Backup Instance"] + #[serde(rename = "backupInstance")] + pub backup_instance: BackupInstance, +} +impl ValidateForBackupRequest { + pub fn new(backup_instance: BackupInstance) -> Self { + Self { backup_instance } + } +} +#[doc = "Validate restore request object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateRestoreRequestObject { + #[doc = "Azure backup restore request"] + #[serde(rename = "restoreRequestObject")] + pub restore_request_object: AzureBackupRestoreRequest, +} +impl ValidateRestoreRequestObject { + pub fn new(restore_request_object: AzureBackupRestoreRequest) -> Self { + Self { restore_request_object } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/dataprotection/src/package_preview_2022_03/operations.rs b/services/mgmt/dataprotection/src/package_preview_2022_03/operations.rs new file mode 100644 index 0000000000..3ac0842032 --- /dev/null +++ b/services/mgmt/dataprotection/src/package_preview_2022_03/operations.rs @@ -0,0 +1,5795 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn backup_instances(&self) -> backup_instances::Client { + backup_instances::Client(self.clone()) + } + pub fn backup_instances_extension_routing(&self) -> backup_instances_extension_routing::Client { + backup_instances_extension_routing::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backup_vault_operation_results(&self) -> backup_vault_operation_results::Client { + backup_vault_operation_results::Client(self.clone()) + } + pub fn backup_vaults(&self) -> backup_vaults::Client { + backup_vaults::Client(self.clone()) + } + pub fn data_protection(&self) -> data_protection::Client { + data_protection::Client(self.clone()) + } + pub fn data_protection_operations(&self) -> data_protection_operations::Client { + data_protection_operations::Client(self.clone()) + } + pub fn export_jobs(&self) -> export_jobs::Client { + export_jobs::Client(self.clone()) + } + pub fn export_jobs_operation_result(&self) -> export_jobs_operation_result::Client { + export_jobs_operation_result::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operation_result(&self) -> operation_result::Client { + operation_result::Client(self.clone()) + } + pub fn operation_status(&self) -> operation_status::Client { + operation_status::Client(self.clone()) + } + pub fn operation_status_backup_vault_context(&self) -> operation_status_backup_vault_context::Client { + operation_status_backup_vault_context::Client(self.clone()) + } + pub fn operation_status_resource_group_context(&self) -> operation_status_resource_group_context::Client { + operation_status_resource_group_context::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn resource_guards(&self) -> resource_guards::Client { + resource_guards::Client(self.clone()) + } + pub fn restorable_time_ranges(&self) -> restorable_time_ranges::Client { + restorable_time_ranges::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupVaults_GetInSubscription(#[from] backup_vaults::get_in_subscription::Error), + #[error(transparent)] + OperationResult_Get(#[from] operation_result::get::Error), + #[error(transparent)] + OperationStatus_Get(#[from] operation_status::get::Error), + #[error(transparent)] + OperationStatusBackupVaultContext_Get(#[from] operation_status_backup_vault_context::get::Error), + #[error(transparent)] + OperationStatusResourceGroupContext_Get(#[from] operation_status_resource_group_context::get::Error), + #[error(transparent)] + BackupVaults_GetInResourceGroup(#[from] backup_vaults::get_in_resource_group::Error), + #[error(transparent)] + BackupVaults_Get(#[from] backup_vaults::get::Error), + #[error(transparent)] + BackupVaults_CreateOrUpdate(#[from] backup_vaults::create_or_update::Error), + #[error(transparent)] + BackupVaults_Update(#[from] backup_vaults::update::Error), + #[error(transparent)] + BackupVaults_Delete(#[from] backup_vaults::delete::Error), + #[error(transparent)] + BackupVaultOperationResults_Get(#[from] backup_vault_operation_results::get::Error), + #[error(transparent)] + BackupVaults_CheckNameAvailability(#[from] backup_vaults::check_name_availability::Error), + #[error(transparent)] + DataProtection_CheckFeatureSupport(#[from] data_protection::check_feature_support::Error), + #[error(transparent)] + DataProtectionOperations_List(#[from] data_protection_operations::list::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + BackupPolicies_Get(#[from] backup_policies::get::Error), + #[error(transparent)] + BackupPolicies_CreateOrUpdate(#[from] backup_policies::create_or_update::Error), + #[error(transparent)] + BackupPolicies_Delete(#[from] backup_policies::delete::Error), + #[error(transparent)] + BackupInstances_List(#[from] backup_instances::list::Error), + #[error(transparent)] + BackupInstancesExtensionRouting_List(#[from] backup_instances_extension_routing::list::Error), + #[error(transparent)] + BackupInstances_Get(#[from] backup_instances::get::Error), + #[error(transparent)] + BackupInstances_CreateOrUpdate(#[from] backup_instances::create_or_update::Error), + #[error(transparent)] + BackupInstances_Delete(#[from] backup_instances::delete::Error), + #[error(transparent)] + BackupInstances_AdhocBackup(#[from] backup_instances::adhoc_backup::Error), + #[error(transparent)] + BackupInstances_ValidateForBackup(#[from] backup_instances::validate_for_backup::Error), + #[error(transparent)] + BackupInstances_GetBackupInstanceOperationResult(#[from] backup_instances::get_backup_instance_operation_result::Error), + #[error(transparent)] + RecoveryPoints_List(#[from] recovery_points::list::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + BackupInstances_TriggerRehydrate(#[from] backup_instances::trigger_rehydrate::Error), + #[error(transparent)] + BackupInstances_TriggerRestore(#[from] backup_instances::trigger_restore::Error), + #[error(transparent)] + BackupInstances_ResumeBackups(#[from] backup_instances::resume_backups::Error), + #[error(transparent)] + BackupInstances_ResumeProtection(#[from] backup_instances::resume_protection::Error), + #[error(transparent)] + BackupInstances_StopProtection(#[from] backup_instances::stop_protection::Error), + #[error(transparent)] + BackupInstances_SuspendBackups(#[from] backup_instances::suspend_backups::Error), + #[error(transparent)] + BackupInstances_SyncBackupInstance(#[from] backup_instances::sync_backup_instance::Error), + #[error(transparent)] + BackupInstances_ValidateForRestore(#[from] backup_instances::validate_for_restore::Error), + #[error(transparent)] + Jobs_List(#[from] jobs::list::Error), + #[error(transparent)] + RestorableTimeRanges_Find(#[from] restorable_time_ranges::find::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + ExportJobs_Trigger(#[from] export_jobs::trigger::Error), + #[error(transparent)] + ExportJobsOperationResult_Get(#[from] export_jobs_operation_result::get::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInSubscription(#[from] resource_guards::get_resources_in_subscription::Error), + #[error(transparent)] + ResourceGuards_GetResourcesInResourceGroup(#[from] resource_guards::get_resources_in_resource_group::Error), + #[error(transparent)] + ResourceGuards_Get(#[from] resource_guards::get::Error), + #[error(transparent)] + ResourceGuards_Put(#[from] resource_guards::put::Error), + #[error(transparent)] + ResourceGuards_Patch(#[from] resource_guards::patch::Error), + #[error(transparent)] + ResourceGuards_Delete(#[from] resource_guards::delete::Error), + #[error(transparent)] + ResourceGuards_GetDisableSoftDeleteRequestsObjects(#[from] resource_guards::get_disable_soft_delete_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteResourceGuardProxyRequestsObjects( + #[from] resource_guards::get_delete_resource_guard_proxy_requests_objects::Error, + ), + #[error(transparent)] + ResourceGuards_GetBackupSecurityPinRequestsObjects(#[from] resource_guards::get_backup_security_pin_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDeleteProtectedItemRequestsObjects(#[from] resource_guards::get_delete_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectionPolicyRequestsObjects(#[from] resource_guards::get_update_protection_policy_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetUpdateProtectedItemRequestsObjects(#[from] resource_guards::get_update_protected_item_requests_objects::Error), + #[error(transparent)] + ResourceGuards_GetDefaultDisableSoftDeleteRequestsObject( + #[from] resource_guards::get_default_disable_soft_delete_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteResourceGuardProxyRequestsObject( + #[from] resource_guards::get_default_delete_resource_guard_proxy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultBackupSecurityPinRequestsObject( + #[from] resource_guards::get_default_backup_security_pin_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultDeleteProtectedItemRequestsObject( + #[from] resource_guards::get_default_delete_protected_item_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectionPolicyRequestsObject( + #[from] resource_guards::get_default_update_protection_policy_requests_object::Error, + ), + #[error(transparent)] + ResourceGuards_GetDefaultUpdateProtectedItemRequestsObject( + #[from] resource_guards::get_default_update_protected_item_requests_object::Error, + ), +} +pub mod backup_vaults { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_in_subscription(&self, subscription_id: impl Into) -> get_in_subscription::Builder { + get_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_in_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get_in_resource_group::Builder { + get_in_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "API to check for resource name availability"] + pub fn check_name_availability( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod get_in_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_in_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Created201(models::BackupVaultResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::BackupVaultResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::CheckNameAvailabilityRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + operation_id: impl Into, + location: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + location: location.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::OperationJobExtendedInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a resource."] + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status_backup_vault_context { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for an operation over a BackupVault's context."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status_resource_group_context { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for an operation over a ResourceGroup's context."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_vault_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupVaultResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupVaultResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Validates if a feature is supported"] + pub fn check_feature_support( + &self, + subscription_id: impl Into, + location: impl Into, + parameters: impl Into, + ) -> check_feature_support::Builder { + check_feature_support::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + parameters: parameters.into(), + } + } + } + pub mod check_feature_support { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) parameters: models::FeatureValidationRequestBase, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/locations/{}/checkFeatureSupport", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FeatureValidationResponseBase = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_protection_operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.DataProtection/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "Gets a backup policy belonging to a backup vault"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + #[doc = "Creates or Updates a backup policy belonging to a backup vault"] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a backup policy belonging to a backup vault"] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_policy_name: backup_policy_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + pub(crate) parameters: models::BaseBackupPolicyResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BaseBackupPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_instances { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn adhoc_backup( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> adhoc_backup::Builder { + adhoc_backup::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_backup( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + parameters: impl Into, + ) -> validate_for_backup::Builder { + validate_for_backup::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + } + } + pub fn get_backup_instance_operation_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + operation_id: impl Into, + ) -> get_backup_instance_operation_result::Builder { + get_backup_instance_operation_result::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + operation_id: operation_id.into(), + } + } + pub fn trigger_rehydrate( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_name: impl Into, + parameters: impl Into, + backup_instance_name: impl Into, + ) -> trigger_rehydrate::Builder { + trigger_rehydrate::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_name: vault_name.into(), + parameters: parameters.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn trigger_restore( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> trigger_restore::Builder { + trigger_restore::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn resume_backups( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> resume_backups::Builder { + resume_backups::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn resume_protection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> resume_protection::Builder { + resume_protection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn stop_protection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> stop_protection::Builder { + stop_protection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn suspend_backups( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> suspend_backups::Builder { + suspend_backups::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + } + } + pub fn sync_backup_instance( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> sync_backup_instance::Builder { + sync_backup_instance::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + pub fn validate_for_restore( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> validate_for_restore::Builder { + validate_for_restore::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInstanceResource), + Created201(models::BackupInstanceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::BackupInstanceResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod adhoc_backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::TriggerBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_backup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::ValidateForBackupRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/validateForBackup", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup_instance_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackupInstanceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_rehydrate { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_name: String, + pub(crate) parameters: models::AzureBackupRehydrationRequest, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/rehydrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod trigger_restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupRestoreRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume_backups { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/resumeBackups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume_protection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/resumeProtection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_protection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/stopProtection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod suspend_backups { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/suspendBackups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod sync_backup_instance { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::SyncBackupInstanceRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/sync", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate_for_restore { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationJobExtendedInfo), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::ValidateRestoreRequestObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/validateRestore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationJobExtendedInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_instances_extension_routing { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, resource_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_id: resource_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.DataProtection/backupInstances", + self.client.endpoint(), + &self.resource_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupInstanceResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + filter: None, + skip_token: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + recovery_point_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupRecoveryPointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + job_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + job_id: job_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupJobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restorable_time_ranges { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn find( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + backup_instance_name: impl Into, + parameters: impl Into, + ) -> find::Builder { + find::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + backup_instance_name: backup_instance_name.into(), + parameters: parameters.into(), + } + } + } + pub mod find { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) backup_instance_name: String, + pub(crate) parameters: models::AzureBackupFindRestorableTimeRangesRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupInstances/{}/findRestorableTimeRanges" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . backup_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureBackupFindRestorableTimeRangesResponseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/exportBackupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs_operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExportJobsResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/backupVaults/{}/backupJobs/operations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportJobsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guards { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns ResourceGuards collection belonging to a subscription."] + pub fn get_resources_in_subscription(&self, subscription_id: impl Into) -> get_resources_in_subscription::Builder { + get_resources_in_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Returns ResourceGuards collection belonging to a ResourceGroup."] + pub fn get_resources_in_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> get_resources_in_resource_group::Builder { + get_resources_in_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Returns a ResourceGuard belonging to a resource group."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Creates or updates a ResourceGuard resource belonging to a resource group."] + pub fn put( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource."] + pub fn patch( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a ResourceGuard resource from the resource group."] + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_disable_soft_delete_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_disable_soft_delete_requests_objects::Builder { + get_disable_soft_delete_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_resource_guard_proxy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_resource_guard_proxy_requests_objects::Builder { + get_delete_resource_guard_proxy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_backup_security_pin_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_backup_security_pin_requests_objects::Builder { + get_backup_security_pin_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_delete_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_delete_protected_item_requests_objects::Builder { + get_delete_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protection_policy_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protection_policy_requests_objects::Builder { + get_update_protection_policy_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_update_protected_item_requests_objects( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + ) -> get_update_protected_item_requests_objects::Builder { + get_update_protected_item_requests_objects::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_disable_soft_delete_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_disable_soft_delete_requests_object::Builder { + get_default_disable_soft_delete_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_resource_guard_proxy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_resource_guard_proxy_requests_object::Builder { + get_default_delete_resource_guard_proxy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_backup_security_pin_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_backup_security_pin_requests_object::Builder { + get_default_backup_security_pin_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_delete_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_delete_protected_item_requests_object::Builder { + get_default_delete_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protection_policy_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protection_policy_requests_object::Builder { + get_default_update_protection_policy_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + #[doc = "Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource."] + pub fn get_default_update_protected_item_requests_object( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guards_name: impl Into, + request_name: impl Into, + ) -> get_default_update_protected_item_requests_object::Builder { + get_default_update_protected_item_requests_object::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guards_name: resource_guards_name.into(), + request_name: request_name.into(), + } + } + } + pub mod get_resources_in_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_resources_in_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::ResourceGuardResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) parameters: models::PatchResourceRequestInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_guards_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_disable_soft_delete_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_resource_guard_proxy_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_backup_security_pin_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_delete_protected_item_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protection_policy_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_update_protected_item_requests_objects { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_disable_soft_delete_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/disableSoftDeleteRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_resource_guard_proxy_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteResourceGuardProxyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_backup_security_pin_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/getBackupSecurityPINRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_delete_protected_item_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/deleteProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protection_policy_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectionPolicyRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_default_update_protected_item_requests_object { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guards_name: String, + pub(crate) request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DataProtection/resourceGuards/{}/updateProtectedItemRequests/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_guards_name , & self . request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DppBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/datashare/Cargo.toml b/services/mgmt/datashare/Cargo.toml index 623f37e335..58565e2134 100644 --- a/services/mgmt/datashare/Cargo.toml +++ b/services/mgmt/datashare/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_datashare" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/deploymentmanager/Cargo.toml b/services/mgmt/deploymentmanager/Cargo.toml index 604a6e302b..c40fc8f8f9 100644 --- a/services/mgmt/deploymentmanager/Cargo.toml +++ b/services/mgmt/deploymentmanager/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_deploymentmanager" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/desktopvirtualization/Cargo.toml b/services/mgmt/desktopvirtualization/Cargo.toml index 7efa8ffec1..e86b821718 100644 --- a/services/mgmt/desktopvirtualization/Cargo.toml +++ b/services/mgmt/desktopvirtualization/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_desktopvirtualization" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/deviceupdate/Cargo.toml b/services/mgmt/deviceupdate/Cargo.toml index 7e047f37b7..065c61f6e4 100644 --- a/services/mgmt/deviceupdate/Cargo.toml +++ b/services/mgmt/deviceupdate/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_deviceupdate" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/devops/Cargo.toml b/services/mgmt/devops/Cargo.toml index 1a867a9f14..141848cb1f 100644 --- a/services/mgmt/devops/Cargo.toml +++ b/services/mgmt/devops/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_devops" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/devspaces/Cargo.toml b/services/mgmt/devspaces/Cargo.toml index b711281e59..1b0604db23 100644 --- a/services/mgmt/devspaces/Cargo.toml +++ b/services/mgmt/devspaces/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_devspaces" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/devtestlabs/Cargo.toml b/services/mgmt/devtestlabs/Cargo.toml index 2199faa186..022e51e8ff 100644 --- a/services/mgmt/devtestlabs/Cargo.toml +++ b/services/mgmt/devtestlabs/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_devtestlabs" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dfp/Cargo.toml b/services/mgmt/dfp/Cargo.toml index fdcfab9eff..b9e1cdff67 100644 --- a/services/mgmt/dfp/Cargo.toml +++ b/services/mgmt/dfp/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_dfp" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/digitaltwins/Cargo.toml b/services/mgmt/digitaltwins/Cargo.toml index 8f4faefd4e..121fa5fb3a 100644 --- a/services/mgmt/digitaltwins/Cargo.toml +++ b/services/mgmt/digitaltwins/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_digitaltwins" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dns/Cargo.toml b/services/mgmt/dns/Cargo.toml index ed0d91f57c..a826448ec8 100644 --- a/services/mgmt/dns/Cargo.toml +++ b/services/mgmt/dns/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_dns" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/dnsresolver/Cargo.toml b/services/mgmt/dnsresolver/Cargo.toml index c25f499e9f..cf3e8fcda3 100644 --- a/services/mgmt/dnsresolver/Cargo.toml +++ b/services/mgmt/dnsresolver/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_dnsresolver" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/domainservices/Cargo.toml b/services/mgmt/domainservices/Cargo.toml index 2ba57cbc95..ea17852f0a 100644 --- a/services/mgmt/domainservices/Cargo.toml +++ b/services/mgmt/domainservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_domainservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/edgeorder/Cargo.toml b/services/mgmt/edgeorder/Cargo.toml index 875382c55a..2817681de0 100644 --- a/services/mgmt/edgeorder/Cargo.toml +++ b/services/mgmt/edgeorder/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_edgeorder" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/edgeorderpartner/Cargo.toml b/services/mgmt/edgeorderpartner/Cargo.toml index 173ad51f04..819dee5a1b 100644 --- a/services/mgmt/edgeorderpartner/Cargo.toml +++ b/services/mgmt/edgeorderpartner/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_edgeorderpartner" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/education/Cargo.toml b/services/mgmt/education/Cargo.toml new file mode 100644 index 0000000000..a5576c50ad --- /dev/null +++ b/services/mgmt/education/Cargo.toml @@ -0,0 +1,34 @@ +# generated by AutoRust +[package] +name = "azure_mgmt_education" +version = "0.3.0" +edition = "2021" +license = "MIT" +description = "generated REST API bindings" +repository = "https://github.com/azure/azure-sdk-for-rust" +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_mgmt_education" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.2", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1" } +tokio = { version = "1.0", features = ["macros"] } + +[package.metadata.docs.rs] +features = ["no-default-tag"] + +[features] +default = ["package-2021-12-01-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-tag = [] +"package-2021-12-01-preview" = [] diff --git a/services/mgmt/education/README.md b/services/mgmt/education/README.md new file mode 100644 index 0000000000..5c215a9c8b --- /dev/null +++ b/services/mgmt/education/README.md @@ -0,0 +1,13 @@ +# azure_mgmt_education crate + +This is a generated [Azure SDK for Rust](https://github.com/Azure/azure-sdk-for-rust) crate from the Azure REST API specifications listed in: + +https://github.com/Azure/azure-rest-api-specs/blob/main/specification/education/resource-manager/readme.md + +To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). + +The default tag is `package-2021-12-01-preview`. + +The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: + +- `package-2021-12-01-preview` has 21 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-2021-12-01-preview` to enable. The operations will be in the `package_2021_12_01_preview` module. \ No newline at end of file diff --git a/services/mgmt/education/src/lib.rs b/services/mgmt/education/src/lib.rs new file mode 100644 index 0000000000..a45a3a58d7 --- /dev/null +++ b/services/mgmt/education/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust"] +#[cfg(feature = "package-2021-12-01-preview")] +pub mod package_2021_12_01_preview; +#[cfg(all(feature = "package-2021-12-01-preview", not(feature = "no-default-tag")))] +pub use package_2021_12_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/education/src/package_2021_12_01_preview/mod.rs b/services/mgmt/education/src/package_2021_12_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/education/src/package_2021_12_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/education/src/package_2021_12_01_preview/models.rs b/services/mgmt/education/src/package_2021_12_01_preview/models.rs new file mode 100644 index 0000000000..c539ff3814 --- /dev/null +++ b/services/mgmt/education/src/package_2021_12_01_preview/models.rs @@ -0,0 +1,630 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The amount."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Amount { + #[doc = "The type of currency being used for the value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub currency: Option, + #[doc = "Amount value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl Amount { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the format of Error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Error code"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message indicating why the operation failed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponseBody { + #[doc = "Describes the format of Error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponseBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Grant detail properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GrantDetailProperties { + #[doc = "The amount."] + #[serde(rename = "offerCap", default, skip_serializing_if = "Option::is_none")] + pub offer_cap: Option, + #[doc = "Grant Effective Date"] + #[serde(rename = "effectiveDate", default, skip_serializing_if = "Option::is_none")] + pub effective_date: Option, + #[doc = "Grant Offer Type"] + #[serde(rename = "offerType", default, skip_serializing_if = "Option::is_none")] + pub offer_type: Option, + #[doc = "Expiration Date"] + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[doc = "Grant status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The amount."] + #[serde(rename = "allocatedBudget", default, skip_serializing_if = "Option::is_none")] + pub allocated_budget: Option, +} +impl GrantDetailProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod grant_detail_properties { + use super::*; + #[doc = "Grant Offer Type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OfferType { + Student, + Academic, + } + #[doc = "Grant status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Active, + Inactive, + } +} +#[doc = "Grant details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GrantDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Grant detail properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl GrantDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Grants info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GrantListResponse { + #[doc = "The list of labs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl GrantListResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "invite code generate request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InviteCodeGenerateRequest { + #[doc = "the total number of students that can be accepted to the lab."] + #[serde(rename = "maxStudentCount", default, skip_serializing_if = "Option::is_none")] + pub max_student_count: Option, +} +impl InviteCodeGenerateRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "join requests."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JoinRequestDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Join request properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl JoinRequestDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "list of join requests."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JoinRequestList { + #[doc = "The list of requests."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "the link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl JoinRequestList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Join request properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JoinRequestProperties { + #[doc = "First Name"] + #[serde(rename = "firstName", default, skip_serializing_if = "Option::is_none")] + pub first_name: Option, + #[doc = "Last Name"] + #[serde(rename = "lastName", default, skip_serializing_if = "Option::is_none")] + pub last_name: Option, + #[doc = "join request email"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + #[doc = "Join request status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl JoinRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod join_request_properties { + use super::*; + #[doc = "Join request status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Denied, + } +} +#[doc = "Lab details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LabDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Lab detail result properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LabDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of labs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LabListResult { + #[doc = "The list of labs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LabListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Lab detail result properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LabProperties { + #[doc = "Lab Display Name"] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "The amount."] + #[serde(rename = "budgetPerStudent")] + pub budget_per_student: Amount, + #[doc = "Detail description of this lab"] + pub description: String, + #[doc = "Default expiration date for each student in this lab"] + #[serde(rename = "expirationDate")] + pub expiration_date: String, + #[doc = "Lab creation date"] + #[serde(rename = "effectiveDate", default, skip_serializing_if = "Option::is_none")] + pub effective_date: Option, + #[doc = "The status of this lab"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "the total number of students that can be accepted to the lab."] + #[serde(rename = "maxStudentCount", default, skip_serializing_if = "Option::is_none")] + pub max_student_count: Option, + #[doc = "invitation code for redeemable lab"] + #[serde(rename = "invitationCode", default, skip_serializing_if = "Option::is_none")] + pub invitation_code: Option, + #[doc = "The amount."] + #[serde(rename = "totalBudget", default, skip_serializing_if = "Option::is_none")] + pub total_budget: Option, + #[doc = "The amount."] + #[serde(rename = "totalAllocatedBudget", default, skip_serializing_if = "Option::is_none")] + pub total_allocated_budget: Option, +} +impl LabProperties { + pub fn new(display_name: String, budget_per_student: Amount, description: String, expiration_date: String) -> Self { + Self { + display_name, + budget_per_student, + description, + expiration_date, + effective_date: None, + status: None, + max_student_count: None, + invitation_code: None, + total_budget: None, + total_allocated_budget: None, + } + } +} +pub mod lab_properties { + use super::*; + #[doc = "The status of this lab"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Active, + Deleted, + } +} +#[doc = "Details of a REST API operation, returned from the Resource Provider Operations API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Localized display information for this particular operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Localized display information for this particular operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The short, localized friendly description of the operation; suitable for tool tips and detailed views."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "redeem request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedeemRequest { + #[doc = "redeem code"] + #[serde(rename = "redeemCode")] + pub redeem_code: String, + #[doc = "first name of requester"] + #[serde(rename = "firstName")] + pub first_name: String, + #[doc = "last name of requester"] + #[serde(rename = "lastName")] + pub last_name: String, +} +impl RedeemRequest { + pub fn new(redeem_code: String, first_name: String, last_name: String) -> Self { + Self { + redeem_code, + first_name, + last_name, + } + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Student details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StudentDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Student detail properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl StudentDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Student lab details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StudentLabDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Student lab detail properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl StudentLabDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of labs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StudentLabListResult { + #[doc = "The list of labs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StudentLabListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Student lab detail properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StudentLabProperties { + #[doc = "Student lab Display Name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Detail description of this lab"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Date the lab will expire and by default will be the expiration date for each student in this lab"] + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + #[doc = "Student Role"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub role: Option, + #[doc = "The amount."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub budget: Option, + #[doc = "Subscription Id"] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Student Lab Status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "User Added Date"] + #[serde(rename = "effectiveDate", default, skip_serializing_if = "Option::is_none")] + pub effective_date: Option, + #[doc = "Lab Scope. /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Education/labs/default"] + #[serde(rename = "labScope", default, skip_serializing_if = "Option::is_none")] + pub lab_scope: Option, +} +impl StudentLabProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod student_lab_properties { + use super::*; + #[doc = "Student Role"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Role { + Student, + Admin, + } + #[doc = "Student Lab Status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Active, + Disabled, + Expired, + Pending, + Deleted, + } +} +#[doc = "List of students."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StudentListResult { + #[doc = "The list of students."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link (url) to the next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StudentListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Student detail properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StudentProperties { + #[doc = "First Name"] + #[serde(rename = "firstName")] + pub first_name: String, + #[doc = "Last Name"] + #[serde(rename = "lastName")] + pub last_name: String, + #[doc = "Student Email"] + pub email: String, + #[doc = "Student Role"] + pub role: student_properties::Role, + #[doc = "The amount."] + pub budget: Amount, + #[doc = "Subscription Id"] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Date this student is set to expire from the lab."] + #[serde(rename = "expirationDate")] + pub expiration_date: String, + #[doc = "Student Lab Status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Date student was added to the lab"] + #[serde(rename = "effectiveDate", default, skip_serializing_if = "Option::is_none")] + pub effective_date: Option, + #[doc = "Subscription alias"] + #[serde(rename = "subscriptionAlias", default, skip_serializing_if = "Option::is_none")] + pub subscription_alias: Option, + #[doc = "subscription invite last sent date"] + #[serde(rename = "subscriptionInviteLastSentDate", default, skip_serializing_if = "Option::is_none")] + pub subscription_invite_last_sent_date: Option, +} +impl StudentProperties { + pub fn new( + first_name: String, + last_name: String, + email: String, + role: student_properties::Role, + budget: Amount, + expiration_date: String, + ) -> Self { + Self { + first_name, + last_name, + email, + role, + budget, + subscription_id: None, + expiration_date, + status: None, + effective_date: None, + subscription_alias: None, + subscription_invite_last_sent_date: None, + } + } +} +pub mod student_properties { + use super::*; + #[doc = "Student Role"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Role { + Student, + Admin, + } + #[doc = "Student Lab Status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Active, + Disabled, + Expired, + Pending, + Deleted, + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/education/src/package_2021_12_01_preview/operations.rs b/services/mgmt/education/src/package_2021_12_01_preview/operations.rs new file mode 100644 index 0000000000..695c4a524f --- /dev/null +++ b/services/mgmt/education/src/package_2021_12_01_preview/operations.rs @@ -0,0 +1,2111 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn approve(&self) -> approve::Client { + approve::Client(self.clone()) + } + pub fn create(&self) -> create::Client { + create::Client(self.clone()) + } + pub fn delete(&self) -> delete::Client { + delete::Client(self.clone()) + } + pub fn deny(&self) -> deny::Client { + deny::Client(self.clone()) + } + pub fn generate(&self) -> generate::Client { + generate::Client(self.clone()) + } + pub fn get(&self) -> get::Client { + get::Client(self.clone()) + } + pub fn grant(&self) -> grant::Client { + grant::Client(self.clone()) + } + pub fn grants(&self) -> grants::Client { + grants::Client(self.clone()) + } + pub fn join_request(&self) -> join_request::Client { + join_request::Client(self.clone()) + } + pub fn join_requests(&self) -> join_requests::Client { + join_requests::Client(self.clone()) + } + pub fn lab(&self) -> lab::Client { + lab::Client(self.clone()) + } + pub fn labs(&self) -> labs::Client { + labs::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn redeem(&self) -> redeem::Client { + redeem::Client(self.clone()) + } + pub fn student_labs(&self) -> student_labs::Client { + student_labs::Client(self.clone()) + } + pub fn students(&self) -> students::Client { + students::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Grants_List(#[from] grants::list::Error), + #[error(transparent)] + Grant_List(#[from] grant::list::Error), + #[error(transparent)] + Get_Grant(#[from] get::grant::Error), + #[error(transparent)] + Labs_List(#[from] labs::list::Error), + #[error(transparent)] + Lab_List(#[from] lab::list::Error), + #[error(transparent)] + Get_Lab(#[from] get::lab::Error), + #[error(transparent)] + Create_Lab(#[from] create::lab::Error), + #[error(transparent)] + Delete_Lab(#[from] delete::lab::Error), + #[error(transparent)] + Generate_InviteCode(#[from] generate::invite_code::Error), + #[error(transparent)] + JoinRequests_List(#[from] join_requests::list::Error), + #[error(transparent)] + JoinRequest_Get(#[from] join_request::get::Error), + #[error(transparent)] + Approve_Invite(#[from] approve::invite::Error), + #[error(transparent)] + Deny_Invite(#[from] deny::invite::Error), + #[error(transparent)] + Redeem_Invite(#[from] redeem::invite::Error), + #[error(transparent)] + Students_List(#[from] students::list::Error), + #[error(transparent)] + Get_Student(#[from] get::student::Error), + #[error(transparent)] + Create_Student(#[from] create::student::Error), + #[error(transparent)] + Delete_Student(#[from] delete::student::Error), + #[error(transparent)] + StudentLabs_List(#[from] student_labs::list::Error), + #[error(transparent)] + Get_StudentLab(#[from] get::student_lab::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Education/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod grants { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + include_allocated_budget: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) include_allocated_budget: Option, + } + impl Builder { + pub fn include_allocated_budget(mut self, include_allocated_budget: bool) -> Self { + self.include_allocated_budget = Some(include_allocated_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Education/grants", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_allocated_budget) = &self.include_allocated_budget { + url.query_pairs_mut() + .append_pair("includeAllocatedBudget", &include_allocated_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GrantListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod grant { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, billing_account_name: impl Into, billing_profile_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + include_allocated_budget: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) include_allocated_budget: Option, + } + impl Builder { + pub fn include_allocated_budget(mut self, include_allocated_budget: bool) -> Self { + self.include_allocated_budget = Some(include_allocated_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/providers/Microsoft.Education/grants", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_allocated_budget) = &self.include_allocated_budget { + url.query_pairs_mut() + .append_pair("includeAllocatedBudget", &include_allocated_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GrantListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod get { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn grant(&self, billing_account_name: impl Into, billing_profile_name: impl Into) -> grant::Builder { + grant::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + include_allocated_budget: None, + } + } + pub fn lab( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + ) -> lab::Builder { + lab::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + include_budget: None, + } + } + pub fn student( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + student_alias: impl Into, + ) -> student::Builder { + student::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + student_alias: student_alias.into(), + } + } + pub fn student_lab(&self, student_lab_name: impl Into) -> student_lab::Builder { + student_lab::Builder { + client: self.0.clone(), + student_lab_name: student_lab_name.into(), + } + } + } + pub mod grant { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) include_allocated_budget: Option, + } + impl Builder { + pub fn include_allocated_budget(mut self, include_allocated_budget: bool) -> Self { + self.include_allocated_budget = Some(include_allocated_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/providers/Microsoft.Education/grants/default", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_allocated_budget) = &self.include_allocated_budget { + url.query_pairs_mut() + .append_pair("includeAllocatedBudget", &include_allocated_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GrantDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod lab { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) include_budget: Option, + } + impl Builder { + pub fn include_budget(mut self, include_budget: bool) -> Self { + self.include_budget = Some(include_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_budget) = &self.include_budget { + url.query_pairs_mut().append_pair("includeBudget", &include_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod student { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) student_alias: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/students/{}" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . student_alias) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod student_lab { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) student_lab_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Education/studentLabs/{}", + self.client.endpoint(), + &self.student_lab_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentLabDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod labs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, billing_account_name: impl Into, billing_profile_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + include_budget: None, + include_deleted: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) include_budget: Option, + pub(crate) include_deleted: Option, + } + impl Builder { + pub fn include_budget(mut self, include_budget: bool) -> Self { + self.include_budget = Some(include_budget); + self + } + pub fn include_deleted(mut self, include_deleted: bool) -> Self { + self.include_deleted = Some(include_deleted); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/providers/Microsoft.Education/labs", + self.client.endpoint(), + &self.billing_account_name, + &self.billing_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_budget) = &self.include_budget { + url.query_pairs_mut().append_pair("includeBudget", &include_budget.to_string()); + } + if let Some(include_deleted) = &self.include_deleted { + url.query_pairs_mut().append_pair("includeDeleted", &include_deleted.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod lab { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + include_budget: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) include_budget: Option, + } + impl Builder { + pub fn include_budget(mut self, include_budget: bool) -> Self { + self.include_budget = Some(include_budget); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_budget) = &self.include_budget { + url.query_pairs_mut().append_pair("includeBudget", &include_budget.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod create { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn lab( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + parameters: impl Into, + ) -> lab::Builder { + lab::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + parameters: parameters.into(), + } + } + pub fn student( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + student_alias: impl Into, + parameters: impl Into, + ) -> student::Builder { + student::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + student_alias: student_alias.into(), + parameters: parameters.into(), + } + } + } + pub mod lab { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LabDetails), + Ok200(models::LabDetails), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) parameters: models::LabDetails, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod student { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::StudentDetails), + Ok200(models::StudentDetails), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) student_alias: String, + pub(crate) parameters: models::StudentDetails, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/students/{}" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . student_alias) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod delete { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn lab( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + ) -> lab::Builder { + lab::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + } + } + pub fn student( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + student_alias: impl Into, + ) -> student::Builder { + student::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + student_alias: student_alias.into(), + } + } + } + pub mod lab { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod student { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) student_alias: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/students/{}" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . student_alias) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod generate { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn invite_code( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + parameters: impl Into, + ) -> invite_code::Builder { + invite_code::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + parameters: parameters.into(), + only_update_student_count_parameter: None, + } + } + } + pub mod invite_code { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) parameters: models::InviteCodeGenerateRequest, + pub(crate) only_update_student_count_parameter: Option, + } + impl Builder { + pub fn only_update_student_count_parameter(mut self, only_update_student_count_parameter: bool) -> Self { + self.only_update_student_count_parameter = Some(only_update_student_count_parameter); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/generateInviteCode" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(only_update_student_count_parameter) = &self.only_update_student_count_parameter { + url.query_pairs_mut() + .append_pair("onlyUpdateStudentCountParameter", &only_update_student_count_parameter.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LabDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod join_requests { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + include_denied: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) include_denied: Option, + } + impl Builder { + pub fn include_denied(mut self, include_denied: bool) -> Self { + self.include_denied = Some(include_denied); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/joinRequests" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_denied) = &self.include_denied { + url.query_pairs_mut().append_pair("includeDenied", &include_denied.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JoinRequestList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod join_request { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + join_request_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + join_request_name: join_request_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) join_request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/joinRequests/{}" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . join_request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JoinRequestDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod approve { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn invite( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + join_request_name: impl Into, + ) -> invite::Builder { + invite::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + join_request_name: join_request_name.into(), + } + } + } + pub mod invite { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) join_request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/joinRequests/{}/approve" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . join_request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod deny { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn invite( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + join_request_name: impl Into, + ) -> invite::Builder { + invite::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + join_request_name: join_request_name.into(), + } + } + } + pub mod invite { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) join_request_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/joinRequests/{}/deny" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name , & self . join_request_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod redeem { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn invite(&self, parameters: impl Into) -> invite::Builder { + invite::Builder { + client: self.0.clone(), + parameters: parameters.into(), + } + } + } + pub mod invite { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::RedeemRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Education/redeemInvitationCode", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod students { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + billing_account_name: impl Into, + billing_profile_name: impl Into, + invoice_section_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + billing_account_name: billing_account_name.into(), + billing_profile_name: billing_profile_name.into(), + invoice_section_name: invoice_section_name.into(), + include_deleted: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) billing_account_name: String, + pub(crate) billing_profile_name: String, + pub(crate) invoice_section_name: String, + pub(crate) include_deleted: Option, + } + impl Builder { + pub fn include_deleted(mut self, include_deleted: bool) -> Self { + self.include_deleted = Some(include_deleted); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/providers/Microsoft.Billing/billingAccounts/{}/billingProfiles/{}/invoiceSections/{}/providers/Microsoft.Education/labs/default/students" , self . client . endpoint () , & self . billing_account_name , & self . billing_profile_name , & self . invoice_section_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + if let Some(include_deleted) = &self.include_deleted { + url.query_pairs_mut().append_pair("includeDeleted", &include_deleted.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod student_labs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseBody, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Education/studentLabs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StudentLabListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseBody = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/elastic/Cargo.toml b/services/mgmt/elastic/Cargo.toml index bc2e6bb47f..076ae9f104 100644 --- a/services/mgmt/elastic/Cargo.toml +++ b/services/mgmt/elastic/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_elastic" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/elasticsan/Cargo.toml b/services/mgmt/elasticsan/Cargo.toml new file mode 100644 index 0000000000..2b1bc0aca3 --- /dev/null +++ b/services/mgmt/elasticsan/Cargo.toml @@ -0,0 +1,34 @@ +# generated by AutoRust +[package] +name = "azure_mgmt_elasticsan" +version = "0.3.0" +edition = "2021" +license = "MIT" +description = "generated REST API bindings" +repository = "https://github.com/azure/azure-sdk-for-rust" +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_mgmt_elasticsan" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.2", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1" } +tokio = { version = "1.0", features = ["macros"] } + +[package.metadata.docs.rs] +features = ["no-default-tag"] + +[features] +default = ["package-2021-11-20-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-tag = [] +"package-2021-11-20-preview" = [] diff --git a/services/mgmt/elasticsan/README.md b/services/mgmt/elasticsan/README.md new file mode 100644 index 0000000000..25c25979ca --- /dev/null +++ b/services/mgmt/elasticsan/README.md @@ -0,0 +1,13 @@ +# azure_mgmt_elasticsan crate + +This is a generated [Azure SDK for Rust](https://github.com/Azure/azure-sdk-for-rust) crate from the Azure REST API specifications listed in: + +https://github.com/Azure/azure-rest-api-specs/blob/main/specification/elasticsan/resource-manager/readme.md + +To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). + +The default tag is `package-2021-11-20-preview`. + +The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: + +- `package-2021-11-20-preview` has 18 operations from 1 API versions: `2021-11-20-preview`. Use crate feature `package-2021-11-20-preview` to enable. The operations will be in the `package_2021_11_20_preview` module. \ No newline at end of file diff --git a/services/mgmt/elasticsan/src/lib.rs b/services/mgmt/elasticsan/src/lib.rs new file mode 100644 index 0000000000..82b6584242 --- /dev/null +++ b/services/mgmt/elasticsan/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust"] +#[cfg(feature = "package-2021-11-20-preview")] +pub mod package_2021_11_20_preview; +#[cfg(all(feature = "package-2021-11-20-preview", not(feature = "no-default-tag")))] +pub use package_2021_11_20_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/elasticsan/src/package_2021_11_20_preview/mod.rs b/services/mgmt/elasticsan/src/package_2021_11_20_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/elasticsan/src/package_2021_11_20_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/elasticsan/src/package_2021_11_20_preview/models.rs b/services/mgmt/elasticsan/src/package_2021_11_20_preview/models.rs new file mode 100644 index 0000000000..2930a2c8b0 --- /dev/null +++ b/services/mgmt/elasticsan/src/package_2021_11_20_preview/models.rs @@ -0,0 +1,807 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +pub type AvailabilityZone = String; +#[doc = "Response for ElasticSan request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ElasticSan { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Elastic San response properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl ElasticSan { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Elastic Sans"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanList { + #[doc = "An array of Elastic San objects."] + pub value: Vec, + #[doc = "URI to fetch the next section of the paginated response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ElasticSanList { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Metadata about an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanOperationDisplay { + #[doc = "Localized friendly form of the resource provider name."] + pub provider: String, + #[doc = "Localized friendly form of the resource type related to this action/operation."] + pub resource: String, + #[doc = "Localized friendly name for the operation, as it should be shown to the user."] + pub operation: String, + #[doc = "Localized friendly description for the operation, as it should be shown to the user."] + pub description: String, +} +impl ElasticSanOperationDisplay { + pub fn new(provider: String, resource: String, operation: String, description: String) -> Self { + Self { + provider, + resource, + operation, + description, + } + } +} +#[doc = "List of operations supported by the RP."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanOperationListResult { + #[doc = "An array of operations supported by the ElasticSan RP."] + pub value: Vec, + #[doc = "URI to fetch the next section of the paginated response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ElasticSanOperationListResult { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Elastic San response properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanProperties { + #[doc = "The SKU name. Required for account creation; optional for update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Logical zone for Elastic San resource; example: [\"1\"]."] + #[serde(rename = "availabilityZones")] + pub availability_zones: Vec, + #[doc = "Provisioning state of the iSCSI Target."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Base size of the Elastic San appliance in TiB."] + #[serde(rename = "baseSizeTiB")] + pub base_size_ti_b: i64, + #[doc = "Extended size of the Elastic San appliance in TiB."] + #[serde(rename = "extendedCapacitySizeTiB")] + pub extended_capacity_size_ti_b: i64, + #[doc = "Total size of the provisioned Volumes in GiB."] + #[serde(rename = "totalVolumeSizeGiB", default, skip_serializing_if = "Option::is_none")] + pub total_volume_size_gi_b: Option, + #[doc = "Total number of volume groups in this Elastic San appliance."] + #[serde(rename = "volumeGroupCount", default, skip_serializing_if = "Option::is_none")] + pub volume_group_count: Option, + #[doc = "Total Provisioned IOPS of the Elastic San appliance."] + #[serde(rename = "totalIops", default, skip_serializing_if = "Option::is_none")] + pub total_iops: Option, + #[doc = "Total Provisioned MBps Elastic San appliance."] + #[serde(rename = "totalMBps", default, skip_serializing_if = "Option::is_none")] + pub total_m_bps: Option, + #[doc = "Provisioned MBps Elastic San appliance."] + #[serde(rename = "provisionedMBps", default, skip_serializing_if = "Option::is_none")] + pub provisioned_m_bps: Option, +} +impl ElasticSanProperties { + pub fn new(availability_zones: Vec, base_size_ti_b: i64, extended_capacity_size_ti_b: i64) -> Self { + Self { + sku: None, + availability_zones, + provisioning_state: None, + base_size_ti_b, + extended_capacity_size_ti_b, + total_volume_size_gi_b: None, + volume_group_count: None, + total_iops: None, + total_m_bps: None, + provisioned_m_bps: None, + } + } +} +#[doc = "Description of a ElasticSan RP Operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanRpOperation { + #[doc = "The name of the operation being performed on this particular object"] + pub name: String, + #[doc = "Indicates whether the operation applies to data-plane."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Metadata about an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl ElasticSanRpOperation { + pub fn new(name: String) -> Self { + Self { + name, + is_data_action: None, + display: None, + } + } +} +#[doc = "Response for ElasticSan update request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ElasticSanUpdate { + #[doc = "Elastic San update properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Update tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ElasticSanUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Elastic San update properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ElasticSanUpdateProperties { + #[doc = "Base size of the Elastic San appliance in TiB."] + #[serde(rename = "baseSizeTiB")] + pub base_size_ti_b: i64, + #[doc = "Extended size of the Elastic San appliance in TiB."] + #[serde(rename = "extendedCapacitySizeTiB")] + pub extended_capacity_size_ti_b: i64, +} +impl ElasticSanUpdateProperties { + pub fn new(base_size_ti_b: i64, extended_capacity_size_ti_b: i64) -> Self { + Self { + base_size_ti_b, + extended_capacity_size_ti_b, + } + } +} +#[doc = "The type of key used to encrypt the data of the disk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EncryptionType { + EncryptionAtRestWithPlatformKey, + EncryptionAtRestWithCustomerKey, + EncryptionAtRestWithPlatformAndCustomerKeys, +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Iscsi target information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IscsiTargetInfo { + #[doc = "iSCSI Target IQN (iSCSI Qualified Name); example: \"iqn.2005-03.org.iscsi:server\"."] + #[serde(rename = "targetIqn", default, skip_serializing_if = "Option::is_none")] + pub target_iqn: Option, + #[doc = "iSCSI Target Portal Host Name"] + #[serde(rename = "targetPortalHostname", default, skip_serializing_if = "Option::is_none")] + pub target_portal_hostname: Option, + #[doc = "iSCSI Target Portal Port"] + #[serde(rename = "targetPortalPort", default, skip_serializing_if = "Option::is_none")] + pub target_portal_port: Option, + #[doc = "Provisioning state of the iSCSI Target."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Operational status of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl IscsiTargetInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A set of rules governing the network accessibility."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkRuleSet { + #[doc = "The list of virtual network rules."] + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, +} +impl NetworkRuleSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operational status of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperationalStatus { + Invalid, + Unknown, + Healthy, + Unhealthy, + Updating, + Running, + Stopped, + #[serde(rename = "Stopped (deallocated)")] + StoppedDeallocated, +} +#[doc = "Provisioning state of the iSCSI Target."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Invalid, + Succeeded, + Failed, + Canceled, + Pending, + Creating, + Updating, + Deleting, +} +#[doc = "The resource model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Azure resource identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Azure resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Azure resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Azure resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SkuInformation object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceTypeSku { + #[doc = "The SKU name. Required for account creation; optional for update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Availability of the SKU for the location/zone"] + #[serde(rename = "locationInfo", default, skip_serializing_if = "Vec::is_empty")] + pub location_info: Vec, + #[doc = "San scalability target"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub san: Option, + #[doc = "Volume Group scalability target"] + #[serde(rename = "volumeGroup", default, skip_serializing_if = "Option::is_none")] + pub volume_group: Option, + #[doc = "Volume scalability target"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub volume: Option, +} +impl ResourceTypeSku { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "San scalability target"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SanTierInfo { + #[doc = "Maximum San account capacity in TiB"] + #[serde(rename = "maxSizeTiB", default, skip_serializing_if = "Option::is_none")] + pub max_size_ti_b: Option, + #[doc = "Minimum San account capacity in TiB"] + #[serde(rename = "minSizeTiB", default, skip_serializing_if = "Option::is_none")] + pub min_size_ti_b: Option, + #[doc = "Increment the San capacity in TiB"] + #[serde(rename = "minIncrementSizeTiB", default, skip_serializing_if = "Option::is_none")] + pub min_increment_size_ti_b: Option, + #[doc = "Maximum IOPS per BaseTiB"] + #[serde(rename = "iopsPerBaseTiB", default, skip_serializing_if = "Option::is_none")] + pub iops_per_base_ti_b: Option, + #[doc = "Maximum MBps per BaseTiB"] + #[serde(rename = "mbpsPerBaseTiB", default, skip_serializing_if = "Option::is_none")] + pub mbps_per_base_ti_b: Option, + #[doc = "Maximum IOPS"] + #[serde(rename = "maxIops", default, skip_serializing_if = "Option::is_none")] + pub max_iops: Option, + #[doc = "Maximum MBps"] + #[serde(rename = "maxMBps", default, skip_serializing_if = "Option::is_none")] + pub max_m_bps: Option, + #[doc = "Maximum number of volume groups per San account"] + #[serde(rename = "maxVolumeGroupCount", default, skip_serializing_if = "Option::is_none")] + pub max_volume_group_count: Option, +} +impl SanTierInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The SKU name. Required for account creation; optional for update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Sku { + #[doc = "The sku name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The sku tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl Sku { + pub fn new() -> Self { + Self::default() + } +} +pub mod sku { + use super::*; + #[doc = "The sku name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "Standard_ZRS")] + StandardZrs, + } + #[doc = "The sku tier."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + } +} +#[doc = "List of SKU Information objects"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuInformationList { + #[doc = "List of ResourceType Sku"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Links to the next set of results"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SkuInformationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuLocationInfo { + #[doc = "The location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "The zones."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl SkuLocationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Data used when creating a disk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceCreationData { + #[doc = "This enumerates the possible sources of a volume creation."] + #[serde(rename = "createSource")] + pub create_source: source_creation_data::CreateSource, + #[doc = "If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point."] + #[serde(rename = "sourceUri", default, skip_serializing_if = "Option::is_none")] + pub source_uri: Option, +} +impl SourceCreationData { + pub fn new(create_source: source_creation_data::CreateSource) -> Self { + Self { + create_source, + source_uri: None, + } + } +} +pub mod source_creation_data { + use super::*; + #[doc = "This enumerates the possible sources of a volume creation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateSource { + None, + FromVolume, + FromDiskSnapshot, + Export, + } +} +#[doc = "Storage Target type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum StorageTargetType { + Iscsi, + None, +} +#[doc = "Data used when creating a disk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetCreationData { + #[doc = "Target location for the source to be copied or exported"] + #[serde(rename = "targetUri")] + pub target_uri: String, +} +impl TargetCreationData { + pub fn new(target_uri: String) -> Self { + Self { target_uri } + } +} +#[doc = "The resource model definition for a ARM tracked top level resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The geo-location where the resource lives."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl TrackedResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Network rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkRule { + #[doc = "Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}."] + pub id: String, + #[doc = "The action of virtual network rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "Gets the state of virtual network rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl VirtualNetworkRule { + pub fn new(id: String) -> Self { + Self { + id, + action: None, + state: None, + } + } +} +pub mod virtual_network_rule { + use super::*; + #[doc = "The action of virtual network rule."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Allow, + } + impl Default for Action { + fn default() -> Self { + Self::Allow + } + } + #[doc = "Gets the state of virtual network rule."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "provisioning")] + Provisioning, + #[serde(rename = "deprovisioning")] + Deprovisioning, + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "networkSourceDeleted")] + NetworkSourceDeleted, + } +} +#[doc = "Response for Volume request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Volume { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Volume response properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Volume { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for Volume Group request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeGroup { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "VolumeGroup response properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl VolumeGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Volume Groups"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupList { + #[doc = "An array of Volume Groups objects."] + pub value: Vec, + #[doc = "URI to fetch the next section of the paginated response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VolumeGroupList { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "VolumeGroup response properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupProperties { + #[doc = "Provisioning state of the iSCSI Target."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Storage Target type."] + #[serde(rename = "protocolType")] + pub protocol_type: StorageTargetType, + #[doc = "The type of key used to encrypt the data of the disk."] + pub encryption: EncryptionType, + #[doc = "A set of rules governing the network accessibility."] + #[serde(rename = "networkAcls", default, skip_serializing_if = "Option::is_none")] + pub network_acls: Option, +} +impl VolumeGroupProperties { + pub fn new(protocol_type: StorageTargetType, encryption: EncryptionType) -> Self { + Self { + provisioning_state: None, + protocol_type, + encryption, + network_acls: None, + } + } +} +#[doc = "Volume Group scalability target"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeGroupTierInfo { + #[doc = "Maximum number of Volumes per Volume Groups per San account"] + #[serde(rename = "maxVolumeCount", default, skip_serializing_if = "Option::is_none")] + pub max_volume_count: Option, +} +impl VolumeGroupTierInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Volume Group request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeGroupUpdate { + #[doc = "VolumeGroup response properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl VolumeGroupUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VolumeGroup response properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeGroupUpdateProperties { + #[doc = "Storage Target type."] + #[serde(rename = "protocolType")] + pub protocol_type: StorageTargetType, + #[doc = "The type of key used to encrypt the data of the disk."] + pub encryption: EncryptionType, + #[doc = "A set of rules governing the network accessibility."] + #[serde(rename = "networkAcls", default, skip_serializing_if = "Option::is_none")] + pub network_acls: Option, +} +impl VolumeGroupUpdateProperties { + pub fn new(protocol_type: StorageTargetType, encryption: EncryptionType) -> Self { + Self { + protocol_type, + encryption, + network_acls: None, + } + } +} +#[doc = "List of Volumes"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VolumeList { + #[doc = "An array of Volume objects."] + pub value: Vec, + #[doc = "URI to fetch the next section of the paginated response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VolumeList { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Volume response properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeProperties { + #[doc = "Unique Id of the volume in GUID format"] + #[serde(rename = "volumeId", default, skip_serializing_if = "Option::is_none")] + pub volume_id: Option, + #[doc = "Data used when creating a disk."] + #[serde(rename = "creationData", default, skip_serializing_if = "Option::is_none")] + pub creation_data: Option, + #[doc = "Volume size."] + #[serde(rename = "sizeGiB", default, skip_serializing_if = "Option::is_none")] + pub size_gi_b: Option, + #[doc = "Iscsi target information"] + #[serde(rename = "storageTarget", default, skip_serializing_if = "Option::is_none")] + pub storage_target: Option, +} +impl VolumeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Volume scalability target"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeTierInfo { + #[doc = "Maximum volume capacity in GiB"] + #[serde(rename = "maxSizeGiB", default, skip_serializing_if = "Option::is_none")] + pub max_size_gi_b: Option, + #[doc = "Minimum volume capacity in GiB"] + #[serde(rename = "minSizeGiB", default, skip_serializing_if = "Option::is_none")] + pub min_size_gi_b: Option, + #[doc = "Increment volume capacity in GiB"] + #[serde(rename = "minIncrementSizeGiB", default, skip_serializing_if = "Option::is_none")] + pub min_increment_size_gi_b: Option, + #[doc = "Maximum IOPS per GiB"] + #[serde(rename = "maxIopsPerGiB", default, skip_serializing_if = "Option::is_none")] + pub max_iops_per_gi_b: Option, + #[doc = "Maximum MBps"] + #[serde(rename = "maxMBpsPerGiB", default, skip_serializing_if = "Option::is_none")] + pub max_m_bps_per_gi_b: Option, + #[doc = "Maximum IOPS"] + #[serde(rename = "maxIops", default, skip_serializing_if = "Option::is_none")] + pub max_iops: Option, + #[doc = "Maximum MBps"] + #[serde(rename = "maxMBps", default, skip_serializing_if = "Option::is_none")] + pub max_m_bps: Option, + #[doc = "Maximum number of connected clients count per Volume"] + #[serde(rename = "maxConnectedClientCount", default, skip_serializing_if = "Option::is_none")] + pub max_connected_client_count: Option, +} +impl VolumeTierInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for Volume request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeUpdate { + #[doc = "Volume response properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl VolumeUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Volume response properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VolumeUpdateProperties { + #[doc = "Volume size."] + #[serde(rename = "sizeGiB", default, skip_serializing_if = "Option::is_none")] + pub size_gi_b: Option, +} +impl VolumeUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/elasticsan/src/package_2021_11_20_preview/operations.rs b/services/mgmt/elasticsan/src/package_2021_11_20_preview/operations.rs new file mode 100644 index 0000000000..074231b58c --- /dev/null +++ b/services/mgmt/elasticsan/src/package_2021_11_20_preview/operations.rs @@ -0,0 +1,1898 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn elastic_sans(&self) -> elastic_sans::Client { + elastic_sans::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn skus(&self) -> skus::Client { + skus::Client(self.clone()) + } + pub fn volume_groups(&self) -> volume_groups::Client { + volume_groups::Client(self.clone()) + } + pub fn volumes(&self) -> volumes::Client { + volumes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Skus_List(#[from] skus::list::Error), + #[error(transparent)] + ElasticSans_ListBySubscription(#[from] elastic_sans::list_by_subscription::Error), + #[error(transparent)] + ElasticSans_ListByResourceGroup(#[from] elastic_sans::list_by_resource_group::Error), + #[error(transparent)] + ElasticSans_Get(#[from] elastic_sans::get::Error), + #[error(transparent)] + ElasticSans_Create(#[from] elastic_sans::create::Error), + #[error(transparent)] + ElasticSans_Update(#[from] elastic_sans::update::Error), + #[error(transparent)] + ElasticSans_Delete(#[from] elastic_sans::delete::Error), + #[error(transparent)] + VolumeGroups_ListByElasticSan(#[from] volume_groups::list_by_elastic_san::Error), + #[error(transparent)] + VolumeGroups_Get(#[from] volume_groups::get::Error), + #[error(transparent)] + VolumeGroups_Create(#[from] volume_groups::create::Error), + #[error(transparent)] + VolumeGroups_Update(#[from] volume_groups::update::Error), + #[error(transparent)] + VolumeGroups_Delete(#[from] volume_groups::delete::Error), + #[error(transparent)] + Volumes_Get(#[from] volumes::get::Error), + #[error(transparent)] + Volumes_Create(#[from] volumes::create::Error), + #[error(transparent)] + Volumes_Update(#[from] volumes::update::Error), + #[error(transparent)] + Volumes_Delete(#[from] volumes::delete::Error), + #[error(transparent)] + Volumes_ListByVolumeGroup(#[from] volumes::list_by_volume_group::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ElasticSan/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSanOperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "List all the available Skus in the region and information related to them"] + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + filter: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ElasticSan/skus", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SkuInformationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod elastic_sans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + x_ms_delete_volumegroups: None, + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ElasticSan/elasticSans", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSanList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSanList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ElasticSan), + Accepted202(models::ElasticSan), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) parameters: models::ElasticSan, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ElasticSan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) parameters: models::ElasticSanUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ElasticSan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) x_ms_delete_volumegroups: Option, + } + impl Builder { + pub fn x_ms_delete_volumegroups(mut self, x_ms_delete_volumegroups: bool) -> Self { + self.x_ms_delete_volumegroups = Some(x_ms_delete_volumegroups); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + if let Some(x_ms_delete_volumegroups) = &self.x_ms_delete_volumegroups { + req_builder = req_builder.header("x-ms-delete-volumegroups", &x_ms_delete_volumegroups.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod volume_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_elastic_san( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + ) -> list_by_elastic_san::Builder { + list_by_elastic_san::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + x_ms_delete_volumes: None, + } + } + } + pub mod list_by_elastic_san { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumeGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroupList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VolumeGroup), + Accepted202(models::VolumeGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) parameters: models::VolumeGroup, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VolumeGroup), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) parameters: models::VolumeGroupUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) x_ms_delete_volumes: Option, + } + impl Builder { + pub fn x_ms_delete_volumes(mut self, x_ms_delete_volumes: bool) -> Self { + self.x_ms_delete_volumes = Some(x_ms_delete_volumes); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + if let Some(x_ms_delete_volumes) = &self.x_ms_delete_volumes { + req_builder = req_builder.header("x-ms-delete-volumes", &x_ms_delete_volumes.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod volumes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + volume_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + volume_name: volume_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + volume_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + volume_name: volume_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + volume_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + volume_name: volume_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + volume_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + volume_name: volume_name.into(), + } + } + pub fn list_by_volume_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + elastic_san_name: impl Into, + volume_group_name: impl Into, + ) -> list_by_volume_group::Builder { + list_by_volume_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + elastic_san_name: elastic_san_name.into(), + volume_group_name: volume_group_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Volume), + Accepted202(models::Volume), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) volume_name: String, + pub(crate) parameters: models::Volume, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Volume), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) volume_name: String, + pub(crate) parameters: models::VolumeUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Volume = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + pub(crate) volume_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}/volumes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name, + &self.volume_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_volume_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) elastic_san_name: String, + pub(crate) volume_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ElasticSan/elasticSans/{}/volumegroups/{}/volumes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.elastic_san_name, + &self.volume_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-20-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VolumeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/engagementfabric/Cargo.toml b/services/mgmt/engagementfabric/Cargo.toml index 5801ff47bc..c8bf166ffd 100644 --- a/services/mgmt/engagementfabric/Cargo.toml +++ b/services/mgmt/engagementfabric/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_engagementfabric" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/enterpriseknowledgegraph/Cargo.toml b/services/mgmt/enterpriseknowledgegraph/Cargo.toml index 4fb59814fe..d3c91f1880 100644 --- a/services/mgmt/enterpriseknowledgegraph/Cargo.toml +++ b/services/mgmt/enterpriseknowledgegraph/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_enterpriseknowledgegraph" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/eventgrid/Cargo.toml b/services/mgmt/eventgrid/Cargo.toml index 18c7a25d85..7a804dced0 100644 --- a/services/mgmt/eventgrid/Cargo.toml +++ b/services/mgmt/eventgrid/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_eventgrid" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/eventhub/Cargo.toml b/services/mgmt/eventhub/Cargo.toml index 82e9669bb9..4c001db925 100644 --- a/services/mgmt/eventhub/Cargo.toml +++ b/services/mgmt/eventhub/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_eventhub" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/extendedlocation/Cargo.toml b/services/mgmt/extendedlocation/Cargo.toml index 9bb469fccc..00ad1bbf9a 100644 --- a/services/mgmt/extendedlocation/Cargo.toml +++ b/services/mgmt/extendedlocation/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_extendedlocation" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/fluidrelay/Cargo.toml b/services/mgmt/fluidrelay/Cargo.toml index dea3a9445c..d761dd4694 100644 --- a/services/mgmt/fluidrelay/Cargo.toml +++ b/services/mgmt/fluidrelay/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_fluidrelay" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/frontdoor/Cargo.toml b/services/mgmt/frontdoor/Cargo.toml index 117553d4c7..31112dac4a 100644 --- a/services/mgmt/frontdoor/Cargo.toml +++ b/services/mgmt/frontdoor/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_frontdoor" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/guestconfiguration/Cargo.toml b/services/mgmt/guestconfiguration/Cargo.toml index c17dc00baf..2de0b2a91e 100644 --- a/services/mgmt/guestconfiguration/Cargo.toml +++ b/services/mgmt/guestconfiguration/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_guestconfiguration" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/hanaon/Cargo.toml b/services/mgmt/hanaon/Cargo.toml index e4b47ec1dc..6c7d47b36f 100644 --- a/services/mgmt/hanaon/Cargo.toml +++ b/services/mgmt/hanaon/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hanaon" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/hardwaresecuritymodules/Cargo.toml b/services/mgmt/hardwaresecuritymodules/Cargo.toml index 1561bb69dc..1d36ea18a6 100644 --- a/services/mgmt/hardwaresecuritymodules/Cargo.toml +++ b/services/mgmt/hardwaresecuritymodules/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hardwaresecuritymodules" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/hdinsight/Cargo.toml b/services/mgmt/hdinsight/Cargo.toml index aae3f416b1..7d2a4adfbe 100644 --- a/services/mgmt/hdinsight/Cargo.toml +++ b/services/mgmt/hdinsight/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hdinsight" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/healthbot/Cargo.toml b/services/mgmt/healthbot/Cargo.toml index 417ea06506..6ce3164502 100644 --- a/services/mgmt/healthbot/Cargo.toml +++ b/services/mgmt/healthbot/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_healthbot" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/healthcareapis/Cargo.toml b/services/mgmt/healthcareapis/Cargo.toml index 30e62d4b80..b43bc94c34 100644 --- a/services/mgmt/healthcareapis/Cargo.toml +++ b/services/mgmt/healthcareapis/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_healthcareapis" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2021-06", "package-2021-01", "package-2020-03-30", "package-2020-03"] +features = ["no-default-tag", "package-2021-11", "package-preview-2021-06", "package-2021-01", "package-2020-03-30"] [features] -default = ["package-2021-11", "enable_reqwest"] +default = ["package-preview-2022-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-preview-2022-01" = [] "package-2021-11" = [] "package-preview-2021-06" = [] "package-2021-01" = [] diff --git a/services/mgmt/healthcareapis/README.md b/services/mgmt/healthcareapis/README.md index 1d1d6c4e64..0c84c95d8a 100644 --- a/services/mgmt/healthcareapis/README.md +++ b/services/mgmt/healthcareapis/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/healthcare To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2021-11`. +The default tag is `package-preview-2022-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-preview-2022-01` has 46 operations from 1 API versions: `2022-01-31-preview`. Use crate feature `package-preview-2022-01` to enable. The operations will be in the `package_preview_2022_01` module. - `package-2021-11` has 46 operations from 1 API versions: `2021-11-01`. Use crate feature `package-2021-11` to enable. The operations will be in the `package_2021_11` module. - `package-preview-2021-06` has 40 operations from 1 API versions: `2021-06-01-preview`. Use crate feature `package-preview-2021-06` to enable. The operations will be in the `package_preview_2021_06` module. - `package-2021-01` has 15 operations from 1 API versions: `2021-01-11`. Use crate feature `package-2021-01` to enable. The operations will be in the `package_2021_01` module. diff --git a/services/mgmt/healthcareapis/src/lib.rs b/services/mgmt/healthcareapis/src/lib.rs index 11a7fd8c8f..4dbe660c26 100644 --- a/services/mgmt/healthcareapis/src/lib.rs +++ b/services/mgmt/healthcareapis/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-preview-2022-01")] +pub mod package_preview_2022_01; +#[cfg(all(feature = "package-preview-2022-01", not(feature = "no-default-tag")))] +pub use package_preview_2022_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-11")] pub mod package_2021_11; #[cfg(all(feature = "package-2021-11", not(feature = "no-default-tag")))] diff --git a/services/mgmt/healthcareapis/src/package_preview_2022_01/mod.rs b/services/mgmt/healthcareapis/src/package_preview_2022_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/healthcareapis/src/package_preview_2022_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/healthcareapis/src/package_preview_2022_01/models.rs b/services/mgmt/healthcareapis/src/package_preview_2022_01/models.rs new file mode 100644 index 0000000000..cbc04d22a5 --- /dev/null +++ b/services/mgmt/healthcareapis/src/package_preview_2022_01/models.rs @@ -0,0 +1,1604 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Input values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailabilityParameters { + #[doc = "The name of the service instance to check."] + pub name: String, + #[doc = "The fully qualified resource type which includes provider namespace."] + #[serde(rename = "type")] + pub type_: String, +} +impl CheckNameAvailabilityParameters { + pub fn new(name: String, type_: String) -> Self { + Self { name, type_ } + } +} +pub type CorsConfigurationHeaderEntry = String; +pub type CorsConfigurationMethodEntry = String; +pub type CorsConfigurationOriginEntry = String; +pub type DicomAudience = String; +#[doc = "The description of Dicom Service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DicomService { + #[serde(flatten)] + pub tagged_resource: TaggedResource, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, + #[doc = "Dicom Service properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl DicomService { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authentication configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DicomServiceAuthenticationConfiguration { + #[doc = "The authority url for the service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[doc = "The audiences for the service"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub audiences: Vec, +} +impl DicomServiceAuthenticationConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The collection of Dicom Services."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DicomServiceCollection { + #[doc = "The link used to get the next page of Dicom Services."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of Dicom Services."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl DicomServiceCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dicom Service patch properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DicomServicePatchResource { + #[serde(flatten)] + pub resource_tags: ResourceTags, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, +} +impl DicomServicePatchResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dicom Service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DicomServiceProperties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Authentication configuration information"] + #[serde(rename = "authenticationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub authentication_configuration: Option, + #[doc = "The url of the Dicom Services."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "The list of private endpoint connections that are set up for this resource."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +impl DicomServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "Error details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetails { + #[doc = "Error details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetailsInternal { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl ErrorDetailsInternal { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Controls how resources are versioned on the FHIR service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FhirResourceVersionPolicy { + #[serde(rename = "no-version")] + NoVersion, + #[serde(rename = "versioned")] + Versioned, + #[serde(rename = "versioned-update")] + VersionedUpdate, +} +#[doc = "The description of Fhir Service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirService { + #[serde(flatten)] + pub tagged_resource: TaggedResource, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, + #[doc = "The kind of the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Fhir Service properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl FhirService { + pub fn new() -> Self { + Self::default() + } +} +pub mod fhir_service { + use super::*; + #[doc = "The kind of the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "fhir-Stu3")] + FhirStu3, + #[serde(rename = "fhir-R4")] + FhirR4, + } +} +pub type FhirServiceAccessPolicies = Vec; +#[doc = "An access policy entry."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FhirServiceAccessPolicyEntry { + #[doc = "An Azure AD object ID (User or Apps) that is allowed access to the FHIR service."] + #[serde(rename = "objectId")] + pub object_id: String, +} +impl FhirServiceAccessPolicyEntry { + pub fn new(object_id: String) -> Self { + Self { object_id } + } +} +#[doc = "Azure container registry configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceAcrConfiguration { + #[doc = "The list of the Azure container registry login servers."] + #[serde(rename = "loginServers", default, skip_serializing_if = "Vec::is_empty")] + pub login_servers: Vec, + #[doc = "The list of Open Container Initiative (OCI) artifacts."] + #[serde(rename = "ociArtifacts", default, skip_serializing_if = "Vec::is_empty")] + pub oci_artifacts: Vec, +} +impl FhirServiceAcrConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authentication configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceAuthenticationConfiguration { + #[doc = "The authority url for the service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[doc = "The audience url for the service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[doc = "If the SMART on FHIR proxy is enabled"] + #[serde(rename = "smartProxyEnabled", default, skip_serializing_if = "Option::is_none")] + pub smart_proxy_enabled: Option, +} +impl FhirServiceAuthenticationConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of Fhir services."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceCollection { + #[doc = "The link used to get the next page of Fhir Services."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of Fhir Services."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl FhirServiceCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The settings for the CORS configuration of the service instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceCorsConfiguration { + #[doc = "The origins to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub origins: Vec, + #[doc = "The headers to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + #[doc = "The methods to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub methods: Vec, + #[doc = "The max age to be allowed via CORS."] + #[serde(rename = "maxAge", default, skip_serializing_if = "Option::is_none")] + pub max_age: Option, + #[doc = "If credentials are allowed via CORS."] + #[serde(rename = "allowCredentials", default, skip_serializing_if = "Option::is_none")] + pub allow_credentials: Option, +} +impl FhirServiceCorsConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Export operation configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceExportConfiguration { + #[doc = "The name of the default export storage account."] + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, +} +impl FhirServiceExportConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Import operation configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceImportConfiguration { + #[doc = "The name of the default integration storage account."] + #[serde(rename = "integrationDataStore", default, skip_serializing_if = "Option::is_none")] + pub integration_data_store: Option, + #[doc = "If the FHIR service is in InitialImportMode."] + #[serde(rename = "initialImportMode", default, skip_serializing_if = "Option::is_none")] + pub initial_import_mode: Option, + #[doc = "If the import operation is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl FhirServiceImportConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "FhirService patch properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServicePatchResource { + #[serde(flatten)] + pub resource_tags: ResourceTags, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, +} +impl FhirServicePatchResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Fhir Service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FhirServiceProperties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The access policies of the service instance."] + #[serde(rename = "accessPolicies", default, skip_serializing_if = "Option::is_none")] + pub access_policies: Option, + #[doc = "Azure container registry configuration information"] + #[serde(rename = "acrConfiguration", default, skip_serializing_if = "Option::is_none")] + pub acr_configuration: Option, + #[doc = "Authentication configuration information"] + #[serde(rename = "authenticationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub authentication_configuration: Option, + #[doc = "The settings for the CORS configuration of the service instance."] + #[serde(rename = "corsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cors_configuration: Option, + #[doc = "Export operation configuration information"] + #[serde(rename = "exportConfiguration", default, skip_serializing_if = "Option::is_none")] + pub export_configuration: Option, + #[doc = "The list of private endpoint connections that are set up for this resource."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Indicates the current status of event support for the resource."] + #[serde(rename = "eventState", default, skip_serializing_if = "Option::is_none")] + pub event_state: Option, + #[doc = "The settings for history tracking for FHIR resources."] + #[serde(rename = "resourceVersionPolicyConfiguration", default, skip_serializing_if = "Option::is_none")] + pub resource_version_policy_configuration: Option, + #[doc = "Import operation configuration information"] + #[serde(rename = "importConfiguration", default, skip_serializing_if = "Option::is_none")] + pub import_configuration: Option, +} +impl FhirServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IoT Connector definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotConnector { + #[serde(flatten)] + pub tagged_resource: TaggedResource, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, + #[doc = "IoT Connector properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl IotConnector { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of IoT Connectors."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotConnectorCollection { + #[doc = "The link used to get the next page of IoT Connectors."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of IoT Connectors."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl IotConnectorCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Iot Connector patch properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotConnectorPatchResource { + #[serde(flatten)] + pub resource_tags: ResourceTags, + #[serde(flatten)] + pub service_managed_identity: ServiceManagedIdentity, +} +impl IotConnectorPatchResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IoT Connector properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotConnectorProperties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Event Hub ingestion endpoint configuration"] + #[serde(rename = "ingestionEndpointConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ingestion_endpoint_configuration: Option, + #[doc = "The mapping content."] + #[serde(rename = "deviceMapping", default, skip_serializing_if = "Option::is_none")] + pub device_mapping: Option, +} +impl IotConnectorProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common IoT Connector destination properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotDestinationProperties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl IotDestinationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Event Hub ingestion endpoint configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotEventHubIngestionEndpointConfiguration { + #[doc = "Event Hub name to connect to."] + #[serde(rename = "eventHubName", default, skip_serializing_if = "Option::is_none")] + pub event_hub_name: Option, + #[doc = "Consumer group of the event hub to connected to."] + #[serde(rename = "consumerGroup", default, skip_serializing_if = "Option::is_none")] + pub consumer_group: Option, + #[doc = "Fully qualified namespace of the Event Hub to connect to."] + #[serde(rename = "fullyQualifiedEventHubNamespace", default, skip_serializing_if = "Option::is_none")] + pub fully_qualified_event_hub_namespace: Option, +} +impl IotEventHubIngestionEndpointConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IoT Connector FHIR destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IotFhirDestination { + #[serde(flatten)] + pub location_based_resource: LocationBasedResource, + #[doc = "IoT Connector destination properties for an Azure FHIR service."] + pub properties: IotFhirDestinationProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl IotFhirDestination { + pub fn new(properties: IotFhirDestinationProperties) -> Self { + Self { + location_based_resource: LocationBasedResource::default(), + properties, + system_data: None, + } + } +} +#[doc = "A collection of IoT Connector FHIR destinations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotFhirDestinationCollection { + #[doc = "The link used to get the next page of IoT FHIR destinations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of IoT Connector FHIR destinations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl IotFhirDestinationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IoT Connector destination properties for an Azure FHIR service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IotFhirDestinationProperties { + #[serde(flatten)] + pub iot_destination_properties: IotDestinationProperties, + #[doc = "The type of IoT identity resolution to use with the destination."] + #[serde(rename = "resourceIdentityResolutionType")] + pub resource_identity_resolution_type: IotIdentityResolutionType, + #[doc = "Fully qualified resource id of the FHIR service to connect to."] + #[serde(rename = "fhirServiceResourceId")] + pub fhir_service_resource_id: String, + #[doc = "The mapping content."] + #[serde(rename = "fhirMapping")] + pub fhir_mapping: IotMappingProperties, +} +impl IotFhirDestinationProperties { + pub fn new( + resource_identity_resolution_type: IotIdentityResolutionType, + fhir_service_resource_id: String, + fhir_mapping: IotMappingProperties, + ) -> Self { + Self { + iot_destination_properties: IotDestinationProperties::default(), + resource_identity_resolution_type, + fhir_service_resource_id, + fhir_mapping, + } + } +} +#[doc = "The type of IoT identity resolution to use with the destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IotIdentityResolutionType { + Create, + Lookup, +} +#[doc = "The mapping content."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IotMappingProperties { + #[doc = "The mapping."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +impl IotMappingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operations of the service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListOperations { + #[doc = "Collection of available operation details"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL client should use to fetch the next page (per server side paging).\r\nIt's null for now, added for future use."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListOperations { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The common properties for any location based resource, tracked or proxy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocationBasedResource { + #[serde(flatten)] + pub resource_core: ResourceCore, + #[doc = "The resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl LocationBasedResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifications of the Log for Azure Monitoring"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LogSpecification { + #[doc = "Name of the log"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized friendly display name of the log"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Blob duration of the log"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl LogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifications of the Dimension of metrics"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricDimension { + #[doc = "Name of the dimension"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized friendly display name of the dimension"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Whether this dimension should be included for the Shoebox export scenario"] + #[serde(rename = "toBeExportedForShoebox", default, skip_serializing_if = "Option::is_none")] + pub to_be_exported_for_shoebox: Option, +} +impl MetricDimension { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifications of the Metrics for Azure Monitoring"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricSpecification { + #[doc = "Name of the metric"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized friendly display name of the metric"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Localized friendly description of the metric"] + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[doc = "Unit that makes sense for the metric"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "Name of the metric category that the metric belongs to. A metric can only belong to a single category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count."] + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[doc = "Supported aggregation types"] + #[serde(rename = "supportedAggregationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_aggregation_types: Vec, + #[doc = "Supported time grain types"] + #[serde(rename = "supportedTimeGrainTypes", default, skip_serializing_if = "Vec::is_empty")] + pub supported_time_grain_types: Vec, + #[doc = "Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published."] + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[doc = "Dimensions of the metric"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[doc = "Name of the MDM namespace. Optional."] + #[serde(rename = "sourceMdmNamespace", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_namespace: Option, +} +impl MetricSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service REST API operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationDetail { + #[doc = "Name of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "The object that represents the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Default value is 'user,system'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, + #[doc = "Extra Operation properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationDetail { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_detail { + use super::*; + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "The object that represents the operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationDisplay { + #[doc = "Service provider: Microsoft.HealthcareApis"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource Type: Services"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Name of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Friendly description for the operation,"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl OperationDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Extra Operation properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationProperties { + #[doc = "Service specification payload"] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl OperationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties indicating the operation result of an operation on a service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultsDescription { + #[doc = "The ID of the operation returned."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the operation result."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The status of the operation being performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The time that the operation was started."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The time that the operation finished."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Additional properties of the operation result."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationResultsDescription { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_results_description { + use super::*; + #[doc = "The status of the operation being performed."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Canceled, + Succeeded, + Failed, + Requested, + Running, + } +} +#[doc = "The Private Endpoint resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The ARM identifier for Private Endpoint"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the PrivateEndpointConnectProperties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionDescription { + #[serde(flatten)] + pub private_endpoint_connection: PrivateEndpointConnection, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl PrivateEndpointConnectionDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of private endpoint connection associated with the specified storage account"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "Array of private endpoint connections"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of private endpoint connection associated with the specified storage account"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResultDescription { + #[doc = "Array of private endpoint connections"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateEndpointConnectionListResultDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the PrivateEndpointConnectProperties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "The Private Endpoint resource."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState")] + pub private_link_service_connection_state: PrivateLinkServiceConnectionState, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new(private_link_service_connection_state: PrivateLinkServiceConnectionState) -> Self { + Self { + private_endpoint: None, + private_link_service_connection_state, + provisioning_state: None, + } + } +} +#[doc = "The current provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointConnectionProvisioningState { + Succeeded, + Creating, + Deleting, + Failed, +} +#[doc = "The private endpoint connection status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PrivateEndpointServiceConnectionStatus { + Pending, + Approved, + Rejected, +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of a private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceDescription { + #[serde(flatten)] + pub private_link_resource: PrivateLinkResource, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl PrivateLinkResourceDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceListResultDescription { + #[doc = "Array of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PrivateLinkResourceListResultDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "The private link resource group id."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private link resource required member names."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of information about the state of the connection between service consumer and provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "The private endpoint connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The reason for approval/rejection of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "A message indicating if changes on the service provider require any updates on the consumer."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Deleting, + Succeeded, + Creating, + Accepted, + Verifying, + Updating, + Failed, + Canceled, + Deprovisioned, + Moving, + Suspended, + Warned, + SystemMaintenance, +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The common properties for any resource, tracked or proxy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceCore { + #[doc = "The resource identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "An etag associated with the resource, used for optimistic concurrency when editing it."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ResourceCore { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Indicates the current status of event support for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceEventState { + Disabled, + Enabled, + Updating, +} +#[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourcePublicNetworkAccess { + Enabled, + Disabled, +} +#[doc = "List of key value pairs that describe the resource. This will overwrite the existing tags."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceTags { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ResourceTags { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The settings for history tracking for FHIR resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceVersionPolicyConfiguration { + #[doc = "Controls how resources are versioned on the FHIR service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[doc = "A list of FHIR Resources and their version policy overrides."] + #[serde(rename = "resourceTypeOverrides", default, skip_serializing_if = "Option::is_none")] + pub resource_type_overrides: Option, +} +impl ResourceVersionPolicyConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub type ServiceAccessPoliciesInfo = Vec; +#[doc = "An access policy entry."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceAccessPolicyEntry { + #[doc = "An Azure AD object ID (User or Apps) that is allowed access to the FHIR service."] + #[serde(rename = "objectId")] + pub object_id: String, +} +impl ServiceAccessPolicyEntry { + pub fn new(object_id: String) -> Self { + Self { object_id } + } +} +#[doc = "Azure container registry configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceAcrConfigurationInfo { + #[doc = "The list of the ACR login servers."] + #[serde(rename = "loginServers", default, skip_serializing_if = "Vec::is_empty")] + pub login_servers: Vec, + #[doc = "The list of Open Container Initiative (OCI) artifacts."] + #[serde(rename = "ociArtifacts", default, skip_serializing_if = "Vec::is_empty")] + pub oci_artifacts: Vec, +} +impl ServiceAcrConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authentication configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceAuthenticationConfigurationInfo { + #[doc = "The authority url for the service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authority: Option, + #[doc = "The audience url for the service"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[doc = "If the SMART on FHIR proxy is enabled"] + #[serde(rename = "smartProxyEnabled", default, skip_serializing_if = "Option::is_none")] + pub smart_proxy_enabled: Option, +} +impl ServiceAuthenticationConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +pub type ServiceCorsConfigurationHeaderEntry = String; +#[doc = "The settings for the CORS configuration of the service instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceCorsConfigurationInfo { + #[doc = "The origins to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub origins: Vec, + #[doc = "The headers to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + #[doc = "The methods to be allowed via CORS."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub methods: Vec, + #[doc = "The max age to be allowed via CORS."] + #[serde(rename = "maxAge", default, skip_serializing_if = "Option::is_none")] + pub max_age: Option, + #[doc = "If credentials are allowed via CORS."] + #[serde(rename = "allowCredentials", default, skip_serializing_if = "Option::is_none")] + pub allow_credentials: Option, +} +impl ServiceCorsConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +pub type ServiceCorsConfigurationMethodEntry = String; +pub type ServiceCorsConfigurationOriginEntry = String; +#[doc = "The settings for the Cosmos DB database backing the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceCosmosDbConfigurationInfo { + #[doc = "The provisioned throughput for the backing database."] + #[serde(rename = "offerThroughput", default, skip_serializing_if = "Option::is_none")] + pub offer_throughput: Option, + #[doc = "The URI of the customer-managed key for the backing database."] + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, +} +impl ServiceCosmosDbConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Export operation configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceExportConfigurationInfo { + #[doc = "The name of the default export storage account."] + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, +} +impl ServiceExportConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Import operation configuration information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceImportConfigurationInfo { + #[doc = "The name of the default integration storage account."] + #[serde(rename = "integrationDataStore", default, skip_serializing_if = "Option::is_none")] + pub integration_data_store: Option, + #[doc = "If the FHIR service is in InitialImportMode."] + #[serde(rename = "initialImportMode", default, skip_serializing_if = "Option::is_none")] + pub initial_import_mode: Option, + #[doc = "If the import operation is enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ServiceImportConfigurationInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Managed service identity (system assigned and/or user assigned identities)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceManagedIdentity { + #[doc = "Setting indicating whether the service has a managed identity associated with it."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ServiceManagedIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod service_managed_identity { + use super::*; + #[doc = "Setting indicating whether the service has a managed identity associated with it."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Identity { + #[doc = "Type of identity being specified, currently SystemAssigned and None are allowed."] + #[serde(rename = "type")] + pub type_: identity::Type, + #[doc = "The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, + } + impl Identity { + pub fn new(type_: identity::Type) -> Self { + Self { + type_, + principal_id: None, + tenant_id: None, + user_assigned_identities: None, + } + } + } + pub mod identity { + use super::*; + #[doc = "Type of identity being specified, currently SystemAssigned and None are allowed."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + None, + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + } + } +} +#[doc = "An Open Container Initiative (OCI) artifact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceOciArtifactEntry { + #[doc = "The Azure Container Registry login server."] + #[serde(rename = "loginServer", default, skip_serializing_if = "Option::is_none")] + pub login_server: Option, + #[doc = "The artifact name."] + #[serde(rename = "imageName", default, skip_serializing_if = "Option::is_none")] + pub image_name: Option, + #[doc = "The artifact digest."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub digest: Option, +} +impl ServiceOciArtifactEntry { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service specification payload"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceSpecification { + #[doc = "Specifications of the Log for Azure Monitoring"] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, + #[doc = "Specifications of the Metrics for Azure Monitoring"] + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, +} +impl ServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The description of the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicesDescription { + #[serde(flatten)] + pub services_resource: ServicesResource, + #[doc = "The properties of a service instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl ServicesDescription { + pub fn new(services_resource: ServicesResource) -> Self { + Self { + services_resource, + properties: None, + system_data: None, + } + } +} +#[doc = "A list of service description objects with a next link."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicesDescriptionListResult { + #[doc = "The link used to get the next page of service description objects."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "A list of service description objects."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ServicesDescriptionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties indicating whether a given service name is available."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicesNameAvailabilityInfo { + #[doc = "The value which indicates whether the provided name is available."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "The reason for unavailability."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[doc = "The detailed reason message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ServicesNameAvailabilityInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod services_name_availability_info { + use super::*; + #[doc = "The reason for unavailability."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Reason { + Invalid, + AlreadyExists, + } +} +#[doc = "The description of the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicesPatchDescription { + #[doc = "Instance tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The properties for updating a service instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ServicesPatchDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a service instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicesProperties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The access policies of the service instance."] + #[serde(rename = "accessPolicies", default, skip_serializing_if = "Option::is_none")] + pub access_policies: Option, + #[doc = "The settings for the Cosmos DB database backing the service."] + #[serde(rename = "cosmosDbConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cosmos_db_configuration: Option, + #[doc = "Authentication configuration information"] + #[serde(rename = "authenticationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub authentication_configuration: Option, + #[doc = "The settings for the CORS configuration of the service instance."] + #[serde(rename = "corsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cors_configuration: Option, + #[doc = "Export operation configuration information"] + #[serde(rename = "exportConfiguration", default, skip_serializing_if = "Option::is_none")] + pub export_configuration: Option, + #[doc = "The list of private endpoint connections that are set up for this resource."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Azure container registry configuration information"] + #[serde(rename = "acrConfiguration", default, skip_serializing_if = "Option::is_none")] + pub acr_configuration: Option, + #[doc = "Import operation configuration information"] + #[serde(rename = "importConfiguration", default, skip_serializing_if = "Option::is_none")] + pub import_configuration: Option, +} +impl ServicesProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod services_properties { + use super::*; + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[doc = "The properties for updating a service instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicesPropertiesUpdateParameters { + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +impl ServicesPropertiesUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod services_properties_update_parameters { + use super::*; + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + } +} +#[doc = "The common properties of a service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicesResource { + #[doc = "The resource identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The kind of the service."] + pub kind: services_resource::Kind, + #[doc = "The resource location."] + pub location: String, + #[doc = "The resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "An etag associated with the resource, used for optimistic concurrency when editing it."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Setting indicating whether the service has a managed identity associated with it."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ServicesResource { + pub fn new(kind: services_resource::Kind, location: String) -> Self { + Self { + id: None, + name: None, + type_: None, + kind, + location, + tags: None, + etag: None, + identity: None, + } + } +} +pub mod services_resource { + use super::*; + #[doc = "The kind of the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "fhir")] + Fhir, + #[serde(rename = "fhir-Stu3")] + FhirStu3, + #[serde(rename = "fhir-R4")] + FhirR4, + } + #[doc = "Setting indicating whether the service has a managed identity associated with it."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Identity { + #[doc = "The principal ID of the resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of the resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "Type of identity being specified, currently SystemAssigned and None are allowed."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + } + impl Identity { + pub fn new() -> Self { + Self::default() + } + } + pub mod identity { + use super::*; + #[doc = "Type of identity being specified, currently SystemAssigned and None are allowed."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + } + } +} +#[doc = "The common properties of tracked resources in the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TaggedResource { + #[serde(flatten)] + pub resource_tags: ResourceTags, + #[serde(flatten)] + pub location_based_resource: LocationBasedResource, +} +impl TaggedResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentities {} +impl UserAssignedIdentities { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User assigned identity properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentity { + #[doc = "The principal ID of the assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client ID of the assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserAssignedIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Workspace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Workspace { + #[serde(flatten)] + pub tagged_resource: TaggedResource, + #[doc = "Workspaces resource specific properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Workspace { + pub fn new() -> Self { + Self::default() + } +} +pub mod workspace { + use super::*; + #[doc = "Workspaces resource specific properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "The provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The list of private endpoint connections that are set up for this resource."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Control permission for data plane traffic coming from public networks while private endpoint is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Collection of workspace object with a next link"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceList { + #[doc = "The link used to get the next page."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "Collection of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl WorkspaceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Workspace patch properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspacePatchResource { + #[serde(flatten)] + pub resource_tags: ResourceTags, +} +impl WorkspacePatchResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/healthcareapis/src/package_preview_2022_01/operations.rs b/services/mgmt/healthcareapis/src/package_preview_2022_01/operations.rs new file mode 100644 index 0000000000..6fbfa4aa63 --- /dev/null +++ b/services/mgmt/healthcareapis/src/package_preview_2022_01/operations.rs @@ -0,0 +1,4666 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn dicom_services(&self) -> dicom_services::Client { + dicom_services::Client(self.clone()) + } + pub fn fhir_destinations(&self) -> fhir_destinations::Client { + fhir_destinations::Client(self.clone()) + } + pub fn fhir_services(&self) -> fhir_services::Client { + fhir_services::Client(self.clone()) + } + pub fn iot_connector_fhir_destination(&self) -> iot_connector_fhir_destination::Client { + iot_connector_fhir_destination::Client(self.clone()) + } + pub fn iot_connectors(&self) -> iot_connectors::Client { + iot_connectors::Client(self.clone()) + } + pub fn operation_results(&self) -> operation_results::Client { + operation_results::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn services(&self) -> services::Client { + services::Client(self.clone()) + } + pub fn workspace_private_endpoint_connections(&self) -> workspace_private_endpoint_connections::Client { + workspace_private_endpoint_connections::Client(self.clone()) + } + pub fn workspace_private_link_resources(&self) -> workspace_private_link_resources::Client { + workspace_private_link_resources::Client(self.clone()) + } + pub fn workspaces(&self) -> workspaces::Client { + workspaces::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Services_Get(#[from] services::get::Error), + #[error(transparent)] + Services_CreateOrUpdate(#[from] services::create_or_update::Error), + #[error(transparent)] + Services_Update(#[from] services::update::Error), + #[error(transparent)] + Services_Delete(#[from] services::delete::Error), + #[error(transparent)] + Services_List(#[from] services::list::Error), + #[error(transparent)] + Services_ListByResourceGroup(#[from] services::list_by_resource_group::Error), + #[error(transparent)] + Services_CheckNameAvailability(#[from] services::check_name_availability::Error), + #[error(transparent)] + PrivateEndpointConnections_ListByService(#[from] private_endpoint_connections::list_by_service::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + PrivateLinkResources_ListByService(#[from] private_link_resources::list_by_service::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + Workspaces_ListBySubscription(#[from] workspaces::list_by_subscription::Error), + #[error(transparent)] + Workspaces_ListByResourceGroup(#[from] workspaces::list_by_resource_group::Error), + #[error(transparent)] + Workspaces_Get(#[from] workspaces::get::Error), + #[error(transparent)] + Workspaces_CreateOrUpdate(#[from] workspaces::create_or_update::Error), + #[error(transparent)] + Workspaces_Update(#[from] workspaces::update::Error), + #[error(transparent)] + Workspaces_Delete(#[from] workspaces::delete::Error), + #[error(transparent)] + DicomServices_ListByWorkspace(#[from] dicom_services::list_by_workspace::Error), + #[error(transparent)] + DicomServices_Get(#[from] dicom_services::get::Error), + #[error(transparent)] + DicomServices_CreateOrUpdate(#[from] dicom_services::create_or_update::Error), + #[error(transparent)] + DicomServices_Update(#[from] dicom_services::update::Error), + #[error(transparent)] + DicomServices_Delete(#[from] dicom_services::delete::Error), + #[error(transparent)] + IotConnectors_ListByWorkspace(#[from] iot_connectors::list_by_workspace::Error), + #[error(transparent)] + IotConnectors_Get(#[from] iot_connectors::get::Error), + #[error(transparent)] + IotConnectors_CreateOrUpdate(#[from] iot_connectors::create_or_update::Error), + #[error(transparent)] + IotConnectors_Update(#[from] iot_connectors::update::Error), + #[error(transparent)] + IotConnectors_Delete(#[from] iot_connectors::delete::Error), + #[error(transparent)] + FhirDestinations_ListByIotConnector(#[from] fhir_destinations::list_by_iot_connector::Error), + #[error(transparent)] + IotConnectorFhirDestination_Get(#[from] iot_connector_fhir_destination::get::Error), + #[error(transparent)] + IotConnectorFhirDestination_CreateOrUpdate(#[from] iot_connector_fhir_destination::create_or_update::Error), + #[error(transparent)] + IotConnectorFhirDestination_Delete(#[from] iot_connector_fhir_destination::delete::Error), + #[error(transparent)] + FhirServices_ListByWorkspace(#[from] fhir_services::list_by_workspace::Error), + #[error(transparent)] + FhirServices_Get(#[from] fhir_services::get::Error), + #[error(transparent)] + FhirServices_CreateOrUpdate(#[from] fhir_services::create_or_update::Error), + #[error(transparent)] + FhirServices_Update(#[from] fhir_services::update::Error), + #[error(transparent)] + FhirServices_Delete(#[from] fhir_services::delete::Error), + #[error(transparent)] + WorkspacePrivateEndpointConnections_ListByWorkspace(#[from] workspace_private_endpoint_connections::list_by_workspace::Error), + #[error(transparent)] + WorkspacePrivateEndpointConnections_Get(#[from] workspace_private_endpoint_connections::get::Error), + #[error(transparent)] + WorkspacePrivateEndpointConnections_CreateOrUpdate(#[from] workspace_private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + WorkspacePrivateEndpointConnections_Delete(#[from] workspace_private_endpoint_connections::delete::Error), + #[error(transparent)] + WorkspacePrivateLinkResources_ListByWorkspace(#[from] workspace_private_link_resources::list_by_workspace::Error), + #[error(transparent)] + WorkspacePrivateLinkResources_Get(#[from] workspace_private_link_resources::get::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + OperationResults_Get(#[from] operation_results::get::Error), +} +pub mod services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + service_description: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + service_description: service_description.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + service_patch_description: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + service_patch_description: service_patch_description.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + check_name_availability_inputs: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + check_name_availability_inputs: check_name_availability_inputs.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServicesDescription), + Created201(models::ServicesDescription), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) service_description: models::ServicesDescription, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.service_description).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) service_patch_description: models::ServicesPatchDescription, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.service_patch_description).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HealthcareApis/services", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescriptionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesDescriptionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) check_name_availability_inputs: models::CheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HealthcareApis/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_inputs).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServicesNameAvailabilityInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + properties: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + properties: properties.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResultDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) properties: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_service( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_by_service::Builder { + list_by_service::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + group_name: group_name.into(), + } + } + } + pub mod list_by_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResultDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/services/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + workspace: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + workspace: workspace.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + workspace_patch_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + workspace_patch_resource: workspace_patch_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HealthcareApis/workspaces", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkspaceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkspaceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Workspace), + Created201(models::Workspace), + Accepted202(models::Workspace), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) workspace: models::Workspace, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workspace).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Workspace), + Accepted202(models::Workspace), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) workspace_patch_resource: models::WorkspacePatchResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workspace_patch_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod dicom_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + dicom_service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + dicom_service_name: dicom_service_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + dicom_service_name: impl Into, + dicomservice: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + dicom_service_name: dicom_service_name.into(), + dicomservice: dicomservice.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + dicom_service_name: impl Into, + workspace_name: impl Into, + dicomservice_patch_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + dicom_service_name: dicom_service_name.into(), + workspace_name: workspace_name.into(), + dicomservice_patch_resource: dicomservice_patch_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + dicom_service_name: impl Into, + workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + dicom_service_name: dicom_service_name.into(), + workspace_name: workspace_name.into(), + } + } + } + pub mod list_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/dicomservices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomServiceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) dicom_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/dicomservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.dicom_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DicomService), + Created201(models::DicomService), + Accepted202(models::DicomService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) dicom_service_name: String, + pub(crate) dicomservice: models::DicomService, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/dicomservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.dicom_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.dicomservice).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DicomService), + Accepted202(models::DicomService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) dicom_service_name: String, + pub(crate) workspace_name: String, + pub(crate) dicomservice_patch_resource: models::DicomServicePatchResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/dicomservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.dicom_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.dicomservice_patch_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DicomService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) dicom_service_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/dicomservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.dicom_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod iot_connectors { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + iot_connector: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + iot_connector: iot_connector.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + iot_connector_name: impl Into, + workspace_name: impl Into, + iot_connector_patch_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + iot_connector_name: iot_connector_name.into(), + workspace_name: workspace_name.into(), + iot_connector_patch_resource: iot_connector_patch_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + iot_connector_name: impl Into, + workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + iot_connector_name: iot_connector_name.into(), + workspace_name: workspace_name.into(), + } + } + } + pub mod list_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnectorCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.iot_connector_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::IotConnector), + Created201(models::IotConnector), + Accepted202(models::IotConnector), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + pub(crate) iot_connector: models::IotConnector, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.iot_connector_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.iot_connector).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::IotConnector), + Accepted202(models::IotConnector), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) iot_connector_name: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_patch_resource: models::IotConnectorPatchResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.iot_connector_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.iot_connector_patch_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotConnector = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) iot_connector_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.iot_connector_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod fhir_destinations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_iot_connector( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + ) -> list_by_iot_connector::Builder { + list_by_iot_connector::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + } + } + } + pub mod list_by_iot_connector { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}/fhirdestinations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . iot_connector_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotFhirDestinationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod iot_connector_fhir_destination { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + fhir_destination_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + fhir_destination_name: fhir_destination_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + fhir_destination_name: impl Into, + iot_fhir_destination: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + fhir_destination_name: fhir_destination_name.into(), + iot_fhir_destination: iot_fhir_destination.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + iot_connector_name: impl Into, + fhir_destination_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + iot_connector_name: iot_connector_name.into(), + fhir_destination_name: fhir_destination_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + pub(crate) fhir_destination_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}/fhirdestinations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . iot_connector_name , & self . fhir_destination_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotFhirDestination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::IotFhirDestination), + Created201(models::IotFhirDestination), + Accepted202(models::IotFhirDestination), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + pub(crate) fhir_destination_name: String, + pub(crate) iot_fhir_destination: models::IotFhirDestination, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}/fhirdestinations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . iot_connector_name , & self . fhir_destination_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.iot_fhir_destination).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotFhirDestination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotFhirDestination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IotFhirDestination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) iot_connector_name: String, + pub(crate) fhir_destination_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/iotconnectors/{}/fhirdestinations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . iot_connector_name , & self . fhir_destination_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod fhir_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + fhir_service_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + fhir_service_name: fhir_service_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + fhir_service_name: impl Into, + fhirservice: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + fhir_service_name: fhir_service_name.into(), + fhirservice: fhirservice.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + fhir_service_name: impl Into, + workspace_name: impl Into, + fhirservice_patch_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fhir_service_name: fhir_service_name.into(), + workspace_name: workspace_name.into(), + fhirservice_patch_resource: fhirservice_patch_resource.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + fhir_service_name: impl Into, + workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + fhir_service_name: fhir_service_name.into(), + workspace_name: workspace_name.into(), + } + } + } + pub mod list_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/fhirservices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirServiceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) fhir_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/fhirservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.fhir_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::FhirService), + Created201(models::FhirService), + Accepted202(models::FhirService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) fhir_service_name: String, + pub(crate) fhirservice: models::FhirService, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/fhirservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.fhir_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.fhirservice).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::FhirService), + Accepted202(models::FhirService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fhir_service_name: String, + pub(crate) workspace_name: String, + pub(crate) fhirservice_patch_resource: models::FhirServicePatchResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/fhirservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.fhir_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.fhirservice_patch_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FhirService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) fhir_service_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/fhirservices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.fhir_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspace_private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + private_endpoint_connection_name: impl Into, + properties: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + properties: properties.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResultDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) properties: models::PrivateEndpointConnectionDescription, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.properties).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . workspace_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspace_private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_workspace( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + ) -> list_by_workspace::Builder { + list_by_workspace::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + workspace_name: impl Into, + group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + workspace_name: workspace_name.into(), + group_name: group_name.into(), + } + } + } + pub mod list_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResultDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) workspace_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HealthcareApis/workspaces/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name, + &self.group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.HealthcareApis/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListOperations = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + location_name: impl Into, + operation_result_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location_name: location_name.into(), + operation_result_id: operation_result_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorDetails, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location_name: String, + pub(crate) operation_result_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HealthcareApis/locations/{}/operationresults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location_name, + &self.operation_result_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultsDescription = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/hybridcompute/Cargo.toml b/services/mgmt/hybridcompute/Cargo.toml index 814bbe5804..5720a57b05 100644 --- a/services/mgmt/hybridcompute/Cargo.toml +++ b/services/mgmt/hybridcompute/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hybridcompute" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2021-06", "package-preview-2021-05", "package-2021-05", "package-preview-2021-04"] +features = ["no-default-tag", "package-preview-2021-12", "package-preview-2021-06", "package-preview-2021-05", "package-2021-05"] [features] -default = ["package-preview-2021-12", "enable_reqwest"] +default = ["package-2022-03", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-03" = [] "package-preview-2021-12" = [] "package-preview-2021-06" = [] "package-preview-2021-05" = [] diff --git a/services/mgmt/hybridcompute/README.md b/services/mgmt/hybridcompute/README.md index 6093e25b92..a781521e69 100644 --- a/services/mgmt/hybridcompute/README.md +++ b/services/mgmt/hybridcompute/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/hybridcomp To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-preview-2021-12`. +The default tag is `package-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-03` has 27 operations from 1 API versions: `2022-03-10`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. - `package-preview-2021-12` has 27 operations from 1 API versions: `2021-12-10-preview`. Use crate feature `package-preview-2021-12` to enable. The operations will be in the `package_preview_2021_12` module. - `package-preview-2021-06` has 27 operations from 1 API versions: `2021-06-10-preview`. Use crate feature `package-preview-2021-06` to enable. The operations will be in the `package_preview_2021_06` module. - `package-preview-2021-05` has 27 operations from 1 API versions: `2021-05-17-preview`. Use crate feature `package-preview-2021-05` to enable. The operations will be in the `package_preview_2021_05` module. diff --git a/services/mgmt/hybridcompute/src/lib.rs b/services/mgmt/hybridcompute/src/lib.rs index b34353ef5d..c15d377ee9 100644 --- a/services/mgmt/hybridcompute/src/lib.rs +++ b/services/mgmt/hybridcompute/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-03")] +pub mod package_2022_03; +#[cfg(all(feature = "package-2022-03", not(feature = "no-default-tag")))] +pub use package_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2021-12")] pub mod package_preview_2021_12; #[cfg(all(feature = "package-preview-2021-12", not(feature = "no-default-tag")))] diff --git a/services/mgmt/hybridcompute/src/package_2022_03/mod.rs b/services/mgmt/hybridcompute/src/package_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/hybridcompute/src/package_2022_03/models.rs b/services/mgmt/hybridcompute/src/package_2022_03/models.rs new file mode 100644 index 0000000000..680e5be10c --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2022_03/models.rs @@ -0,0 +1,1134 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentConfiguration { + #[doc = "Specifies the URL of the proxy to be used."] + #[serde(rename = "proxyUrl", default, skip_serializing_if = "Option::is_none")] + pub proxy_url: Option, + #[doc = "Specifies the list of ports that the agent will be able to listen on."] + #[serde(rename = "incomingConnectionsPorts", default, skip_serializing_if = "Vec::is_empty")] + pub incoming_connections_ports: Vec, + #[doc = "Array of extensions that are allowed to be installed or updated."] + #[serde(rename = "extensionsAllowList", default, skip_serializing_if = "Vec::is_empty")] + pub extensions_allow_list: Vec, + #[doc = "Array of extensions that are blocked (cannot be installed or updated)"] + #[serde(rename = "extensionsBlockList", default, skip_serializing_if = "Vec::is_empty")] + pub extensions_block_list: Vec, + #[doc = "List of service names which should not use the specified proxy server."] + #[serde(rename = "proxyBypass", default, skip_serializing_if = "Vec::is_empty")] + pub proxy_bypass: Vec, + #[doc = "Specifies whether the extension service is enabled or disabled."] + #[serde(rename = "extensionsEnabled", default, skip_serializing_if = "Option::is_none")] + pub extensions_enabled: Option, + #[doc = "Specified whether the guest configuration service is enabled or disabled."] + #[serde(rename = "guestConfigurationEnabled", default, skip_serializing_if = "Option::is_none")] + pub guest_configuration_enabled: Option, +} +impl AgentConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The metadata of the cloud environment (Azure/GCP/AWS/OCI...)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudMetadata { + #[doc = "Specifies the cloud provider (Azure/AWS/GCP...)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +impl CloudMetadata { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes properties that can identify extensions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConfigurationExtension { + #[doc = "Publisher of the extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[doc = "Type of the extension."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ConfigurationExtension { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionDetail { + #[doc = "Azure resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The private endpoint connection private ip address"] + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "The private endpoint connection link identifier"] + #[serde(rename = "linkIdentifier", default, skip_serializing_if = "Option::is_none")] + pub link_identifier: Option, + #[doc = "The private endpoint connection group id"] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private endpoint connection member name"] + #[serde(rename = "memberName", default, skip_serializing_if = "Option::is_none")] + pub member_name: Option, +} +impl ConnectionDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Detected properties from the machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DetectedProperties {} +impl DetectedProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the Machine Extension Target Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionTarget {} +impl ExtensionTarget { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the Machine Extension Target Version Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionTargetProperties { + #[doc = "Extension Upgrade Target Version."] + #[serde(rename = "targetVersion", default, skip_serializing_if = "Option::is_none")] + pub target_version: Option, +} +impl ExtensionTargetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure Arc PrivateLinkScope definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HybridComputePrivateLinkScope { + #[serde(flatten)] + pub private_link_scopes_resource: PrivateLinkScopesResource, + #[doc = "Properties that define a Azure Arc PrivateLinkScope resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl HybridComputePrivateLinkScope { + pub fn new(private_link_scopes_resource: PrivateLinkScopesResource) -> Self { + Self { + private_link_scopes_resource, + properties: None, + system_data: None, + } + } +} +#[doc = "Describes the list of Azure Arc PrivateLinkScope resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HybridComputePrivateLinkScopeListResult { + #[doc = "List of Azure Arc PrivateLinkScope definitions."] + pub value: Vec, + #[doc = "The URI to get the next set of Azure Arc PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl HybridComputePrivateLinkScopeListResult { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Properties that define a Azure Arc PrivateLinkScope resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HybridComputePrivateLinkScopeProperties { + #[doc = "The network access policy to determine if Azure Arc agents can use public Azure Arc service endpoints. Defaults to disabled (access to Azure Arc services only via private link)."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Guid id of the private link scope."] + #[serde(rename = "privateLinkScopeId", default, skip_serializing_if = "Option::is_none")] + pub private_link_scope_id: Option, + #[doc = "The collection of associated Private Endpoint Connections."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, +} +impl HybridComputePrivateLinkScopeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Identity { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identity type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Identity { + pub fn new() -> Self { + Self::default() + } +} +pub mod identity { + use super::*; + #[doc = "The identity type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } +} +#[doc = "Describes a hybrid machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Machine { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Describes the properties of a hybrid machine."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Machine { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + identity: None, + system_data: None, + } + } +} +#[doc = "Describes a Machine Extension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtension { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Describes the properties of a Machine Extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl MachineExtension { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + system_data: None, + } + } +} +#[doc = "Describes the Machine Extension Instance View."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionInstanceView { + #[doc = "The machine extension name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Specifies the type of the extension; an example is \"CustomScriptExtension\"."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Specifies the version of the script handler."] + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[doc = "Instance view status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl MachineExtensionInstanceView { + pub fn new() -> Self { + Self::default() + } +} +pub mod machine_extension_instance_view { + use super::*; + #[doc = "Instance view status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Status { + #[doc = "The status code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The level code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, + #[doc = "The short localizable label for the status."] + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[doc = "The detailed status message, including for alerts and error messages."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The time of the status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, + } + impl Status { + pub fn new() -> Self { + Self::default() + } + } + pub mod status { + use super::*; + #[doc = "The level code."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Info, + Warning, + Error, + } + } +} +#[doc = "Describes the properties of a Machine Extension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionProperties { + #[doc = "How the extension handler should be forced to update even if the extension configuration has not changed."] + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[doc = "The name of the extension handler publisher."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[doc = "Specifies the type of the extension; an example is \"CustomScriptExtension\"."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Specifies the version of the script handler."] + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[doc = "Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available."] + #[serde(rename = "enableAutomaticUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_upgrade: Option, + #[doc = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true."] + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[doc = "Json formatted public settings for the extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[doc = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all."] + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[doc = "The provisioning state, which only appears in the response."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Describes the Machine Extension Instance View."] + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +impl MachineExtensionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes a Machine Extension Update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionUpdate { + #[serde(flatten)] + pub resource_update: ResourceUpdate, + #[doc = "Describes the properties of a Machine Extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MachineExtensionUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Machine Extension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionUpdateProperties { + #[doc = "How the extension handler should be forced to update even if the extension configuration has not changed."] + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[doc = "The name of the extension handler publisher."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[doc = "Specifies the type of the extension; an example is \"CustomScriptExtension\"."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Specifies the version of the script handler."] + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[doc = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true."] + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[doc = "Json formatted public settings for the extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[doc = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all."] + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, +} +impl MachineExtensionUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the Machine Extension Upgrade Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionUpgrade { + #[doc = "Describes the Machine Extension Target Properties"] + #[serde(rename = "extensionTargets", default, skip_serializing_if = "Option::is_none")] + pub extension_targets: Option, +} +impl MachineExtensionUpgrade { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the Machine Extensions List Result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineExtensionsListResult { + #[doc = "The list of extensions"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MachineExtensionsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The List hybrid machine operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineListResult { + #[doc = "The list of hybrid machines."] + pub value: Vec, + #[doc = "The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MachineListResult { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Describes the properties of a hybrid machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineProperties { + #[doc = "Metadata pertaining to the geographic location of the resource."] + #[serde(rename = "locationData", default, skip_serializing_if = "Option::is_none")] + pub location_data: Option, + #[doc = "Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM."] + #[serde(rename = "agentConfiguration", default, skip_serializing_if = "Option::is_none")] + pub agent_configuration: Option, + #[doc = "Reports the state and behavior of dependent services."] + #[serde(rename = "serviceStatuses", default, skip_serializing_if = "Option::is_none")] + pub service_statuses: Option, + #[doc = "The metadata of the cloud environment (Azure/GCP/AWS/OCI...)."] + #[serde(rename = "cloudMetadata", default, skip_serializing_if = "Option::is_none")] + pub cloud_metadata: Option, + #[doc = "Specifies the operating system settings for the hybrid machine."] + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[doc = "The provisioning state, which only appears in the response."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The status of the hybrid machine agent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The time of the last status change."] + #[serde(rename = "lastStatusChange", default, skip_serializing_if = "Option::is_none")] + pub last_status_change: Option, + #[doc = "Details about the error state."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "The hybrid machine agent full version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "Specifies the hybrid machine unique ID."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "Specifies the hybrid machine display name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Specifies the hybrid machine FQDN."] + #[serde(rename = "machineFqdn", default, skip_serializing_if = "Option::is_none")] + pub machine_fqdn: Option, + #[doc = "Public Key that the client provides to be used during initial resource onboarding"] + #[serde(rename = "clientPublicKey", default, skip_serializing_if = "Option::is_none")] + pub client_public_key: Option, + #[doc = "The Operating System running on the hybrid machine."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "The version of Operating System running on the hybrid machine."] + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[doc = "The type of Operating System (windows/linux)."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Specifies the Arc Machine's unique SMBIOS ID"] + #[serde(rename = "vmUuid", default, skip_serializing_if = "Option::is_none")] + pub vm_uuid: Option, + #[doc = "Machine Extensions information"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[doc = "Specifies the Operating System product SKU."] + #[serde(rename = "osSku", default, skip_serializing_if = "Option::is_none")] + pub os_sku: Option, + #[doc = "Specifies the Windows domain name."] + #[serde(rename = "domainName", default, skip_serializing_if = "Option::is_none")] + pub domain_name: Option, + #[doc = "Specifies the AD fully qualified display name."] + #[serde(rename = "adFqdn", default, skip_serializing_if = "Option::is_none")] + pub ad_fqdn: Option, + #[doc = "Specifies the DNS fully qualified display name."] + #[serde(rename = "dnsFqdn", default, skip_serializing_if = "Option::is_none")] + pub dns_fqdn: Option, + #[doc = "The resource id of the private link scope this machine is assigned to, if any."] + #[serde(rename = "privateLinkScopeResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_scope_resource_id: Option, + #[doc = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any."] + #[serde(rename = "parentClusterResourceId", default, skip_serializing_if = "Option::is_none")] + pub parent_cluster_resource_id: Option, + #[doc = "Specifies whether any MS SQL instance is discovered on the machine."] + #[serde(rename = "mssqlDiscovered", default, skip_serializing_if = "Option::is_none")] + pub mssql_discovered: Option, + #[doc = "Detected properties from the machine."] + #[serde(rename = "detectedProperties", default, skip_serializing_if = "Option::is_none")] + pub detected_properties: Option, +} +impl MachineProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod machine_properties { + use super::*; + #[doc = "The status of the hybrid machine agent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Connected, + Disconnected, + Error, + } +} +#[doc = "Describes a hybrid machine Update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineUpdate { + #[serde(flatten)] + pub resource_update: ResourceUpdate, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Describes the ARM updatable properties of a hybrid machine."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MachineUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the ARM updatable properties of a hybrid machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MachineUpdateProperties { + #[doc = "Metadata pertaining to the geographic location of the resource."] + #[serde(rename = "locationData", default, skip_serializing_if = "Option::is_none")] + pub location_data: Option, + #[doc = "Specifies the operating system settings for the hybrid machine."] + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[doc = "The metadata of the cloud environment (Azure/GCP/AWS/OCI...)."] + #[serde(rename = "cloudMetadata", default, skip_serializing_if = "Option::is_none")] + pub cloud_metadata: Option, + #[doc = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any."] + #[serde(rename = "parentClusterResourceId", default, skip_serializing_if = "Option::is_none")] + pub parent_cluster_resource_id: Option, + #[doc = "The resource id of the private link scope this machine is assigned to, if any."] + #[serde(rename = "privateLinkScopeResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_scope_resource_id: Option, +} +impl MachineUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifies the operating system settings for the hybrid machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OsProfile { + #[doc = "Specifies the host OS name of the hybrid machine."] + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[doc = "Specifies the windows configuration for update management."] + #[serde(rename = "windowsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub windows_configuration: Option, + #[doc = "Specifies the linux configuration for update management."] + #[serde(rename = "linuxConfiguration", default, skip_serializing_if = "Option::is_none")] + pub linux_configuration: Option, +} +impl OsProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod os_profile { + use super::*; + #[doc = "Specifies the windows configuration for update management."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct WindowsConfiguration { + #[doc = "Specifies the patch settings."] + #[serde(rename = "patchSettings", default, skip_serializing_if = "Option::is_none")] + pub patch_settings: Option, + } + impl WindowsConfiguration { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Specifies the linux configuration for update management."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct LinuxConfiguration { + #[doc = "Specifies the patch settings."] + #[serde(rename = "patchSettings", default, skip_serializing_if = "Option::is_none")] + pub patch_settings: Option, + } + impl LinuxConfiguration { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The List Compute Operation operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "The list of compute operations"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Compute Operation value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValue { + #[doc = "The origin of the compute operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The name of the compute operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Describes the properties of a Hybrid Compute Operation Value Display."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "This property indicates if the operation is an action or a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, +} +impl OperationValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a Hybrid Compute Operation Value Display."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationValueDisplay { + #[doc = "The display name of the compute operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The display name of the resource the operation applies to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The description of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The resource provider for the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, +} +impl OperationValueDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifies the patch settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchSettings { + #[doc = "Specifies the assessment mode."] + #[serde(rename = "assessmentMode", default, skip_serializing_if = "Option::is_none")] + pub assessment_mode: Option, + #[doc = "Specifies the patch mode."] + #[serde(rename = "patchMode", default, skip_serializing_if = "Option::is_none")] + pub patch_mode: Option, +} +impl PatchSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod patch_settings { + use super::*; + #[doc = "Specifies the assessment mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AssessmentMode { + ImageDefault, + AutomaticByPlatform, + } + #[doc = "Specifies the patch mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PatchMode { + ImageDefault, + AutomaticByPlatform, + #[serde(rename = "AutomaticByOS")] + AutomaticByOs, + Manual, + } +} +#[doc = "A private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Data Model for a Private Endpoint Connection associated with a Private Link Scope"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionDataModel { + #[doc = "The ARM Resource Id of the Private Endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The Name of the Private Endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Azure resource type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnectionDataModel { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private endpoint connections."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "Array of results."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to retrieve next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "Private endpoint which the connection belongs to."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "State of the private endpoint connection."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "State of the private endpoint connection."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "List of group IDs."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Vec::is_empty")] + pub group_ids: Vec, +} +impl PrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private endpoint which the connection belongs to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointProperty { + #[doc = "Resource id of the private endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpointProperty { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A private link resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of a private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of private link resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceListResult { + #[doc = "Array of results."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to retrieve next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateLinkResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "The private link resource group id."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private link resource required member names."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "Required DNS zone names of the the private link resource."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkScopeValidationDetails { + #[doc = "Azure resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The network access policy to determine if Azure Arc agents can use public Azure Arc service endpoints. Defaults to disabled (access to Azure Arc services only via private link)."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[doc = "List of Private Endpoint Connection details."] + #[serde(rename = "connectionDetails", default, skip_serializing_if = "Vec::is_empty")] + pub connection_details: Vec, +} +impl PrivateLinkScopeValidationDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An azure resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkScopesResource { + #[doc = "Azure resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Azure resource name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Azure resource type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource location"] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PrivateLinkScopesResource { + pub fn new(location: String) -> Self { + Self { + id: None, + name: None, + type_: None, + location, + tags: None, + } + } +} +#[doc = "State of the private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionStateProperty { + #[doc = "The private link service connection status."] + pub status: String, + #[doc = "The private link service connection description."] + pub description: String, + #[doc = "The actions required for private link service connection."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionStateProperty { + pub fn new(status: String, description: String) -> Self { + Self { + status, + description, + actions_required: None, + } + } +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The network access policy to determine if Azure Arc agents can use public Azure Arc service endpoints. Defaults to disabled (access to Azure Arc services only via private link)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PublicNetworkAccessType { + Enabled, + Disabled, +} +impl Default for PublicNetworkAccessType { + fn default() -> Self { + Self::Disabled + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Update Resource model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceUpdate { + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ResourceUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the status and behavior of a service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceStatus { + #[doc = "The current status of the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The behavior of the service when the Arc-enabled machine starts up."] + #[serde(rename = "startupType", default, skip_serializing_if = "Option::is_none")] + pub startup_type: Option, +} +impl ServiceStatus { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reports the state and behavior of dependent services."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceStatuses { + #[doc = "Describes the status and behavior of a service."] + #[serde(rename = "extensionService", default, skip_serializing_if = "Option::is_none")] + pub extension_service: Option, + #[doc = "Describes the status and behavior of a service."] + #[serde(rename = "guestConfigurationService", default, skip_serializing_if = "Option::is_none")] + pub guest_configuration_service: Option, +} +impl ServiceStatuses { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsResource { + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsResource { + pub fn new() -> Self { + Self::default() + } +} +pub type TargetVersion = String; +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "Metadata pertaining to the geographic location of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LocationData { + #[doc = "A canonical name for the geographic or physical location."] + pub name: String, + #[doc = "The city or locality where the resource is located."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "The district, state, or province where the resource is located."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub district: Option, + #[doc = "The country or region where the resource is located"] + #[serde(rename = "countryOrRegion", default, skip_serializing_if = "Option::is_none")] + pub country_or_region: Option, +} +impl LocationData { + pub fn new(name: String) -> Self { + Self { + name, + city: None, + district: None, + country_or_region: None, + } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/hybridcompute/src/package_2022_03/operations.rs b/services/mgmt/hybridcompute/src/package_2022_03/operations.rs new file mode 100644 index 0000000000..15feff6ca7 --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2022_03/operations.rs @@ -0,0 +1,2681 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn machine_extensions(&self) -> machine_extensions::Client { + machine_extensions::Client(self.clone()) + } + pub fn machines(&self) -> machines::Client { + machines::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn private_link_scopes(&self) -> private_link_scopes::Client { + private_link_scopes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Machines_Get(#[from] machines::get::Error), + #[error(transparent)] + Machines_CreateOrUpdate(#[from] machines::create_or_update::Error), + #[error(transparent)] + Machines_Update(#[from] machines::update::Error), + #[error(transparent)] + Machines_Delete(#[from] machines::delete::Error), + #[error(transparent)] + Machines_ListByResourceGroup(#[from] machines::list_by_resource_group::Error), + #[error(transparent)] + Machines_ListBySubscription(#[from] machines::list_by_subscription::Error), + #[error(transparent)] + MachineExtensions_Get(#[from] machine_extensions::get::Error), + #[error(transparent)] + MachineExtensions_CreateOrUpdate(#[from] machine_extensions::create_or_update::Error), + #[error(transparent)] + MachineExtensions_Update(#[from] machine_extensions::update::Error), + #[error(transparent)] + MachineExtensions_Delete(#[from] machine_extensions::delete::Error), + #[error(transparent)] + MachineExtensions_List(#[from] machine_extensions::list::Error), + #[error(transparent)] + UpgradeExtensions(#[from] upgrade_extensions::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + PrivateLinkScopes_List(#[from] private_link_scopes::list::Error), + #[error(transparent)] + PrivateLinkScopes_ListByResourceGroup(#[from] private_link_scopes::list_by_resource_group::Error), + #[error(transparent)] + PrivateLinkScopes_Get(#[from] private_link_scopes::get::Error), + #[error(transparent)] + PrivateLinkScopes_CreateOrUpdate(#[from] private_link_scopes::create_or_update::Error), + #[error(transparent)] + PrivateLinkScopes_UpdateTags(#[from] private_link_scopes::update_tags::Error), + #[error(transparent)] + PrivateLinkScopes_Delete(#[from] private_link_scopes::delete::Error), + #[error(transparent)] + PrivateLinkResources_ListByPrivateLinkScope(#[from] private_link_resources::list_by_private_link_scope::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + PrivateEndpointConnections_ListByPrivateLinkScope(#[from] private_endpoint_connections::list_by_private_link_scope::Error), + #[error(transparent)] + PrivateLinkScopes_GetValidationDetails(#[from] private_link_scopes::get_validation_details::Error), + #[error(transparent)] + PrivateLinkScopes_GetValidationDetailsForMachine(#[from] private_link_scopes::get_validation_details_for_machine::Error), +} +pub mod machines { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Machine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) parameters: models::Machine, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Machine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) parameters: models::MachineUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Machine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/machines", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod machine_extensions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + machine_name: impl Into, + extension_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + extension_name: extension_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + machine_name: impl Into, + extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + extension_name: extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + machine_name: impl Into, + extension_name: impl Into, + extension_parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + extension_name: extension_name.into(), + extension_parameters: extension_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + machine_name: impl Into, + extension_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + extension_name: extension_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + machine_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) extension_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name, + &self.extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MachineExtension), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) extension_name: String, + pub(crate) extension_parameters: models::MachineExtension, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name, + &self.extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MachineExtension), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) extension_name: String, + pub(crate) extension_parameters: models::MachineExtensionUpdate, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name, + &self.extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineExtension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) extension_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name, + &self.extension_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MachineExtensionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn upgrade_extensions( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + extension_upgrade_parameters: impl Into, + ) -> upgrade_extensions::Builder { + upgrade_extensions::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + extension_upgrade_parameters: extension_upgrade_parameters.into(), + } + } +} +pub mod upgrade_extensions { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + pub(crate) extension_upgrade_parameters: models::MachineExtensionUpgrade, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/upgradeExtensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension_upgrade_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.HybridCompute/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_scopes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + scope_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + scope_name: scope_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + scope_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + scope_name: scope_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + scope_name: impl Into, + private_link_scope_tags: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + scope_name: scope_name.into(), + private_link_scope_tags: private_link_scope_tags.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + scope_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + scope_name: scope_name.into(), + } + } + pub fn get_validation_details( + &self, + location: impl Into, + subscription_id: impl Into, + private_link_scope_id: impl Into, + ) -> get_validation_details::Builder { + get_validation_details::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + private_link_scope_id: private_link_scope_id.into(), + } + } + pub fn get_validation_details_for_machine( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + machine_name: impl Into, + ) -> get_validation_details_for_machine::Builder { + get_validation_details_for_machine::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + machine_name: machine_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/privateLinkScopes", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScopeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScopeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) scope_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.scope_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScope = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::HybridComputePrivateLinkScope), + Created201(models::HybridComputePrivateLinkScope), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) scope_name: String, + pub(crate) parameters: models::HybridComputePrivateLinkScope, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.scope_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScope = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScope = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) scope_name: String, + pub(crate) private_link_scope_tags: models::TagsResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.scope_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.private_link_scope_tags).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridComputePrivateLinkScope = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) scope_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.scope_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_validation_details { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + pub(crate) private_link_scope_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/locations/{}/privateLinkScopes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.private_link_scope_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkScopeValidationDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_validation_details_for_machine { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) machine_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/privateLinkScopes/current", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkScopeValidationDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_private_link_scope( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + ) -> list_by_private_link_scope::Builder { + list_by_private_link_scope::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + group_name: group_name.into(), + } + } + } + pub mod list_by_private_link_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.scope_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + pub(crate) group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateLinkResources/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . scope_name , & self . group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn list_by_private_link_scope( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + scope_name: impl Into, + ) -> list_by_private_link_scope::Builder { + list_by_private_link_scope::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + scope_name: scope_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . scope_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . scope_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . scope_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_private_link_scope { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) scope_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . scope_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-10"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/hybridconnectivity/Cargo.toml b/services/mgmt/hybridconnectivity/Cargo.toml index 77f4586715..4173f795cf 100644 --- a/services/mgmt/hybridconnectivity/Cargo.toml +++ b/services/mgmt/hybridconnectivity/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hybridconnectivity" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,7 +24,7 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag"] +features = ["no-default-tag", "package-2022-05-01-preview"] [features] default = ["package-2021-10-06-preview", "enable_reqwest"] @@ -32,3 +32,4 @@ enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-2021-10-06-preview" = [] +"package-2022-05-01-preview" = [] diff --git a/services/mgmt/hybridconnectivity/README.md b/services/mgmt/hybridconnectivity/README.md index b9698e700f..b34bae2282 100644 --- a/services/mgmt/hybridconnectivity/README.md +++ b/services/mgmt/hybridconnectivity/README.md @@ -10,4 +10,5 @@ The default tag is `package-2021-10-06-preview`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2021-10-06-preview` has 7 operations from 1 API versions: `2021-10-06-preview`. Use crate feature `package-2021-10-06-preview` to enable. The operations will be in the `package_2021_10_06_preview` module. \ No newline at end of file +- `package-2021-10-06-preview` has 7 operations from 1 API versions: `2021-10-06-preview`. Use crate feature `package-2021-10-06-preview` to enable. The operations will be in the `package_2021_10_06_preview` module. +- `package-2022-05-01-preview` has 8 operations from 1 API versions: `2022-05-01-preview`. Use crate feature `package-2022-05-01-preview` to enable. The operations will be in the `package_2022_05_01_preview` module. \ No newline at end of file diff --git a/services/mgmt/hybridconnectivity/src/lib.rs b/services/mgmt/hybridconnectivity/src/lib.rs index 35c1ad91a2..67c71aae85 100644 --- a/services/mgmt/hybridconnectivity/src/lib.rs +++ b/services/mgmt/hybridconnectivity/src/lib.rs @@ -7,3 +7,7 @@ pub mod package_2021_10_06_preview; #[cfg(all(feature = "package-2021-10-06-preview", not(feature = "no-default-tag")))] pub use package_2021_10_06_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-05-01-preview")] +pub mod package_2022_05_01_preview; +#[cfg(all(feature = "package-2022-05-01-preview", not(feature = "no-default-tag")))] +pub use package_2022_05_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/mod.rs b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/models.rs b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/models.rs new file mode 100644 index 0000000000..761785d47e --- /dev/null +++ b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/models.rs @@ -0,0 +1,387 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The AAD Profile"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AadProfileProperties { + #[doc = "The arc ingress gateway server app id."] + #[serde(rename = "serverId")] + pub server_id: String, + #[doc = "The target resource home tenant id."] + #[serde(rename = "tenantId")] + pub tenant_id: String, +} +impl AadProfileProperties { + pub fn new(server_id: String, tenant_id: String) -> Self { + Self { server_id, tenant_id } + } +} +#[doc = "The endpoint access for the target resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointAccessResource { + #[doc = "Azure relay hybrid connection access properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub relay: Option, +} +impl EndpointAccessResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Endpoint details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointProperties { + #[doc = "The type of endpoint."] + #[serde(rename = "type")] + pub type_: endpoint_properties::Type, + #[doc = "The resource Id of the connectivity endpoint (optional)."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The resource provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl EndpointProperties { + pub fn new(type_: endpoint_properties::Type) -> Self { + Self { + type_, + resource_id: None, + provisioning_state: None, + } + } +} +pub mod endpoint_properties { + use super::*; + #[doc = "The type of endpoint."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "default")] + Default, + #[serde(rename = "custom")] + Custom, + } +} +#[doc = "The endpoint for the target resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Endpoint details"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EndpointResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list of endpoints."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointsList { + #[doc = "The link used to get the next page of endpoints list."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of endpoint."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl EndpointsList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The ingress gateway access credentials"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IngressGatewayResource { + #[doc = "Azure relay hybrid connection access properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub relay: Option, + #[doc = "Ingress gateway profile"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ingress: Option, +} +impl IngressGatewayResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Ingress gateway profile"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IngressProfileProperties { + #[doc = "The ingress hostname."] + pub hostname: String, + #[doc = "The AAD Profile"] + #[serde(rename = "aadProfile")] + pub aad_profile: AadProfileProperties, +} +impl IngressProfileProperties { + pub fn new(hostname: String, aad_profile: AadProfileProperties) -> Self { + Self { hostname, aad_profile } + } +} +#[doc = "Represent ManageProxy Request object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedProxyRequest { + #[doc = "The name of the service."] + pub service: String, + #[doc = "The target host name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hostname: Option, +} +impl ManagedProxyRequest { + pub fn new(service: String) -> Self { + Self { service, hostname: None } + } +} +#[doc = "Managed Proxy"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedProxyResource { + #[doc = "The short lived proxy name."] + pub proxy: String, + #[doc = "The expiration time of short lived proxy name in unix epoch."] + #[serde(rename = "expiresOn")] + pub expires_on: i64, +} +impl ManagedProxyResource { + pub fn new(proxy: String, expires_on: i64) -> Self { + Self { proxy, expires_on } + } +} +#[doc = "Details of a REST API operation, returned from the Resource Provider Operations API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Localized display information for this particular operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Localized display information for this particular operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The short, localized friendly description of the operation; suitable for tool tips and detailed views."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure relay hybrid connection access properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelayNamespaceAccessProperties { + #[doc = "The namespace name."] + #[serde(rename = "namespaceName")] + pub namespace_name: String, + #[doc = "The suffix domain name of relay namespace."] + #[serde(rename = "namespaceNameSuffix")] + pub namespace_name_suffix: String, + #[doc = "Azure Relay hybrid connection name for the resource."] + #[serde(rename = "hybridConnectionName")] + pub hybrid_connection_name: String, + #[doc = "Access key for hybrid connection."] + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[doc = "The expiration of access key in unix time."] + #[serde(rename = "expiresOn", default, skip_serializing_if = "Option::is_none")] + pub expires_on: Option, +} +impl RelayNamespaceAccessProperties { + pub fn new(namespace_name: String, namespace_name_suffix: String, hybrid_connection_name: String) -> Self { + Self { + namespace_name, + namespace_name_suffix, + hybrid_connection_name, + access_key: None, + expires_on: None, + } + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/operations.rs b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/operations.rs new file mode 100644 index 0000000000..3d27be6e41 --- /dev/null +++ b/services/mgmt/hybridconnectivity/src/package_2022_05_01_preview/operations.rs @@ -0,0 +1,793 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn endpoints(&self) -> endpoints::Client { + endpoints::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Endpoints_List(#[from] endpoints::list::Error), + #[error(transparent)] + Endpoints_Get(#[from] endpoints::get::Error), + #[error(transparent)] + Endpoints_CreateOrUpdate(#[from] endpoints::create_or_update::Error), + #[error(transparent)] + Endpoints_Update(#[from] endpoints::update::Error), + #[error(transparent)] + Endpoints_Delete(#[from] endpoints::delete::Error), + #[error(transparent)] + Endpoints_ListCredentials(#[from] endpoints::list_credentials::Error), + #[error(transparent)] + Endpoints_ListManagedProxyDetails(#[from] endpoints::list_managed_proxy_details::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.HybridConnectivity/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod endpoints { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, resource_uri: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + } + } + pub fn get(&self, resource_uri: impl Into, endpoint_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + } + } + pub fn create_or_update( + &self, + resource_uri: impl Into, + endpoint_name: impl Into, + endpoint_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + endpoint_resource: endpoint_resource.into(), + } + } + pub fn update( + &self, + resource_uri: impl Into, + endpoint_name: impl Into, + endpoint_resource: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + endpoint_resource: endpoint_resource.into(), + } + } + pub fn delete(&self, resource_uri: impl Into, endpoint_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + } + } + pub fn list_credentials(&self, resource_uri: impl Into, endpoint_name: impl Into) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + expiresin: None, + } + } + pub fn list_managed_proxy_details( + &self, + resource_uri: impl Into, + endpoint_name: impl Into, + managed_proxy_request: impl Into, + ) -> list_managed_proxy_details::Builder { + list_managed_proxy_details::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + endpoint_name: endpoint_name.into(), + managed_proxy_request: managed_proxy_request.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints", + self.client.endpoint(), + &self.resource_uri + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint_resource: models::EndpointResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + pub(crate) endpoint_resource: models::EndpointResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.endpoint_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + pub(crate) expiresin: Option, + } + impl Builder { + pub fn expiresin(mut self, expiresin: i64) -> Self { + self.expiresin = Some(expiresin); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}/listCredentials", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + if let Some(expiresin) = &self.expiresin { + url.query_pairs_mut().append_pair("expiresin", &expiresin.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointAccessResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_managed_proxy_details { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) endpoint_name: String, + pub(crate) managed_proxy_request: models::ManagedProxyRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.HybridConnectivity/endpoints/{}/listManagedProxyDetails", + self.client.endpoint(), + &self.resource_uri, + &self.endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.managed_proxy_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ManagedProxyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/hybriddatamanager/Cargo.toml b/services/mgmt/hybriddatamanager/Cargo.toml index a387c1b779..24f874cb69 100644 --- a/services/mgmt/hybriddatamanager/Cargo.toml +++ b/services/mgmt/hybriddatamanager/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hybriddatamanager" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/hybridkubernetes/Cargo.toml b/services/mgmt/hybridkubernetes/Cargo.toml index a47f960243..4bb33eed2d 100644 --- a/services/mgmt/hybridkubernetes/Cargo.toml +++ b/services/mgmt/hybridkubernetes/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hybridkubernetes" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/hybridnetwork/Cargo.toml b/services/mgmt/hybridnetwork/Cargo.toml index e8f28d21d4..2008314203 100644 --- a/services/mgmt/hybridnetwork/Cargo.toml +++ b/services/mgmt/hybridnetwork/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_hybridnetwork" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/imagebuilder/Cargo.toml b/services/mgmt/imagebuilder/Cargo.toml index b995b45d9a..b8e6f4f438 100644 --- a/services/mgmt/imagebuilder/Cargo.toml +++ b/services/mgmt/imagebuilder/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_imagebuilder" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/intune/Cargo.toml b/services/mgmt/intune/Cargo.toml index 141c04a623..6dfd8a3a61 100644 --- a/services/mgmt/intune/Cargo.toml +++ b/services/mgmt/intune/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_intune" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/iotcentral/Cargo.toml b/services/mgmt/iotcentral/Cargo.toml index f988093356..59a4978638 100644 --- a/services/mgmt/iotcentral/Cargo.toml +++ b/services/mgmt/iotcentral/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_iotcentral" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/iothub/Cargo.toml b/services/mgmt/iothub/Cargo.toml index 90c2f41663..0498a8a38e 100644 --- a/services/mgmt/iothub/Cargo.toml +++ b/services/mgmt/iothub/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_iothub" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/keyvault/Cargo.toml b/services/mgmt/keyvault/Cargo.toml index a3f0a70ec8..5d4cb8e5f8 100644 --- a/services/mgmt/keyvault/Cargo.toml +++ b/services/mgmt/keyvault/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_keyvault" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/kubernetesconfiguration/Cargo.toml b/services/mgmt/kubernetesconfiguration/Cargo.toml index 929a019140..b6deaf8007 100644 --- a/services/mgmt/kubernetesconfiguration/Cargo.toml +++ b/services/mgmt/kubernetesconfiguration/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_kubernetesconfiguration" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,7 +24,7 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-preview-2022-04", "package-preview-2022-01", "package-preview-2021-11", "package-2021-09"] +features = ["no-default-tag", "package-preview-2022-04", "package-preview-2022-01-15", "package-preview-2022-01", "package-preview-2021-11"] [features] default = ["package-2022-03", "enable_reqwest"] @@ -33,6 +33,7 @@ enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-preview-2022-04" = [] "package-2022-03" = [] +"package-preview-2022-01-15" = [] "package-preview-2022-01" = [] "package-preview-2021-11" = [] "package-2021-09" = [] diff --git a/services/mgmt/kubernetesconfiguration/README.md b/services/mgmt/kubernetesconfiguration/README.md index 2b307ed126..71c3389d38 100644 --- a/services/mgmt/kubernetesconfiguration/README.md +++ b/services/mgmt/kubernetesconfiguration/README.md @@ -12,6 +12,7 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-preview-2022-04` has 30 operations from 2 API versions: `2022-03-01`, `2022-04-02-preview`. Use crate feature `package-preview-2022-04` to enable. The operations will be in the `package_preview_2022_04` module. - `package-2022-03` has 18 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03` to enable. The operations will be in the `package_2022_03` module. +- `package-preview-2022-01-15` has 22 operations from 2 API versions: `2022-01-01-preview`, `2022-01-15-preview`. Use crate feature `package-preview-2022-01-15` to enable. The operations will be in the `package_preview_2022_01_15` module. - `package-preview-2022-01` has 22 operations from 1 API versions: `2022-01-01-preview`. Use crate feature `package-preview-2022-01` to enable. The operations will be in the `package_preview_2022_01` module. - `package-preview-2021-11` has 22 operations from 1 API versions: `2021-11-01-preview`. Use crate feature `package-preview-2021-11` to enable. The operations will be in the `package_preview_2021_11` module. - `package-2021-09` has 8 operations from 1 API versions: `2021-09-01`. Use crate feature `package-2021-09` to enable. The operations will be in the `package_2021_09` module. \ No newline at end of file diff --git a/services/mgmt/kubernetesconfiguration/src/lib.rs b/services/mgmt/kubernetesconfiguration/src/lib.rs index 177bb9cfee..a1b4b8d973 100644 --- a/services/mgmt/kubernetesconfiguration/src/lib.rs +++ b/services/mgmt/kubernetesconfiguration/src/lib.rs @@ -11,6 +11,10 @@ pub use package_preview_2022_04::{models, operations, operations::Client, operat pub mod package_2022_03; #[cfg(all(feature = "package-2022-03", not(feature = "no-default-tag")))] pub use package_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-preview-2022-01-15")] +pub mod package_preview_2022_01_15; +#[cfg(all(feature = "package-preview-2022-01-15", not(feature = "no-default-tag")))] +pub use package_preview_2022_01_15::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-preview-2022-01")] pub mod package_preview_2022_01; #[cfg(all(feature = "package-preview-2022-01", not(feature = "no-default-tag")))] diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/mod.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/models.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/models.rs new file mode 100644 index 0000000000..747a93d7f5 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/models.rs @@ -0,0 +1,1271 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Parameters to reconcile to the GitRepository source kind type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BucketDefinition { + #[doc = "The URL to sync for the flux configuration S3 bucket."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The bucket name to sync from the url endpoint for the flux configuration."] + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[doc = "Specify whether to use insecure communication when puling data from the S3 bucket."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub insecure: Option, + #[doc = "The maximum time to attempt to reconcile the cluster git repository source with the remote."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the cluster git repository source with the remote."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "Plaintext access key used to securely access the S3 bucket"] + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[doc = "Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets."] + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +impl BucketDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to reconcile to the GitRepository source kind type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BucketPatchDefinition { + #[doc = "The URL to sync for the flux configuration S3 bucket."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The bucket name to sync from the url endpoint for the flux configuration."] + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[doc = "Specify whether to use insecure communication when puling data from the S3 bucket."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub insecure: Option, + #[doc = "The maximum time to attempt to reconcile the cluster git repository source with the remote."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the cluster git repository source with the remote."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "Plaintext access key used to securely access the S3 bucket"] + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[doc = "Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets."] + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +impl BucketPatchDefinition { + pub fn new() -> Self { + Self::default() + } +} +pub type ChartValues = String; +pub type ChartVersion = String; +#[doc = "Extension scope settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterScopeSettings { + #[doc = "Describes if multiple instances of the extension are allowed"] + #[serde(rename = "allowMultipleInstances", default, skip_serializing_if = "Option::is_none")] + pub allow_multiple_instances: Option, + #[doc = "Default extension release namespace"] + #[serde(rename = "defaultReleaseNamespace", default, skip_serializing_if = "Option::is_none")] + pub default_release_namespace: Option, +} +impl ClusterScopeSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Compliance Status details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ComplianceStatus { + #[doc = "The compliance state of the configuration."] + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[doc = "Datetime the configuration was last applied."] + #[serde(rename = "lastConfigApplied", default, skip_serializing_if = "Option::is_none")] + pub last_config_applied: Option, + #[doc = "Message from when the configuration was applied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Level of the message."] + #[serde(rename = "messageLevel", default, skip_serializing_if = "Option::is_none")] + pub message_level: Option, +} +impl ComplianceStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod compliance_status { + use super::*; + #[doc = "The compliance state of the configuration."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComplianceState { + Pending, + Compliant, + Noncompliant, + Installed, + Failed, + } + #[doc = "Level of the message."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MessageLevel { + Error, + Warning, + Information, + } +} +#[doc = "Name-value pairs of protected configuration settings for the configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConfigurationProtectedSettings {} +impl ConfigurationProtectedSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DependsOnDefinition { + #[doc = "Name of the kustomization to claim dependency on"] + #[serde(rename = "kustomizationName", default, skip_serializing_if = "Option::is_none")] + pub kustomization_name: Option, +} +impl DependsOnDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Extension object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Extension { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of an Extension resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Extension { + pub fn new() -> Self { + Self::default() + } +} +pub mod extension { + use super::*; + #[doc = "Properties of an Extension resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher."] + #[serde(rename = "extensionType", default, skip_serializing_if = "Option::is_none")] + pub extension_type: Option, + #[doc = "Flag to note if this extension participates in auto upgrade of minor version, or not."] + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[doc = "ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'."] + #[serde(rename = "releaseTrain", default, skip_serializing_if = "Option::is_none")] + pub release_train: Option, + #[doc = "Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Scope of the extension. It can be either Cluster or Namespace; but not both."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Configuration settings, as name-value pairs for configuring this extension."] + #[serde(rename = "configurationSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_settings: Option, + #[doc = "Configuration settings that are sensitive, as name-value pairs for configuring this extension."] + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[doc = "The provisioning state of the resource."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Status from this extension."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[doc = "The error detail."] + #[serde(rename = "errorInfo", default, skip_serializing_if = "Option::is_none")] + pub error_info: Option, + #[doc = "Custom Location settings properties."] + #[serde(rename = "customLocationSettings", default, skip_serializing_if = "Option::is_none")] + pub custom_location_settings: Option, + #[doc = "Uri of the Helm package"] + #[serde(rename = "packageUri", default, skip_serializing_if = "Option::is_none")] + pub package_uri: Option, + #[doc = "Identity of the Extension resource in an AKS cluster"] + #[serde(rename = "aksAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub aks_assigned_identity: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "Identity of the Extension resource in an AKS cluster"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct AksAssignedIdentity { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identity type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + } + impl AksAssignedIdentity { + pub fn new() -> Self { + Self::default() + } + } + pub mod aks_assigned_identity { + use super::*; + #[doc = "The identity type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } + } + } +} +#[doc = "Status from the extension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionStatus { + #[doc = "Status code provided by the Extension"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Short description of status of the extension."] + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[doc = "Level of the status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, + #[doc = "Detailed message of the status from the Extension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "DateLiteral (per ISO8601) noting the time of installation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, +} +impl ExtensionStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod extension_status { + use super::*; + #[doc = "Level of the status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Error, + Warning, + Information, + } + impl Default for Level { + fn default() -> Self { + Self::Information + } + } +} +#[doc = "Represents an Extension Type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionType { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of the connected cluster."] + pub properties: ExtensionTypeProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl ExtensionType { + pub fn new(properties: ExtensionTypeProperties) -> Self { + Self { + proxy_resource: ProxyResource::default(), + properties, + system_data: None, + } + } +} +#[doc = "List Extension Types"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionTypeList { + #[doc = "The list of Extension Types"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link to fetch the next page of Extension Types"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExtensionTypeList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the connected cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionTypeProperties { + #[doc = "Extension release train: preview or stable"] + #[serde(rename = "releaseTrains", default, skip_serializing_if = "Vec::is_empty")] + pub release_trains: Vec, + #[doc = "Cluster types"] + #[serde(rename = "clusterTypes", default, skip_serializing_if = "Vec::is_empty")] + pub cluster_types: Vec, + #[doc = "Extension scopes"] + #[serde(rename = "supportedScopes", default, skip_serializing_if = "Option::is_none")] + pub supported_scopes: Option, +} +impl ExtensionTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List versions for an Extension"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionVersionList { + #[doc = "Versions available for this Extension Type"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link to fetch the next page of Extension Types"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl ExtensionVersionList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtensionsList { + #[doc = "List of Extensions within a Kubernetes cluster."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of extension objects, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExtensionsList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Compliance state of the cluster object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FluxComplianceStateDefinition { + Compliant, + #[serde(rename = "Non-Compliant")] + NonCompliant, + Pending, + Suspended, + Unknown, +} +impl Default for FluxComplianceStateDefinition { + fn default() -> Self { + Self::Unknown + } +} +#[doc = "The Flux Configuration object returned in Get & Put response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FluxConfiguration { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties to create a Flux Configuration resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl FluxConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub mod flux_configuration { + use super::*; + #[doc = "Properties to create a Flux Configuration resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Scope at which the configuration will be installed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[doc = "Source Kind to pull the configuration data from."] + #[serde(rename = "sourceKind", default, skip_serializing_if = "Option::is_none")] + pub source_kind: Option, + #[doc = "Whether this configuration should suspend its reconciliation of its kustomizations and sources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub suspend: Option, + #[doc = "Parameters to reconcile to the GitRepository source kind type."] + #[serde(rename = "gitRepository", default, skip_serializing_if = "Option::is_none")] + pub git_repository: Option, + #[doc = "Parameters to reconcile to the GitRepository source kind type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bucket: Option, + #[doc = "Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kustomizations: Option, + #[doc = "Key-value pairs of protected configuration settings for the configuration"] + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[doc = "Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub statuses: Vec, + #[doc = "Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user)."] + #[serde(rename = "repositoryPublicKey", default, skip_serializing_if = "Option::is_none")] + pub repository_public_key: Option, + #[doc = "Branch and SHA of the last source commit synced with the cluster."] + #[serde(rename = "lastSourceUpdatedCommitId", default, skip_serializing_if = "Option::is_none")] + pub last_source_updated_commit_id: Option, + #[doc = "Datetime the fluxConfiguration last synced its source on the cluster."] + #[serde(rename = "lastSourceUpdatedAt", default, skip_serializing_if = "Option::is_none")] + pub last_source_updated_at: Option, + #[doc = "Compliance state of the cluster object."] + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[doc = "The provisioning state of the resource."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Error message returned to the user in the case of provisioning failure."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The Flux Configuration Patch Request object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FluxConfigurationPatch { + #[doc = "Updatable properties of an Flux Configuration Patch Request"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl FluxConfigurationPatch { + pub fn new() -> Self { + Self::default() + } +} +pub mod flux_configuration_patch { + use super::*; + #[doc = "Updatable properties of an Flux Configuration Patch Request"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Source Kind to pull the configuration data from."] + #[serde(rename = "sourceKind", default, skip_serializing_if = "Option::is_none")] + pub source_kind: Option, + #[doc = "Whether this configuration should suspend its reconciliation of its kustomizations and sources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub suspend: Option, + #[doc = "Parameters to reconcile to the GitRepository source kind type."] + #[serde(rename = "gitRepository", default, skip_serializing_if = "Option::is_none")] + pub git_repository: Option, + #[doc = "Parameters to reconcile to the GitRepository source kind type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bucket: Option, + #[doc = "Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kustomizations: Option, + #[doc = "Key-value pairs of protected configuration settings for the configuration"] + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FluxConfigurationsList { + #[doc = "List of Flux Configurations within a Kubernetes cluster."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of configuration objects, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl FluxConfigurationsList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to reconcile to the GitRepository source kind type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GitRepositoryDefinition { + #[doc = "The URL to sync for the flux configuration git repository."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The maximum time to attempt to reconcile the cluster git repository source with the remote."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the cluster git repository source with the remote."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "The source reference for the GitRepository object."] + #[serde(rename = "repositoryRef", default, skip_serializing_if = "Option::is_none")] + pub repository_ref: Option, + #[doc = "Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH"] + #[serde(rename = "sshKnownHosts", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts: Option, + #[doc = "Plaintext HTTPS username used to access private git repositories over HTTPS"] + #[serde(rename = "httpsUser", default, skip_serializing_if = "Option::is_none")] + pub https_user: Option, + #[doc = "Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS"] + #[serde(rename = "httpsCACert", default, skip_serializing_if = "Option::is_none")] + pub https_ca_cert: Option, + #[doc = "Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets."] + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +impl GitRepositoryDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to reconcile to the GitRepository source kind type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GitRepositoryPatchDefinition { + #[doc = "The URL to sync for the flux configuration git repository."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The maximum time to attempt to reconcile the cluster git repository source with the remote."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the cluster git repository source with the remote."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "The source reference for the GitRepository object."] + #[serde(rename = "repositoryRef", default, skip_serializing_if = "Option::is_none")] + pub repository_ref: Option, + #[doc = "Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH"] + #[serde(rename = "sshKnownHosts", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts: Option, + #[doc = "Plaintext HTTPS username used to access private git repositories over HTTPS"] + #[serde(rename = "httpsUser", default, skip_serializing_if = "Option::is_none")] + pub https_user: Option, + #[doc = "Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS"] + #[serde(rename = "httpsCACert", default, skip_serializing_if = "Option::is_none")] + pub https_ca_cert: Option, + #[doc = "Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets."] + #[serde(rename = "localAuthRef", default, skip_serializing_if = "Option::is_none")] + pub local_auth_ref: Option, +} +impl GitRepositoryPatchDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties for Helm operator."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HelmOperatorProperties { + #[doc = "Version of the operator Helm chart."] + #[serde(rename = "chartVersion", default, skip_serializing_if = "Option::is_none")] + pub chart_version: Option, + #[doc = "Values override for the operator Helm chart."] + #[serde(rename = "chartValues", default, skip_serializing_if = "Option::is_none")] + pub chart_values: Option, +} +impl HelmOperatorProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HelmReleasePropertiesDefinition { + #[doc = "The revision number of the last released object change"] + #[serde(rename = "lastRevisionApplied", default, skip_serializing_if = "Option::is_none")] + pub last_revision_applied: Option, + #[doc = "Object reference to a Kubernetes object on a cluster"] + #[serde(rename = "helmChartRef", default, skip_serializing_if = "Option::is_none")] + pub helm_chart_ref: Option, + #[doc = "Total number of times that the HelmRelease failed to install or upgrade"] + #[serde(rename = "failureCount", default, skip_serializing_if = "Option::is_none")] + pub failure_count: Option, + #[doc = "Number of times that the HelmRelease failed to install"] + #[serde(rename = "installFailureCount", default, skip_serializing_if = "Option::is_none")] + pub install_failure_count: Option, + #[doc = "Number of times that the HelmRelease failed to upgrade"] + #[serde(rename = "upgradeFailureCount", default, skip_serializing_if = "Option::is_none")] + pub upgrade_failure_count: Option, +} +impl HelmReleasePropertiesDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Identity { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identity type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Identity { + pub fn new() -> Self { + Self::default() + } +} +pub mod identity { + use super::*; + #[doc = "The identity type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } +} +#[doc = "The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KustomizationDefinition { + #[doc = "The path in the source reference to reconcile on the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation."] + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[doc = "The maximum time to attempt to reconcile the Kustomization on the cluster."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the Kustomization on the cluster."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation."] + #[serde(rename = "retryIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub retry_interval_in_seconds: Option, + #[doc = "Enable/disable garbage collections of Kubernetes objects created by this Kustomization."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prune: Option, + #[doc = "Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +impl KustomizationDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KustomizationPatchDefinition { + #[doc = "The path in the source reference to reconcile on the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation."] + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[doc = "The maximum time to attempt to reconcile the Kustomization on the cluster."] + #[serde(rename = "timeoutInSeconds", default, skip_serializing_if = "Option::is_none")] + pub timeout_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the Kustomization on the cluster."] + #[serde(rename = "syncIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub sync_interval_in_seconds: Option, + #[doc = "The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation."] + #[serde(rename = "retryIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub retry_interval_in_seconds: Option, + #[doc = "Enable/disable garbage collections of Kubernetes objects created by this Kustomization."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prune: Option, + #[doc = "Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub force: Option, +} +impl KustomizationPatchDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KustomizationValidationDefinition { + #[serde(rename = "none")] + None, + #[serde(rename = "client")] + Client, + #[serde(rename = "server")] + Server, +} +impl Default for KustomizationValidationDefinition { + fn default() -> Self { + Self::None + } +} +#[doc = "Object reference to a Kubernetes object on a cluster"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ObjectReferenceDefinition { + #[doc = "Name of the object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Namespace of the object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, +} +impl ObjectReferenceDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Status condition of Kubernetes object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ObjectStatusConditionDefinition { + #[doc = "Last time this status condition has changed"] + #[serde(rename = "lastTransitionTime", default, skip_serializing_if = "Option::is_none")] + pub last_transition_time: Option, + #[doc = "A more verbose description of the object status condition"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Reason for the specified status condition type status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[doc = "Status of the Kubernetes object condition type"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Object status condition type for this object"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ObjectStatusConditionDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Statuses of objects deployed by the user-specified kustomizations from the git repository."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ObjectStatusDefinition { + #[doc = "Name of the applied object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Namespace of the applied object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[doc = "Kind of the applied object"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Compliance state of the cluster object."] + #[serde(rename = "complianceState", default, skip_serializing_if = "Option::is_none")] + pub compliance_state: Option, + #[doc = "Object reference to a Kubernetes object on a cluster"] + #[serde(rename = "appliedBy", default, skip_serializing_if = "Option::is_none")] + pub applied_by: Option, + #[doc = "List of Kubernetes object status conditions present on the cluster"] + #[serde(rename = "statusConditions", default, skip_serializing_if = "Vec::is_empty")] + pub status_conditions: Vec, + #[serde(rename = "helmReleaseProperties", default, skip_serializing_if = "Option::is_none")] + pub helm_release_properties: Option, +} +impl ObjectStatusDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The async operations in progress, in the cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationStatusList { + #[doc = "List of async operations in progress, in the cluster."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of Operation Result objects, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationStatusList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current status of an async operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusResult { + #[doc = "Fully qualified ID for the async operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the async operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation status."] + pub status: String, + #[doc = "Additional information, if available."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl OperationStatusResult { + pub fn new(status: String) -> Self { + Self { + id: None, + name: None, + status, + properties: None, + error: None, + } + } +} +#[doc = "Scope at which the operator will be installed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperatorScopeDefinition { + #[serde(rename = "cluster")] + Cluster, + #[serde(rename = "namespace")] + Namespace, +} +impl Default for OperatorScopeDefinition { + fn default() -> Self { + Self::Cluster + } +} +#[doc = "Type of the operator"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OperatorTypeDefinition { + Flux, +} +#[doc = "The provisioning state of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningStateDefinition { + Succeeded, + Failed, + Canceled, + Creating, + Updating, + Deleting, +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The source reference for the GitRepository object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RepositoryRefDefinition { + #[doc = "The git repository branch name to checkout."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[doc = "The git repository tag name to checkout. This takes precedence over branch."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[doc = "The semver range used to match against git repository tags. This takes precedence over tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub semver: Option, + #[doc = "The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit: Option, +} +impl RepositoryRefDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Supported operation of this resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceProviderOperation { + #[doc = "Operation name, in format of {provider}/{resource}/{operation}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display metadata associated with the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The flag that indicates whether the operation applies to data plane."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Origin of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +impl ResourceProviderOperation { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_provider_operation { + use super::*; + #[doc = "Display metadata associated with the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Resource provider: Microsoft KubernetesConfiguration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource on which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Type of operation: get, read, delete, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of this operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Result of the request to list operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceProviderOperationList { + #[doc = "List of operations supported by this resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to the next set of results, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceProviderOperationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Scope of the extension. It can be either Cluster or Namespace; but not both."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Scope { + #[doc = "Specifies that the scope of the extension is Cluster"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cluster: Option, + #[doc = "Specifies that the scope of the extension is Namespace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, +} +impl Scope { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifies that the scope of the extension is Cluster"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScopeCluster { + #[doc = "Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created"] + #[serde(rename = "releaseNamespace", default, skip_serializing_if = "Option::is_none")] + pub release_namespace: Option, +} +impl ScopeCluster { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Scope at which the configuration will be installed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ScopeDefinition { + #[serde(rename = "cluster")] + Cluster, + #[serde(rename = "namespace")] + Namespace, +} +impl Default for ScopeDefinition { + fn default() -> Self { + Self::Cluster + } +} +#[doc = "Specifies that the scope of the extension is Namespace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScopeNamespace { + #[doc = "Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created"] + #[serde(rename = "targetNamespace", default, skip_serializing_if = "Option::is_none")] + pub target_namespace: Option, +} +impl ScopeNamespace { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The SourceControl Configuration object returned in Get & Put response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SourceControlConfiguration { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties to create a Source Control Configuration resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl SourceControlConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub mod source_control_configuration { + use super::*; + #[doc = "Properties to create a Source Control Configuration resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Url of the SourceControl Repository."] + #[serde(rename = "repositoryUrl", default, skip_serializing_if = "Option::is_none")] + pub repository_url: Option, + #[doc = "The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only."] + #[serde(rename = "operatorNamespace", default, skip_serializing_if = "Option::is_none")] + pub operator_namespace: Option, + #[doc = "Instance name of the operator - identifying the specific configuration."] + #[serde(rename = "operatorInstanceName", default, skip_serializing_if = "Option::is_none")] + pub operator_instance_name: Option, + #[doc = "Type of the operator"] + #[serde(rename = "operatorType", default, skip_serializing_if = "Option::is_none")] + pub operator_type: Option, + #[doc = "Any Parameters for the Operator instance in string format."] + #[serde(rename = "operatorParams", default, skip_serializing_if = "Option::is_none")] + pub operator_params: Option, + #[doc = "Name-value pairs of protected configuration settings for the configuration"] + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + #[doc = "Scope at which the operator will be installed."] + #[serde(rename = "operatorScope", default, skip_serializing_if = "Option::is_none")] + pub operator_scope: Option, + #[doc = "Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user)."] + #[serde(rename = "repositoryPublicKey", default, skip_serializing_if = "Option::is_none")] + pub repository_public_key: Option, + #[doc = "Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances"] + #[serde(rename = "sshKnownHostsContents", default, skip_serializing_if = "Option::is_none")] + pub ssh_known_hosts_contents: Option, + #[doc = "Option to enable Helm Operator for this git configuration."] + #[serde(rename = "enableHelmOperator", default, skip_serializing_if = "Option::is_none")] + pub enable_helm_operator: Option, + #[doc = "Properties for Helm operator."] + #[serde(rename = "helmOperatorProperties", default, skip_serializing_if = "Option::is_none")] + pub helm_operator_properties: Option, + #[doc = "The provisioning state of the resource provider."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Compliance Status details"] + #[serde(rename = "complianceStatus", default, skip_serializing_if = "Option::is_none")] + pub compliance_status: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "The provisioning state of the resource provider."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Accepted, + Deleting, + Running, + Succeeded, + Failed, + } + } +} +#[doc = "Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SourceControlConfigurationList { + #[doc = "List of Source Control Configurations within a Kubernetes cluster."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of configuration objects, if any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SourceControlConfigurationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Source Kind to pull the configuration data from."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SourceKindDefinition { + GitRepository, + Bucket, +} +#[doc = "Extension scopes"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedScopes { + #[doc = "Default extension scopes: cluster or namespace"] + #[serde(rename = "defaultScope", default, skip_serializing_if = "Option::is_none")] + pub default_scope: Option, + #[doc = "Extension scope settings"] + #[serde(rename = "clusterScopeSettings", default, skip_serializing_if = "Option::is_none")] + pub cluster_scope_settings: Option, +} +impl SupportedScopes { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Extension Patch Request object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchExtension { + #[doc = "Updatable properties of an Extension Patch Request"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PatchExtension { + pub fn new() -> Self { + Self::default() + } +} +pub mod patch_extension { + use super::*; + #[doc = "Updatable properties of an Extension Patch Request"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Flag to note if this extension participates in auto upgrade of minor version, or not."] + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[doc = "ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'."] + #[serde(rename = "releaseTrain", default, skip_serializing_if = "Option::is_none")] + pub release_train: Option, + #[doc = "Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Configuration settings, as name-value pairs for configuring this extension."] + #[serde(rename = "configurationSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_settings: Option, + #[doc = "Configuration settings that are sensitive, as name-value pairs for configuring this extension."] + #[serde(rename = "configurationProtectedSettings", default, skip_serializing_if = "Option::is_none")] + pub configuration_protected_settings: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/operations.rs b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/operations.rs new file mode 100644 index 0000000000..237b553cb3 --- /dev/null +++ b/services/mgmt/kubernetesconfiguration/src/package_preview_2022_01_15/operations.rs @@ -0,0 +1,2317 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn cluster_extension_type(&self) -> cluster_extension_type::Client { + cluster_extension_type::Client(self.clone()) + } + pub fn cluster_extension_types(&self) -> cluster_extension_types::Client { + cluster_extension_types::Client(self.clone()) + } + pub fn extension_type_versions(&self) -> extension_type_versions::Client { + extension_type_versions::Client(self.clone()) + } + pub fn extensions(&self) -> extensions::Client { + extensions::Client(self.clone()) + } + pub fn flux_config_operation_status(&self) -> flux_config_operation_status::Client { + flux_config_operation_status::Client(self.clone()) + } + pub fn flux_configurations(&self) -> flux_configurations::Client { + flux_configurations::Client(self.clone()) + } + pub fn location_extension_types(&self) -> location_extension_types::Client { + location_extension_types::Client(self.clone()) + } + pub fn operation_status(&self) -> operation_status::Client { + operation_status::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn source_control_configurations(&self) -> source_control_configurations::Client { + source_control_configurations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ClusterExtensionType_Get(#[from] cluster_extension_type::get::Error), + #[error(transparent)] + ClusterExtensionTypes_List(#[from] cluster_extension_types::list::Error), + #[error(transparent)] + ExtensionTypeVersions_List(#[from] extension_type_versions::list::Error), + #[error(transparent)] + LocationExtensionTypes_List(#[from] location_extension_types::list::Error), + #[error(transparent)] + Extensions_Get(#[from] extensions::get::Error), + #[error(transparent)] + Extensions_Create(#[from] extensions::create::Error), + #[error(transparent)] + Extensions_Update(#[from] extensions::update::Error), + #[error(transparent)] + Extensions_Delete(#[from] extensions::delete::Error), + #[error(transparent)] + Extensions_List(#[from] extensions::list::Error), + #[error(transparent)] + OperationStatus_Get(#[from] operation_status::get::Error), + #[error(transparent)] + FluxConfigurations_Get(#[from] flux_configurations::get::Error), + #[error(transparent)] + FluxConfigurations_CreateOrUpdate(#[from] flux_configurations::create_or_update::Error), + #[error(transparent)] + FluxConfigurations_Update(#[from] flux_configurations::update::Error), + #[error(transparent)] + FluxConfigurations_Delete(#[from] flux_configurations::delete::Error), + #[error(transparent)] + FluxConfigurations_List(#[from] flux_configurations::list::Error), + #[error(transparent)] + FluxConfigOperationStatus_Get(#[from] flux_config_operation_status::get::Error), + #[error(transparent)] + SourceControlConfigurations_Get(#[from] source_control_configurations::get::Error), + #[error(transparent)] + SourceControlConfigurations_CreateOrUpdate(#[from] source_control_configurations::create_or_update::Error), + #[error(transparent)] + SourceControlConfigurations_Delete(#[from] source_control_configurations::delete::Error), + #[error(transparent)] + SourceControlConfigurations_List(#[from] source_control_configurations::list::Error), + #[error(transparent)] + OperationStatus_List(#[from] operation_status::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod cluster_extension_type { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_type_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_type_name: extension_type_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_type_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_type_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionType = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod cluster_extension_types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensionTypes" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod extension_type_versions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + location: impl Into, + extension_type_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + extension_type_name: extension_type_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) extension_type_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.KubernetesConfiguration/locations/{}/extensionTypes/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.extension_type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionVersionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod location_extension_types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into, location: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.KubernetesConfiguration/locations/{}/extensionTypes", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionTypeList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod extensions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + } + } + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + extension: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + extension: extension.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + patch_extension: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + patch_extension: patch_extension.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + force_delete: None, + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::Extension), + Ok200(models::Extension), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) extension: models::Extension, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.extension).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) patch_extension: models::PatchExtension, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.patch_extension).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Extension = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) force_delete: Option, + } + impl Builder { + pub fn force_delete(mut self, force_delete: bool) -> Self { + self.force_delete = Some(force_delete); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + if let Some(force_delete) = &self.force_delete { + url.query_pairs_mut().append_pair("forceDelete", &force_delete.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_rp, + &self.cluster_resource_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExtensionsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + extension_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + extension_name: extension_name.into(), + operation_id: operation_id.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) extension_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/extensions/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . extension_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/operations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cluster_rp, + &self.cluster_resource_name, + &self.cluster_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod flux_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + flux_configuration: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + flux_configuration: flux_configuration.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + flux_configuration_patch: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + flux_configuration_patch: flux_configuration_patch.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + force_delete: None, + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::FluxConfiguration), + Created201(models::FluxConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) flux_configuration: models::FluxConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.flux_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) flux_configuration_patch: models::FluxConfigurationPatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.flux_configuration_patch).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) force_delete: Option, + } + impl Builder { + pub fn force_delete(mut self, force_delete: bool) -> Self { + self.force_delete = Some(force_delete); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + if let Some(force_delete) = &self.force_delete { + url.query_pairs_mut().append_pair("forceDelete", &force_delete.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FluxConfigurationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod flux_config_operation_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + flux_configuration_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + flux_configuration_name: flux_configuration_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) flux_configuration_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . flux_configuration_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod source_control_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + source_control_configuration: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + source_control_configuration: source_control_configuration.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + source_control_configuration_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + source_control_configuration_name: source_control_configuration_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cluster_rp: impl Into, + cluster_resource_name: impl Into, + cluster_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cluster_rp: cluster_rp.into(), + cluster_resource_name: cluster_resource_name.into(), + cluster_name: cluster_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SourceControlConfiguration), + Created201(models::SourceControlConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + pub(crate) source_control_configuration: models::SourceControlConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.source_control_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + pub(crate) source_control_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name , & self . source_control_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cluster_rp: String, + pub(crate) cluster_resource_name: String, + pub(crate) cluster_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cluster_rp , & self . cluster_resource_name , & self . cluster_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceControlConfigurationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.KubernetesConfiguration/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderOperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/kusto/Cargo.toml b/services/mgmt/kusto/Cargo.toml index 6377cf4642..f7d9a44148 100644 --- a/services/mgmt/kusto/Cargo.toml +++ b/services/mgmt/kusto/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_kusto" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/labservices/Cargo.toml b/services/mgmt/labservices/Cargo.toml index 9d8a05e88d..a3dec37cfa 100644 --- a/services/mgmt/labservices/Cargo.toml +++ b/services/mgmt/labservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_labservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/loadtestservice/Cargo.toml b/services/mgmt/loadtestservice/Cargo.toml index 71478abcde..cc66b084b8 100644 --- a/services/mgmt/loadtestservice/Cargo.toml +++ b/services/mgmt/loadtestservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_loadtestservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,11 +24,12 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag"] +features = ["no-default-tag", "package-2021-12-01-preview"] [features] -default = ["package-2021-12-01-preview", "enable_reqwest"] +default = ["package-2022-04-15-preview", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-04-15-preview" = [] "package-2021-12-01-preview" = [] diff --git a/services/mgmt/loadtestservice/README.md b/services/mgmt/loadtestservice/README.md index 20236d9e6d..52cc8c2700 100644 --- a/services/mgmt/loadtestservice/README.md +++ b/services/mgmt/loadtestservice/README.md @@ -6,8 +6,9 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/loadtestse To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2021-12-01-preview`. +The default tag is `package-2022-04-15-preview`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-04-15-preview` has 7 operations from 1 API versions: `2022-04-15-preview`. Use crate feature `package-2022-04-15-preview` to enable. The operations will be in the `package_2022_04_15_preview` module. - `package-2021-12-01-preview` has 7 operations from 1 API versions: `2021-12-01-preview`. Use crate feature `package-2021-12-01-preview` to enable. The operations will be in the `package_2021_12_01_preview` module. \ No newline at end of file diff --git a/services/mgmt/loadtestservice/src/lib.rs b/services/mgmt/loadtestservice/src/lib.rs index a45a3a58d7..3bece957f8 100644 --- a/services/mgmt/loadtestservice/src/lib.rs +++ b/services/mgmt/loadtestservice/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-04-15-preview")] +pub mod package_2022_04_15_preview; +#[cfg(all(feature = "package-2022-04-15-preview", not(feature = "no-default-tag")))] +pub use package_2022_04_15_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-12-01-preview")] pub mod package_2021_12_01_preview; #[cfg(all(feature = "package-2021-12-01-preview", not(feature = "no-default-tag")))] diff --git a/services/mgmt/loadtestservice/src/package_2022_04_15_preview/mod.rs b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/loadtestservice/src/package_2022_04_15_preview/models.rs b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/models.rs new file mode 100644 index 0000000000..029af470a2 --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/models.rs @@ -0,0 +1,421 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Key and identity details for Customer Managed Key encryption of load test resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EncryptionProperties { + #[doc = "All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "key encryption key Url, versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek."] + #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] + pub key_url: Option, +} +impl EncryptionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod encryption_properties { + use super::*; + #[doc = "All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Identity { + #[doc = "Managed identity type to use for accessing encryption key Url"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "user assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + } + impl Identity { + pub fn new() -> Self { + Self::default() + } + } + pub mod identity { + use super::*; + #[doc = "Managed identity type to use for accessing encryption key Url"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + } + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "LoadTest resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadTestProperties { + #[doc = "Description of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Load Test resources provisioning states."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Resource data plane URI."] + #[serde(rename = "dataPlaneURI", default, skip_serializing_if = "Option::is_none")] + pub data_plane_uri: Option, + #[doc = "Key and identity details for Customer Managed Key encryption of load test resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, +} +impl LoadTestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "LoadTest details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadTestResource { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "LoadTest resource properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Managed service identity (system assigned and/or user assigned identities)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl LoadTestResource { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + identity: None, + } + } +} +#[doc = "List of resources page result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadTestResourcePageList { + #[doc = "List of resources in current page."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadTestResourcePageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "LoadTest resource patch request body."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadTestResourcePatchRequestBody { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Managed service identity (system assigned and/or user assigned identities)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Load Test resource properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LoadTestResourcePatchRequestBody { + pub fn new() -> Self { + Self::default() + } +} +pub mod load_test_resource_patch_request_body { + use super::*; + #[doc = "Load Test resource properties"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Description of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Key and identity details for Customer Managed Key encryption of load test resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Managed service identity (system assigned and/or user assigned identities)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedServiceIdentity { + #[doc = "The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed)."] + #[serde(rename = "type")] + pub type_: ManagedServiceIdentityType, + #[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ManagedServiceIdentity { + pub fn new(type_: ManagedServiceIdentityType) -> Self { + Self { + principal_id: None, + tenant_id: None, + type_, + user_assigned_identities: None, + } + } +} +#[doc = "Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ManagedServiceIdentityType { + None, + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, +} +#[doc = "Details of a REST API operation, returned from the Resource Provider Operations API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Localized display information for this particular operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Localized display information for this particular operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The short, localized friendly description of the operation; suitable for tool tips and detailed views."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Load Test resources provisioning states."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceState { + Succeeded, + Failed, + Canceled, + Deleted, +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentities {} +impl UserAssignedIdentities { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User assigned identity properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserAssignedIdentity { + #[doc = "The principal ID of the assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client ID of the assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserAssignedIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/loadtestservice/src/package_2022_04_15_preview/operations.rs b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/operations.rs new file mode 100644 index 0000000000..c48106a69d --- /dev/null +++ b/services/mgmt/loadtestservice/src/package_2022_04_15_preview/operations.rs @@ -0,0 +1,738 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn load_tests(&self) -> load_tests::Client { + load_tests::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + LoadTests_ListBySubscription(#[from] load_tests::list_by_subscription::Error), + #[error(transparent)] + LoadTests_ListByResourceGroup(#[from] load_tests::list_by_resource_group::Error), + #[error(transparent)] + LoadTests_Get(#[from] load_tests::get::Error), + #[error(transparent)] + LoadTests_CreateOrUpdate(#[from] load_tests::create_or_update::Error), + #[error(transparent)] + LoadTests_Update(#[from] load_tests::update::Error), + #[error(transparent)] + LoadTests_Delete(#[from] load_tests::delete::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.LoadTestService/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_tests { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + load_test_resource: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + load_test_resource: load_test_resource.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + load_test_resource_patch_request_body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + load_test_resource_patch_request_body: load_test_resource_patch_request_body.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + load_test_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + load_test_name: load_test_name.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.LoadTestService/loadTests", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResourcePageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResourcePageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LoadTestResource), + Created201(models::LoadTestResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + pub(crate) load_test_resource: models::LoadTestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.load_test_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LoadTestResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + pub(crate) load_test_resource_patch_request_body: models::LoadTestResourcePatchRequestBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.load_test_resource_patch_request_body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadTestResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) load_test_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.LoadTestService/loadTests/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_test_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-15-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/logic/Cargo.toml b/services/mgmt/logic/Cargo.toml index 6829058823..9e7465d64b 100644 --- a/services/mgmt/logic/Cargo.toml +++ b/services/mgmt/logic/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_logic" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/logz/Cargo.toml b/services/mgmt/logz/Cargo.toml index c8c88a7bdf..f315683f5f 100644 --- a/services/mgmt/logz/Cargo.toml +++ b/services/mgmt/logz/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_logz" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/machinelearning/Cargo.toml b/services/mgmt/machinelearning/Cargo.toml index 1788c6c875..06007f5215 100644 --- a/services/mgmt/machinelearning/Cargo.toml +++ b/services/mgmt/machinelearning/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_machinelearning" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/machinelearningcompute/Cargo.toml b/services/mgmt/machinelearningcompute/Cargo.toml index 584526c1ca..f79e982506 100644 --- a/services/mgmt/machinelearningcompute/Cargo.toml +++ b/services/mgmt/machinelearningcompute/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_machinelearningcompute" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/machinelearningexperimentation/Cargo.toml b/services/mgmt/machinelearningexperimentation/Cargo.toml index 4ee3157875..0c19f9bef9 100644 --- a/services/mgmt/machinelearningexperimentation/Cargo.toml +++ b/services/mgmt/machinelearningexperimentation/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_machinelearningexperimentation" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/machinelearningservices/Cargo.toml b/services/mgmt/machinelearningservices/Cargo.toml index 1c02ba6dc3..9152eadaef 100644 --- a/services/mgmt/machinelearningservices/Cargo.toml +++ b/services/mgmt/machinelearningservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_machinelearningservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs index 7a60cf04a0..b69618ed4e 100644 --- a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs +++ b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs @@ -449,17 +449,17 @@ impl AutoScaleSettings { pub struct AzureBlobContents { #[serde(flatten)] pub datastore_contents: DatastoreContents, - #[doc = "Storage account name."] + #[doc = "[Required] Storage account name."] #[serde(rename = "accountName")] pub account_name: String, - #[doc = "Storage account container name."] + #[doc = "[Required] Storage account container name."] #[serde(rename = "containerName")] pub container_name: String, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure cloud endpoint for the storage account."] + #[doc = "[Required] Azure cloud endpoint for the storage account."] pub endpoint: String, - #[doc = "Protocol used to communicate with the storage account."] + #[doc = "[Required] Protocol used to communicate with the storage account."] pub protocol: String, } impl AzureBlobContents { @@ -488,7 +488,7 @@ pub struct AzureDataLakeGen1Contents { pub datastore_contents: DatastoreContents, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure Data Lake store name."] + #[doc = "[Required] Azure Data Lake store name."] #[serde(rename = "storeName")] pub store_name: String, } @@ -506,17 +506,17 @@ impl AzureDataLakeGen1Contents { pub struct AzureDataLakeGen2Contents { #[serde(flatten)] pub datastore_contents: DatastoreContents, - #[doc = "Storage account name."] + #[doc = "[Required] Storage account name."] #[serde(rename = "accountName")] pub account_name: String, - #[doc = "Storage account container name."] + #[doc = "[Required] Storage account container name."] #[serde(rename = "containerName")] pub container_name: String, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure cloud endpoint for the storage account."] + #[doc = "[Required] Azure cloud endpoint for the storage account."] pub endpoint: String, - #[doc = "Protocol used to communicate with the storage account."] + #[doc = "[Required] Protocol used to communicate with the storage account."] pub protocol: String, } impl AzureDataLakeGen2Contents { @@ -543,17 +543,17 @@ impl AzureDataLakeGen2Contents { pub struct AzureFileContents { #[serde(flatten)] pub datastore_contents: DatastoreContents, - #[doc = "Storage account name."] + #[doc = "[Required] Storage account name."] #[serde(rename = "accountName")] pub account_name: String, - #[doc = "Storage account container name."] + #[doc = "[Required] Storage account container name."] #[serde(rename = "containerName")] pub container_name: String, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure cloud endpoint for the storage account."] + #[doc = "[Required] Azure cloud endpoint for the storage account."] pub endpoint: String, - #[doc = "Protocol used to communicate with the storage account."] + #[doc = "[Required] Protocol used to communicate with the storage account."] pub protocol: String, } impl AzureFileContents { @@ -582,18 +582,18 @@ pub struct AzurePostgreSqlContents { pub datastore_contents: DatastoreContents, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure SQL database name."] + #[doc = "[Required] Azure SQL database name."] #[serde(rename = "databaseName")] pub database_name: String, #[doc = "Whether the Azure PostgreSQL server requires SSL."] #[serde(rename = "enableSSL", default, skip_serializing_if = "Option::is_none")] pub enable_ssl: Option, - #[doc = "Azure cloud endpoint for the database."] + #[doc = "[Required] Azure cloud endpoint for the database."] pub endpoint: String, - #[doc = "Azure SQL server port."] + #[doc = "[Required] Azure SQL server port."] #[serde(rename = "portNumber")] pub port_number: i32, - #[doc = "Azure SQL server name."] + #[doc = "[Required] Azure SQL server name."] #[serde(rename = "serverName")] pub server_name: String, } @@ -624,15 +624,15 @@ pub struct AzureSqlDatabaseContents { pub datastore_contents: DatastoreContents, #[doc = "Base definition for datastore credentials."] pub credentials: DatastoreCredentials, - #[doc = "Azure SQL database name."] + #[doc = "[Required] Azure SQL database name."] #[serde(rename = "databaseName")] pub database_name: String, - #[doc = "Azure cloud endpoint for the database."] + #[doc = "[Required] Azure cloud endpoint for the database."] pub endpoint: String, - #[doc = "Azure SQL server port."] + #[doc = "[Required] Azure SQL server port."] #[serde(rename = "portNumber")] pub port_number: i32, - #[doc = "Azure SQL server name."] + #[doc = "[Required] Azure SQL server name."] #[serde(rename = "serverName")] pub server_name: String, } @@ -889,7 +889,7 @@ pub struct CertificateDatastoreCredentials { #[doc = "Authority URL used for authentication."] #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] pub authority_url: Option, - #[doc = "Service principal client ID."] + #[doc = "[Required] Service principal client ID."] #[serde(rename = "clientId")] pub client_id: String, #[doc = "Resource the service principal has access to."] @@ -898,10 +898,10 @@ pub struct CertificateDatastoreCredentials { #[doc = "Datastore certificate secrets."] #[serde(default, skip_serializing_if = "Option::is_none")] pub secrets: Option, - #[doc = "ID of the tenant to which the service principal belongs."] + #[doc = "[Required] ID of the tenant to which the service principal belongs."] #[serde(rename = "tenantId")] pub tenant_id: String, - #[doc = "Thumbprint of the certificate used for authentication."] + #[doc = "[Required] Thumbprint of the certificate used for authentication."] pub thumbprint: String, } impl CertificateDatastoreCredentials { @@ -984,7 +984,7 @@ pub struct CodeConfiguration { #[doc = "ARM resource ID of the code asset."] #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] pub code_id: Option, - #[doc = "The script to execute on startup. eg. \"score.py\""] + #[doc = "[Required] The script to execute on startup. eg. \"score.py\""] #[serde(rename = "scoringScript")] pub scoring_script: String, } @@ -1061,7 +1061,7 @@ pub struct CodeVersion { #[doc = "If the name version are system generated (anonymous registration)."] #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] pub is_anonymous: Option, - #[doc = "The path of the file/directory in the datastore."] + #[doc = "[Required] The path of the file/directory in the datastore."] pub path: String, #[doc = "The asset property dictionary."] #[serde(default, skip_serializing_if = "Option::is_none")] @@ -1125,7 +1125,7 @@ pub struct CommandJob { #[doc = "ARM resource ID of the code asset."] #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] pub code_id: Option, - #[doc = "The command to execute on startup of the job. eg. \"python train.py\""] + #[doc = "[Required] The command to execute on startup of the job. eg. \"python train.py\""] pub command: String, #[doc = "Configuration for compute binding."] pub compute: ComputeConfiguration, @@ -1270,7 +1270,7 @@ pub struct ComputeConfiguration { #[doc = "Additional properties."] #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[doc = "ARM resource ID of the compute resource."] + #[doc = "ARM resource ID of the Compute you are targeting. If not provided the resource will be deployed as Managed."] #[serde(default, skip_serializing_if = "Option::is_none")] pub target: Option, } @@ -1888,7 +1888,7 @@ pub struct DataVersion { #[doc = "If the name version are system generated (anonymous registration)."] #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] pub is_anonymous: Option, - #[doc = "The path of the file/directory in the datastore."] + #[doc = "[Required] The path of the file/directory in the datastore."] pub path: String, #[doc = "The asset property dictionary."] #[serde(default, skip_serializing_if = "Option::is_none")] @@ -2182,7 +2182,7 @@ pub struct DockerBuild { #[doc = "Path to a snapshot of the Docker Context. This property is only valid if Dockerfile is specified.\r\nThe path is relative to the asset path which must contain a single Blob URI value.\r\n"] #[serde(default, skip_serializing_if = "Option::is_none")] pub context: Option, - #[doc = "Docker command line instructions to assemble an image.\r\n"] + #[doc = "[Required] Docker command line instructions to assemble an image.\r\n"] pub dockerfile: String, } impl DockerBuild { @@ -2199,7 +2199,7 @@ impl DockerBuild { pub struct DockerImage { #[serde(flatten)] pub docker_specification: DockerSpecification, - #[doc = "Image name of a custom base image.\r\n"] + #[doc = "[Required] Image name of a custom base image.\r\n"] #[serde(rename = "dockerImageUri")] pub docker_image_uri: String, } @@ -2670,10 +2670,10 @@ impl FlavorData { pub struct GlusterFsContents { #[serde(flatten)] pub datastore_contents: DatastoreContents, - #[doc = "GlusterFS server address (can be the IP address or server name)."] + #[doc = "[Required] GlusterFS server address (can be the IP address or server name)."] #[serde(rename = "serverAddress")] pub server_address: String, - #[doc = "GlusterFS volume name."] + #[doc = "[Required] GlusterFS volume name."] #[serde(rename = "volumeName")] pub volume_name: String, } @@ -2730,7 +2730,7 @@ pub mod hd_insight { pub struct IdAssetReference { #[serde(flatten)] pub asset_reference_base: AssetReferenceBase, - #[doc = "ARM resource ID of the asset."] + #[doc = "[Required] ARM resource ID of the asset."] #[serde(rename = "assetId")] pub asset_id: String, } @@ -3504,7 +3504,7 @@ pub struct ModelVersion { #[doc = "If the name version are system generated (anonymous registration)."] #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] pub is_anonymous: Option, - #[doc = "The path of the file/directory in the datastore."] + #[doc = "[Required] The path of the file/directory in the datastore."] pub path: String, #[doc = "The asset property dictionary."] #[serde(default, skip_serializing_if = "Option::is_none")] @@ -3689,7 +3689,7 @@ impl NotebookResourceInfo { pub struct Objective { #[doc = "Defines supported metric goals for hyperparameter tuning"] pub goal: Goal, - #[doc = "Name of the metric to optimize."] + #[doc = "[Required] Name of the metric to optimize."] #[serde(rename = "primaryMetric")] pub primary_metric: String, } @@ -4817,9 +4817,9 @@ pub mod restriction { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Route { - #[doc = "The path for the route."] + #[doc = "[Required] The path for the route."] pub path: String, - #[doc = "The port for the route."] + #[doc = "[Required] The port for the route."] pub port: i32, } impl Route { @@ -4999,7 +4999,7 @@ pub struct ServicePrincipalDatastoreCredentials { #[doc = "Authority URL used for authentication."] #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] pub authority_url: Option, - #[doc = "Service principal client ID."] + #[doc = "[Required] Service principal client ID."] #[serde(rename = "clientId")] pub client_id: String, #[doc = "Resource the service principal has access to."] @@ -5008,7 +5008,7 @@ pub struct ServicePrincipalDatastoreCredentials { #[doc = "Datastore Service Principal secrets."] #[serde(default, skip_serializing_if = "Option::is_none")] pub secrets: Option, - #[doc = "ID of the tenant to which the service principal belongs."] + #[doc = "[Required] ID of the tenant to which the service principal belongs."] #[serde(rename = "tenantId")] pub tenant_id: String, } @@ -5125,7 +5125,7 @@ pub struct SqlAdminDatastoreCredentials { #[doc = "Datastore SQL Admin secrets."] #[serde(default, skip_serializing_if = "Option::is_none")] pub secrets: Option, - #[doc = "SQL database user name."] + #[doc = "[Required] SQL database user name."] #[serde(rename = "userId")] pub user_id: String, } @@ -5249,7 +5249,7 @@ pub struct SweepJob { #[doc = "Job priority for scheduling policy. Only applies to AMLCompute.\r\nPrivate preview feature and only available to users on the allow list."] #[serde(default, skip_serializing_if = "Option::is_none")] pub priority: Option, - #[doc = "A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter"] + #[doc = "[Required] A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter"] #[serde(rename = "searchSpace")] pub search_space: serde_json::Value, #[doc = "The status of a job."] @@ -5429,7 +5429,7 @@ pub struct TrialComponent { #[doc = "ARM resource ID of the code asset."] #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] pub code_id: Option, - #[doc = "The command to execute on startup of the job. eg. \"python train.py\""] + #[doc = "[Required] The command to execute on startup of the job. eg. \"python train.py\""] pub command: String, #[doc = "Base definition for job distribution configuration."] #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/services/mgmt/maintenance/Cargo.toml b/services/mgmt/maintenance/Cargo.toml index 7cb85a0863..7e8fdef72a 100644 --- a/services/mgmt/maintenance/Cargo.toml +++ b/services/mgmt/maintenance/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_maintenance" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/managednetwork/Cargo.toml b/services/mgmt/managednetwork/Cargo.toml index cda5499f62..afdc1d3773 100644 --- a/services/mgmt/managednetwork/Cargo.toml +++ b/services/mgmt/managednetwork/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_managednetwork" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/managedservices/Cargo.toml b/services/mgmt/managedservices/Cargo.toml index 2fd6b0d419..ccd59bfc19 100644 --- a/services/mgmt/managedservices/Cargo.toml +++ b/services/mgmt/managedservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_managedservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/managementgroups/Cargo.toml b/services/mgmt/managementgroups/Cargo.toml index 18f27b37bc..0197eb609d 100644 --- a/services/mgmt/managementgroups/Cargo.toml +++ b/services/mgmt/managementgroups/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_managementgroups" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/managementpartner/Cargo.toml b/services/mgmt/managementpartner/Cargo.toml index 174ff7e1f9..cfba4d8da3 100644 --- a/services/mgmt/managementpartner/Cargo.toml +++ b/services/mgmt/managementpartner/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_managementpartner" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/maps/Cargo.toml b/services/mgmt/maps/Cargo.toml index 5a596e0ed6..90b7cd425a 100644 --- a/services/mgmt/maps/Cargo.toml +++ b/services/mgmt/maps/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_maps" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/mariadb/Cargo.toml b/services/mgmt/mariadb/Cargo.toml index 4f4ae03b24..e3ae50a11e 100644 --- a/services/mgmt/mariadb/Cargo.toml +++ b/services/mgmt/mariadb/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_mariadb" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/marketplacenotifications/Cargo.toml b/services/mgmt/marketplacenotifications/Cargo.toml index e237eaf91a..167466c829 100644 --- a/services/mgmt/marketplacenotifications/Cargo.toml +++ b/services/mgmt/marketplacenotifications/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_marketplacenotifications" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/marketplaceordering/Cargo.toml b/services/mgmt/marketplaceordering/Cargo.toml index 00dcce388e..6e1d2f7d29 100644 --- a/services/mgmt/marketplaceordering/Cargo.toml +++ b/services/mgmt/marketplaceordering/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_marketplaceordering" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/mediaservices/Cargo.toml b/services/mgmt/mediaservices/Cargo.toml index 31b5f0d31d..f4ee2d4430 100644 --- a/services/mgmt/mediaservices/Cargo.toml +++ b/services/mgmt/mediaservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_mediaservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/migrate/Cargo.toml b/services/mgmt/migrate/Cargo.toml index 72ff1d39ff..9ff4dd3d3f 100644 --- a/services/mgmt/migrate/Cargo.toml +++ b/services/mgmt/migrate/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_migrate" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/migrateprojects/Cargo.toml b/services/mgmt/migrateprojects/Cargo.toml index c279596c1d..b50fde4451 100644 --- a/services/mgmt/migrateprojects/Cargo.toml +++ b/services/mgmt/migrateprojects/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_migrateprojects" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/mobilenetwork/Cargo.toml b/services/mgmt/mobilenetwork/Cargo.toml index 77df2cb13d..7f3067613e 100644 --- a/services/mgmt/mobilenetwork/Cargo.toml +++ b/services/mgmt/mobilenetwork/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_mobilenetwork" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/monitor/Cargo.toml b/services/mgmt/monitor/Cargo.toml index d589f894fd..d982755cb1 100644 --- a/services/mgmt/monitor/Cargo.toml +++ b/services/mgmt/monitor/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_monitor" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2016-03-preview-monitorlegacy", "package-2021-05-preview-diagnostics", "package-2021-05-metrics", "package-2021-08-scheduledqueryrules"] +features = ["no-default-tag", "package-2016-03-preview-monitorlegacy", "package-2021-05-preview-diagnostics", "package-2020-10-activityLogs", "package-2021-05-metrics"] [features] -default = ["package-2020-10-activityLogs", "enable_reqwest"] +default = ["package-2022-04-01-only", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-04-01-only" = [] "package-2016-03-preview-monitorlegacy" = [] "package-2021-05-preview-diagnostics" = [] "package-2020-10-activityLogs" = [] diff --git a/services/mgmt/monitor/README.md b/services/mgmt/monitor/README.md index 202a895059..ad905d3607 100644 --- a/services/mgmt/monitor/README.md +++ b/services/mgmt/monitor/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/re To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2020-10-activityLogs`. +The default tag is `package-2022-04-01-only`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-04-01-only` has 11 operations from 1 API versions: `2022-04-01`. Use crate feature `package-2022-04-01-only` to enable. The operations will be in the `package_2022_04_01_only` module. - `package-2016-03-preview-monitorlegacy` has 15 operations from 3 API versions: `2015-04-01`, `2016-03-01`, `2018-11-27-preview`. Use crate feature `package-2016-03-preview-monitorlegacy` to enable. The operations will be in the `package_2016_03_preview_monitorlegacy` module. - `package-2021-05-preview-diagnostics` has 47 operations from 3 API versions: `2021-05-01-preview`, `2021-07-01-preview`, `2021-09-01`. Use crate feature `package-2021-05-preview-diagnostics` to enable. The operations will be in the `package_2021_05_preview_diagnostics` module. - `package-2020-10-activityLogs` has 8 operations from 2 API versions: `2015-04-01`, `2020-10-01`. Use crate feature `package-2020-10-activityLogs` to enable. The operations will be in the `package_2020_10_activitylogs` module. diff --git a/services/mgmt/monitor/src/lib.rs b/services/mgmt/monitor/src/lib.rs index 33b19446b0..c22493a675 100644 --- a/services/mgmt/monitor/src/lib.rs +++ b/services/mgmt/monitor/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-04-01-only")] +pub mod package_2022_04_01_only; +#[cfg(all(feature = "package-2022-04-01-only", not(feature = "no-default-tag")))] +pub use package_2022_04_01_only::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2016-03-preview-monitorlegacy")] pub mod package_2016_03_preview_monitorlegacy; #[cfg(all(feature = "package-2016-03-preview-monitorlegacy", not(feature = "no-default-tag")))] diff --git a/services/mgmt/monitor/src/package_2022_04_01_only/mod.rs b/services/mgmt/monitor/src/package_2022_04_01_only/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/monitor/src/package_2022_04_01_only/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/monitor/src/package_2022_04_01_only/models.rs b/services/mgmt/monitor/src/package_2022_04_01_only/models.rs new file mode 100644 index 0000000000..a8b5652dbc --- /dev/null +++ b/services/mgmt/monitor/src/package_2022_04_01_only/models.rs @@ -0,0 +1,621 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The action detail"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActionDetail { + #[doc = "The mechanism type"] + #[serde(rename = "MechanismType", default, skip_serializing_if = "Option::is_none")] + pub mechanism_type: Option, + #[doc = "The name of the action"] + #[serde(rename = "Name", default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The status of the action"] + #[serde(rename = "Status", default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The substatus of the action"] + #[serde(rename = "SubState", default, skip_serializing_if = "Option::is_none")] + pub sub_state: Option, + #[doc = "The send time"] + #[serde(rename = "SendTime", default, skip_serializing_if = "Option::is_none")] + pub send_time: Option, + #[doc = "The detail of the friendly error message"] + #[serde(rename = "Detail", default, skip_serializing_if = "Option::is_none")] + pub detail: Option, +} +impl ActionDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure action group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionGroup { + #[doc = "The short name of the action group. This will be used in SMS messages."] + #[serde(rename = "groupShortName")] + pub group_short_name: String, + #[doc = "Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications."] + pub enabled: bool, + #[doc = "The list of email receivers that are part of this action group."] + #[serde(rename = "emailReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub email_receivers: Vec, + #[doc = "The list of SMS receivers that are part of this action group."] + #[serde(rename = "smsReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub sms_receivers: Vec, + #[doc = "The list of webhook receivers that are part of this action group."] + #[serde(rename = "webhookReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub webhook_receivers: Vec, + #[doc = "The list of ITSM receivers that are part of this action group."] + #[serde(rename = "itsmReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub itsm_receivers: Vec, + #[doc = "The list of AzureAppPush receivers that are part of this action group."] + #[serde(rename = "azureAppPushReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub azure_app_push_receivers: Vec, + #[doc = "The list of AutomationRunbook receivers that are part of this action group."] + #[serde(rename = "automationRunbookReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub automation_runbook_receivers: Vec, + #[doc = "The list of voice receivers that are part of this action group."] + #[serde(rename = "voiceReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub voice_receivers: Vec, + #[doc = "The list of logic app receivers that are part of this action group."] + #[serde(rename = "logicAppReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub logic_app_receivers: Vec, + #[doc = "The list of azure function receivers that are part of this action group."] + #[serde(rename = "azureFunctionReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub azure_function_receivers: Vec, + #[doc = "The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported."] + #[serde(rename = "armRoleReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub arm_role_receivers: Vec, + #[doc = "The list of event hub receivers that are part of this action group."] + #[serde(rename = "eventHubReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub event_hub_receivers: Vec, +} +impl ActionGroup { + pub fn new(group_short_name: String, enabled: bool) -> Self { + Self { + group_short_name, + enabled, + email_receivers: Vec::new(), + sms_receivers: Vec::new(), + webhook_receivers: Vec::new(), + itsm_receivers: Vec::new(), + azure_app_push_receivers: Vec::new(), + automation_runbook_receivers: Vec::new(), + voice_receivers: Vec::new(), + logic_app_receivers: Vec::new(), + azure_function_receivers: Vec::new(), + arm_role_receivers: Vec::new(), + event_hub_receivers: Vec::new(), + } + } +} +#[doc = "A list of action groups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActionGroupList { + #[doc = "The list of action groups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Provides the link to retrieve the next set of elements."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ActionGroupList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Azure action group for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActionGroupPatch { + #[doc = "Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl ActionGroupPatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An action group object for the body of patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActionGroupPatchBody { + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "An Azure action group for patch operations."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ActionGroupPatchBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An action group resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionGroupResource { + #[serde(flatten)] + pub azure_resource: AzureResource, + #[doc = "An Azure action group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ActionGroupResource { + pub fn new(azure_resource: AzureResource) -> Self { + Self { + azure_resource, + properties: None, + } + } +} +#[doc = "An arm role receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ArmRoleReceiver { + #[doc = "The name of the arm role receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The arm role id."] + #[serde(rename = "roleId")] + pub role_id: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, +} +impl ArmRoleReceiver { + pub fn new(name: String, role_id: String) -> Self { + Self { + name, + role_id, + use_common_alert_schema: None, + } + } +} +#[doc = "The Azure Automation Runbook notification receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRunbookReceiver { + #[doc = "The Azure automation account Id which holds this runbook and authenticate to Azure resource."] + #[serde(rename = "automationAccountId")] + pub automation_account_id: String, + #[doc = "The name for this runbook."] + #[serde(rename = "runbookName")] + pub runbook_name: String, + #[doc = "The resource id for webhook linked to this runbook."] + #[serde(rename = "webhookResourceId")] + pub webhook_resource_id: String, + #[doc = "Indicates whether this instance is global runbook."] + #[serde(rename = "isGlobalRunbook")] + pub is_global_runbook: bool, + #[doc = "Indicates name of the webhook."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The URI where webhooks should be sent."] + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, +} +impl AutomationRunbookReceiver { + pub fn new(automation_account_id: String, runbook_name: String, webhook_resource_id: String, is_global_runbook: bool) -> Self { + Self { + automation_account_id, + runbook_name, + webhook_resource_id, + is_global_runbook, + name: None, + service_uri: None, + use_common_alert_schema: None, + } + } +} +#[doc = "The Azure mobile App push notification receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureAppPushReceiver { + #[doc = "The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The email address registered for the Azure mobile app."] + #[serde(rename = "emailAddress")] + pub email_address: String, +} +impl AzureAppPushReceiver { + pub fn new(name: String, email_address: String) -> Self { + Self { name, email_address } + } +} +#[doc = "An azure function receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFunctionReceiver { + #[doc = "The name of the azure function receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The azure resource id of the function app."] + #[serde(rename = "functionAppResourceId")] + pub function_app_resource_id: String, + #[doc = "The function name in the function app."] + #[serde(rename = "functionName")] + pub function_name: String, + #[doc = "The http trigger url where http request sent to."] + #[serde(rename = "httpTriggerUrl")] + pub http_trigger_url: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, +} +impl AzureFunctionReceiver { + pub fn new(name: String, function_app_resource_id: String, function_name: String, http_trigger_url: String) -> Self { + Self { + name, + function_app_resource_id, + function_name, + http_trigger_url, + use_common_alert_schema: None, + } + } +} +#[doc = "An azure resource object"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResource { + #[doc = "Azure resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Azure resource name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Azure resource type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Azure resource kind"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[doc = "Azure resource identity"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Resource location"] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl AzureResource { + pub fn new(location: String) -> Self { + Self { + id: None, + name: None, + type_: None, + kind: None, + identity: None, + location, + tags: None, + } + } +} +#[doc = "The context info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Context { + #[doc = "The source of the notification request"] + #[serde(rename = "NotificationSource", default, skip_serializing_if = "Option::is_none")] + pub notification_source: Option, + #[doc = "The context id type"] + #[serde(rename = "ContextType", default, skip_serializing_if = "Option::is_none")] + pub context_type: Option, +} +impl Context { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An email receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EmailReceiver { + #[doc = "The name of the email receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The email address of this receiver."] + #[serde(rename = "emailAddress")] + pub email_address: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, + #[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl EmailReceiver { + pub fn new(name: String, email_address: String) -> Self { + Self { + name, + email_address, + use_common_alert_schema: None, + status: None, + } + } +} +#[doc = "Describes a receiver that should be resubscribed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableRequest { + #[doc = "The name of the receiver to resubscribe."] + #[serde(rename = "receiverName")] + pub receiver_name: String, +} +impl EnableRequest { + pub fn new(receiver_name: String) -> Self { + Self { receiver_name } + } +} +#[doc = "Describes the format of Error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Error code"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message indicating why the operation failed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An Event hub receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventHubReceiver { + #[doc = "The name of the Event hub receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The Event Hub namespace"] + #[serde(rename = "eventHubNameSpace")] + pub event_hub_name_space: String, + #[doc = "The name of the specific Event Hub queue"] + #[serde(rename = "eventHubName")] + pub event_hub_name: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, + #[doc = "The tenant Id for the subscription containing this event hub"] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The Id for the subscription containing this event hub"] + #[serde(rename = "subscriptionId")] + pub subscription_id: String, +} +impl EventHubReceiver { + pub fn new(name: String, event_hub_name_space: String, event_hub_name: String, subscription_id: String) -> Self { + Self { + name, + event_hub_name_space, + event_hub_name, + use_common_alert_schema: None, + tenant_id: None, + subscription_id, + } + } +} +#[doc = "An Itsm receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ItsmReceiver { + #[doc = "The name of the Itsm receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "OMS LA instance identifier."] + #[serde(rename = "workspaceId")] + pub workspace_id: String, + #[doc = "Unique identification of ITSM connection among multiple defined in above workspace."] + #[serde(rename = "connectionId")] + pub connection_id: String, + #[doc = "JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well."] + #[serde(rename = "ticketConfiguration")] + pub ticket_configuration: String, + #[doc = "Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'"] + pub region: String, +} +impl ItsmReceiver { + pub fn new(name: String, workspace_id: String, connection_id: String, ticket_configuration: String, region: String) -> Self { + Self { + name, + workspace_id, + connection_id, + ticket_configuration, + region, + } + } +} +#[doc = "A logic app receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogicAppReceiver { + #[doc = "The name of the logic app receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The azure resource id of the logic app receiver."] + #[serde(rename = "resourceId")] + pub resource_id: String, + #[doc = "The callback url where http request sent to."] + #[serde(rename = "callbackUrl")] + pub callback_url: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, +} +impl LogicAppReceiver { + pub fn new(name: String, resource_id: String, callback_url: String) -> Self { + Self { + name, + resource_id, + callback_url, + use_common_alert_schema: None, + } + } +} +#[doc = "The request body which contain contact detail metadata"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationRequestBody { + #[doc = "The name of the supported alert type."] + #[serde(rename = "alertType")] + pub alert_type: String, + #[doc = "The list of email receivers that are part of this action group."] + #[serde(rename = "emailReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub email_receivers: Vec, + #[doc = "The list of SMS receivers that are part of this action group."] + #[serde(rename = "smsReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub sms_receivers: Vec, + #[doc = "The list of webhook receivers that are part of this action group."] + #[serde(rename = "webhookReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub webhook_receivers: Vec, + #[doc = "The list of ITSM receivers that are part of this action group."] + #[serde(rename = "itsmReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub itsm_receivers: Vec, + #[doc = "The list of AzureAppPush receivers that are part of this action group."] + #[serde(rename = "azureAppPushReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub azure_app_push_receivers: Vec, + #[doc = "The list of AutomationRunbook receivers that are part of this action group."] + #[serde(rename = "automationRunbookReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub automation_runbook_receivers: Vec, + #[doc = "The list of voice receivers that are part of this action group."] + #[serde(rename = "voiceReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub voice_receivers: Vec, + #[doc = "The list of logic app receivers that are part of this action group."] + #[serde(rename = "logicAppReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub logic_app_receivers: Vec, + #[doc = "The list of azure function receivers that are part of this action group."] + #[serde(rename = "azureFunctionReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub azure_function_receivers: Vec, + #[doc = "The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported."] + #[serde(rename = "armRoleReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub arm_role_receivers: Vec, + #[doc = "The list of event hub receivers that are part of this action group."] + #[serde(rename = "eventHubReceivers", default, skip_serializing_if = "Vec::is_empty")] + pub event_hub_receivers: Vec, +} +impl NotificationRequestBody { + pub fn new(alert_type: String) -> Self { + Self { + alert_type, + email_receivers: Vec::new(), + sms_receivers: Vec::new(), + webhook_receivers: Vec::new(), + itsm_receivers: Vec::new(), + azure_app_push_receivers: Vec::new(), + automation_runbook_receivers: Vec::new(), + voice_receivers: Vec::new(), + logic_app_receivers: Vec::new(), + azure_function_receivers: Vec::new(), + arm_role_receivers: Vec::new(), + event_hub_receivers: Vec::new(), + } + } +} +#[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ReceiverStatus { + NotSpecified, + Enabled, + Disabled, +} +#[doc = "An SMS receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmsReceiver { + #[doc = "The name of the SMS receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The country code of the SMS receiver."] + #[serde(rename = "countryCode")] + pub country_code: String, + #[doc = "The phone number of the SMS receiver."] + #[serde(rename = "phoneNumber")] + pub phone_number: String, + #[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl SmsReceiver { + pub fn new(name: String, country_code: String, phone_number: String) -> Self { + Self { + name, + country_code, + phone_number, + status: None, + } + } +} +#[doc = "The details of the test notification results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestNotificationDetailsResponse { + #[doc = "The context info"] + #[serde(rename = "Context", default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[doc = "The overall state"] + #[serde(rename = "State")] + pub state: String, + #[doc = "The completed time"] + #[serde(rename = "CompletedTime", default, skip_serializing_if = "Option::is_none")] + pub completed_time: Option, + #[doc = "The created time"] + #[serde(rename = "CreatedTime", default, skip_serializing_if = "Option::is_none")] + pub created_time: Option, + #[doc = "The list of action detail"] + #[serde(rename = "ActionDetails", default, skip_serializing_if = "Vec::is_empty")] + pub action_details: Vec, +} +impl TestNotificationDetailsResponse { + pub fn new(state: String) -> Self { + Self { + context: None, + state, + completed_time: None, + created_time: None, + action_details: Vec::new(), + } + } +} +#[doc = "A voice receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VoiceReceiver { + #[doc = "The name of the voice receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The country code of the voice receiver."] + #[serde(rename = "countryCode")] + pub country_code: String, + #[doc = "The phone number of the voice receiver."] + #[serde(rename = "phoneNumber")] + pub phone_number: String, +} +impl VoiceReceiver { + pub fn new(name: String, country_code: String, phone_number: String) -> Self { + Self { + name, + country_code, + phone_number, + } + } +} +#[doc = "A webhook receiver."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookReceiver { + #[doc = "The name of the webhook receiver. Names must be unique across all receivers within an action group."] + pub name: String, + #[doc = "The URI where webhooks should be sent."] + #[serde(rename = "serviceUri")] + pub service_uri: String, + #[doc = "Indicates whether to use common alert schema."] + #[serde(rename = "useCommonAlertSchema", default, skip_serializing_if = "Option::is_none")] + pub use_common_alert_schema: Option, + #[doc = "Indicates whether or not use AAD authentication."] + #[serde(rename = "useAadAuth", default, skip_serializing_if = "Option::is_none")] + pub use_aad_auth: Option, + #[doc = "Indicates the webhook app object Id for aad auth."] + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, + #[doc = "Indicates the identifier uri for aad auth."] + #[serde(rename = "identifierUri", default, skip_serializing_if = "Option::is_none")] + pub identifier_uri: Option, + #[doc = "Indicates the tenant id for aad auth."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +impl WebhookReceiver { + pub fn new(name: String, service_uri: String) -> Self { + Self { + name, + service_uri, + use_common_alert_schema: None, + use_aad_auth: None, + object_id: None, + identifier_uri: None, + tenant_id: None, + } + } +} diff --git a/services/mgmt/monitor/src/package_2022_04_01_only/operations.rs b/services/mgmt/monitor/src/package_2022_04_01_only/operations.rs new file mode 100644 index 0000000000..544342ffeb --- /dev/null +++ b/services/mgmt/monitor/src/package_2022_04_01_only/operations.rs @@ -0,0 +1,1096 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn action_groups(&self) -> action_groups::Client { + action_groups::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ActionGroups_Get(#[from] action_groups::get::Error), + #[error(transparent)] + ActionGroups_CreateOrUpdate(#[from] action_groups::create_or_update::Error), + #[error(transparent)] + ActionGroups_Update(#[from] action_groups::update::Error), + #[error(transparent)] + ActionGroups_Delete(#[from] action_groups::delete::Error), + #[error(transparent)] + ActionGroups_PostTestNotifications(#[from] action_groups::post_test_notifications::Error), + #[error(transparent)] + ActionGroups_CreateNotificationsAtResourceGroupLevel(#[from] action_groups::create_notifications_at_resource_group_level::Error), + #[error(transparent)] + ActionGroups_GetTestNotifications(#[from] action_groups::get_test_notifications::Error), + #[error(transparent)] + ActionGroups_GetTestNotificationsAtResourceGroupLevel(#[from] action_groups::get_test_notifications_at_resource_group_level::Error), + #[error(transparent)] + ActionGroups_ListBySubscriptionId(#[from] action_groups::list_by_subscription_id::Error), + #[error(transparent)] + ActionGroups_ListByResourceGroup(#[from] action_groups::list_by_resource_group::Error), + #[error(transparent)] + ActionGroups_EnableReceiver(#[from] action_groups::enable_receiver::Error), +} +pub mod action_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + action_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + action_group_name: action_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + action_group_name: impl Into, + action_group: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + action_group_name: action_group_name.into(), + action_group: action_group.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + action_group_name: impl Into, + action_group_patch: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + action_group_name: action_group_name.into(), + action_group_patch: action_group_patch.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + action_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + action_group_name: action_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn post_test_notifications( + &self, + subscription_id: impl Into, + notification_request: impl Into, + ) -> post_test_notifications::Builder { + post_test_notifications::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + notification_request: notification_request.into(), + } + } + pub fn create_notifications_at_resource_group_level( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + notification_request: impl Into, + ) -> create_notifications_at_resource_group_level::Builder { + create_notifications_at_resource_group_level::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + notification_request: notification_request.into(), + } + } + pub fn get_test_notifications( + &self, + subscription_id: impl Into, + notification_id: impl Into, + ) -> get_test_notifications::Builder { + get_test_notifications::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + notification_id: notification_id.into(), + } + } + pub fn get_test_notifications_at_resource_group_level( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + notification_id: impl Into, + ) -> get_test_notifications_at_resource_group_level::Builder { + get_test_notifications_at_resource_group_level::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + notification_id: notification_id.into(), + } + } + pub fn list_by_subscription_id(&self, subscription_id: impl Into) -> list_by_subscription_id::Builder { + list_by_subscription_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn enable_receiver( + &self, + resource_group_name: impl Into, + action_group_name: impl Into, + enable_request: impl Into, + subscription_id: impl Into, + ) -> enable_receiver::Builder { + enable_receiver::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + action_group_name: action_group_name.into(), + enable_request: enable_request.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) action_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.action_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ActionGroupResource), + Created201(models::ActionGroupResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) action_group_name: String, + pub(crate) action_group: models::ActionGroupResource, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.action_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.action_group).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) action_group_name: String, + pub(crate) action_group_patch: models::ActionGroupPatchBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.action_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.action_group_patch).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) action_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.action_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod post_test_notifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) notification_request: models::NotificationRequestBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Insights/createNotifications", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.notification_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_notifications_at_resource_group_level { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) notification_request: models::NotificationRequestBody, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/createNotifications", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.notification_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_test_notifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) notification_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Insights/notificationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.notification_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TestNotificationDetailsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_test_notifications_at_resource_group_level { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) notification_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/notificationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.notification_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TestNotificationDetailsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription_id { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Insights/actionGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActionGroupList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod enable_receiver { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + Conflict409 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) action_group_name: String, + pub(crate) enable_request: models::EnableRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/actionGroups/{}/subscribe", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.action_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.enable_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + http::StatusCode::CONFLICT => Err(Error::Conflict409 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/msi/Cargo.toml b/services/mgmt/msi/Cargo.toml index 98803f123b..e44274739b 100644 --- a/services/mgmt/msi/Cargo.toml +++ b/services/mgmt/msi/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_msi" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/mysql/Cargo.toml b/services/mgmt/mysql/Cargo.toml index a303ba35d6..bf5ef77420 100644 --- a/services/mgmt/mysql/Cargo.toml +++ b/services/mgmt/mysql/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_mysql" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/netapp/Cargo.toml b/services/mgmt/netapp/Cargo.toml index fce5db2793..649285a6ed 100644 --- a/services/mgmt/netapp/Cargo.toml +++ b/services/mgmt/netapp/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_netapp" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/network/Cargo.toml b/services/mgmt/network/Cargo.toml index f374042e7a..a319c1bda6 100644 --- a/services/mgmt/network/Cargo.toml +++ b/services/mgmt/network/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_network" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,14 +24,15 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2022-02-preview", "package-2021-05-preview", "package-2021-03", "package-2021-02"] +features = ["no-default-tag", "package-2022-02-preview", "package-2021-05-preview", "package-2021-05", "package-2021-03"] [features] -default = ["package-2021-05", "enable_reqwest"] +default = ["package-2021-08", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-2022-02-preview" = [] +"package-2021-08" = [] "package-2021-05-preview" = [] "package-2021-05" = [] "package-2021-03" = [] diff --git a/services/mgmt/network/README.md b/services/mgmt/network/README.md index 717f0aef23..07dca5ff03 100644 --- a/services/mgmt/network/README.md +++ b/services/mgmt/network/README.md @@ -6,11 +6,12 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/network/re To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2021-05`. +The default tag is `package-2021-08`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: - `package-2022-02-preview` has 603 operations from 3 API versions: `2018-10-01`, `2021-05-01`, `2022-02-01-preview`. Use crate feature `package-2022-02-preview` to enable. The operations will be in the `package_2022_02_preview` module. +- `package-2021-08` has 549 operations from 2 API versions: `2018-10-01`, `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module. - `package-2021-05-preview` has 603 operations from 3 API versions: `2018-10-01`, `2021-05-01`, `2021-05-01-preview`. Use crate feature `package-2021-05-preview` to enable. The operations will be in the `package_2021_05_preview` module. - `package-2021-05` has 540 operations from 2 API versions: `2018-10-01`, `2021-05-01`. Use crate feature `package-2021-05` to enable. The operations will be in the `package_2021_05` module. - `package-2021-03` has 529 operations from 2 API versions: `2018-10-01`, `2021-03-01`. Use crate feature `package-2021-03` to enable. The operations will be in the `package_2021_03` module. diff --git a/services/mgmt/network/src/lib.rs b/services/mgmt/network/src/lib.rs index 3f970308f5..2ce19c0ecb 100644 --- a/services/mgmt/network/src/lib.rs +++ b/services/mgmt/network/src/lib.rs @@ -7,6 +7,10 @@ pub mod package_2022_02_preview; #[cfg(all(feature = "package-2022-02-preview", not(feature = "no-default-tag")))] pub use package_2022_02_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-08")] +pub mod package_2021_08; +#[cfg(all(feature = "package-2021-08", not(feature = "no-default-tag")))] +pub use package_2021_08::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-05-preview")] pub mod package_2021_05_preview; #[cfg(all(feature = "package-2021-05-preview", not(feature = "no-default-tag")))] diff --git a/services/mgmt/network/src/package_2021_02_preview/models.rs b/services/mgmt/network/src/package_2021_02_preview/models.rs index 10a6c4e06c..0ca98f9f83 100644 --- a/services/mgmt/network/src/package_2021_02_preview/models.rs +++ b/services/mgmt/network/src/package_2021_02_preview/models.rs @@ -10197,6 +10197,18 @@ impl LogSpecification { Self::default() } } +#[doc = "Logging Category"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggingCategory { + #[doc = "The name of the logging category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl LoggingCategory { + pub fn new() -> Self { + Self::default() + } +} #[doc = "Defines a managed rule group override setting."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ManagedRuleGroupOverride { @@ -10458,6 +10470,16 @@ impl MetricSpecification { Self::default() } } +#[doc = "The current provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NspProvisioningState { + Succeeded, + Creating, + Updating, + Deleting, + Accepted, + Failed, +} #[doc = "Nat Gateway resource."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct NatGateway { @@ -11524,7 +11546,7 @@ pub struct NetworkSecurityPerimeterProperties { pub description: Option, #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, } impl NetworkSecurityPerimeterProperties { pub fn new() -> Self { @@ -11859,7 +11881,7 @@ impl NspAccessRuleListResult { pub struct NspAccessRuleProperties { #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, #[doc = "Direction that specifies whether the access rules is inbound/outbound."] #[serde(default, skip_serializing_if = "Option::is_none")] pub direction: Option, @@ -11916,7 +11938,7 @@ impl NspAssociation { pub struct NspAssociationProperties { #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, #[doc = "Reference to another subresource."] #[serde(rename = "privateLinkResource", default, skip_serializing_if = "Option::is_none")] pub private_link_resource: Option, @@ -11926,6 +11948,9 @@ pub struct NspAssociationProperties { #[doc = "Access mode on the association."] #[serde(rename = "accessMode", default, skip_serializing_if = "Option::is_none")] pub access_mode: Option, + #[doc = "Specifies if there are provisioning issues"] + #[serde(rename = "hasProvisioningIssues", default, skip_serializing_if = "Option::is_none")] + pub has_provisioning_issues: Option, } impl NspAssociationProperties { pub fn new() -> Self { @@ -11937,10 +11962,9 @@ pub mod nsp_association_properties { #[doc = "Access mode on the association."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AccessMode { - Unspecified, - EnforceMode, - LearningMode, - DryRunMode, + Learning, + Enforced, + Audit, } } #[doc = "Result of the request to list NSP resource associations. Contains a list of NSP resource associations and a URL link to get the next set of results."] @@ -12002,6 +12026,9 @@ pub struct NspProfileProperties { #[doc = "Version number that increases with every update to access rules within the profile."] #[serde(rename = "accessRulesVersion", default, skip_serializing_if = "Option::is_none")] pub access_rules_version: Option, + #[doc = "Gets the enabled log categories."] + #[serde(rename = "enabledLogCategories", default, skip_serializing_if = "Vec::is_empty")] + pub enabled_log_categories: Vec, } impl NspProfileProperties { pub fn new() -> Self { diff --git a/services/mgmt/network/src/package_2021_02_preview/operations.rs b/services/mgmt/network/src/package_2021_02_preview/operations.rs index cfe1fcb0dd..cebfc698cf 100644 --- a/services/mgmt/network/src/package_2021_02_preview/operations.rs +++ b/services/mgmt/network/src/package_2021_02_preview/operations.rs @@ -7923,6 +7923,7 @@ pub mod nsp_associations { #[derive(Debug)] pub enum Response { Ok200, + Accepted202, NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -7975,6 +7976,7 @@ pub mod nsp_associations { let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; diff --git a/services/mgmt/network/src/package_2021_02_preview_only/models.rs b/services/mgmt/network/src/package_2021_02_preview_only/models.rs index 3ba4cae93b..158b38160c 100644 --- a/services/mgmt/network/src/package_2021_02_preview_only/models.rs +++ b/services/mgmt/network/src/package_2021_02_preview_only/models.rs @@ -871,6 +871,28 @@ impl Hub { Self::default() } } +#[doc = "Logging Category"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoggingCategory { + #[doc = "The name of the logging category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl LoggingCategory { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NspProvisioningState { + Succeeded, + Creating, + Updating, + Deleting, + Accepted, + Failed, +} #[doc = "The network group resource"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct NetworkGroup { @@ -1193,7 +1215,7 @@ pub struct NetworkSecurityPerimeterProperties { pub description: Option, #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, } impl NetworkSecurityPerimeterProperties { pub fn new() -> Self { @@ -1243,7 +1265,7 @@ impl NspAccessRuleListResult { pub struct NspAccessRuleProperties { #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, #[doc = "Direction that specifies whether the access rules is inbound/outbound."] #[serde(default, skip_serializing_if = "Option::is_none")] pub direction: Option, @@ -1300,7 +1322,7 @@ impl NspAssociation { pub struct NspAssociationProperties { #[doc = "The current provisioning state."] #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, + pub provisioning_state: Option, #[doc = "Reference to another subresource."] #[serde(rename = "privateLinkResource", default, skip_serializing_if = "Option::is_none")] pub private_link_resource: Option, @@ -1310,6 +1332,9 @@ pub struct NspAssociationProperties { #[doc = "Access mode on the association."] #[serde(rename = "accessMode", default, skip_serializing_if = "Option::is_none")] pub access_mode: Option, + #[doc = "Specifies if there are provisioning issues"] + #[serde(rename = "hasProvisioningIssues", default, skip_serializing_if = "Option::is_none")] + pub has_provisioning_issues: Option, } impl NspAssociationProperties { pub fn new() -> Self { @@ -1321,10 +1346,9 @@ pub mod nsp_association_properties { #[doc = "Access mode on the association."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum AccessMode { - Unspecified, - EnforceMode, - LearningMode, - DryRunMode, + Learning, + Enforced, + Audit, } } #[doc = "Result of the request to list NSP resource associations. Contains a list of NSP resource associations and a URL link to get the next set of results."] @@ -1386,6 +1410,9 @@ pub struct NspProfileProperties { #[doc = "Version number that increases with every update to access rules within the profile."] #[serde(rename = "accessRulesVersion", default, skip_serializing_if = "Option::is_none")] pub access_rules_version: Option, + #[doc = "Gets the enabled log categories."] + #[serde(rename = "enabledLogCategories", default, skip_serializing_if = "Vec::is_empty")] + pub enabled_log_categories: Vec, } impl NspProfileProperties { pub fn new() -> Self { diff --git a/services/mgmt/network/src/package_2021_02_preview_only/operations.rs b/services/mgmt/network/src/package_2021_02_preview_only/operations.rs index 9be6b69ee0..82fcb91ac3 100644 --- a/services/mgmt/network/src/package_2021_02_preview_only/operations.rs +++ b/services/mgmt/network/src/package_2021_02_preview_only/operations.rs @@ -6513,6 +6513,7 @@ pub mod nsp_associations { #[derive(Debug)] pub enum Response { Ok200, + Accepted202, NoContent204, } #[derive(Debug, thiserror :: Error)] @@ -6565,6 +6566,7 @@ pub mod nsp_associations { let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; diff --git a/services/mgmt/network/src/package_2021_08/mod.rs b/services/mgmt/network/src/package_2021_08/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/network/src/package_2021_08/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/network/src/package_2021_08/models.rs b/services/mgmt/network/src/package_2021_08/models.rs new file mode 100644 index 0000000000..29b4aa07a0 --- /dev/null +++ b/services/mgmt/network/src/package_2021_08/models.rs @@ -0,0 +1,17721 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "AAD Vpn authentication type related parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AadAuthenticationParameters { + #[doc = "AAD Vpn authentication parameter AAD tenant."] + #[serde(rename = "aadTenant", default, skip_serializing_if = "Option::is_none")] + pub aad_tenant: Option, + #[doc = "AAD Vpn authentication parameter AAD audience."] + #[serde(rename = "aadAudience", default, skip_serializing_if = "Option::is_none")] + pub aad_audience: Option, + #[doc = "AAD Vpn authentication parameter AAD issuer."] + #[serde(rename = "aadIssuer", default, skip_serializing_if = "Option::is_none")] + pub aad_issuer: Option, +} +impl AadAuthenticationParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Access to be allowed or denied."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Access { + Allow, + Deny, +} +#[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddressSpace { + #[doc = "A list of address blocks reserved for this virtual network in CIDR notation."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, +} +impl AddressSpace { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting where the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ApplicationGateway { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authentication certificates of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAuthenticationCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Authentication certificates properties of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the authentication certificate that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayAuthenticationCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authentication certificates properties of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAuthenticationCertificatePropertiesFormat { + #[doc = "Certificate public data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayAuthenticationCertificatePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application Gateway autoscale configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayAutoscaleConfiguration { + #[doc = "Lower bound on number of Application Gateway capacity."] + #[serde(rename = "minCapacity")] + pub min_capacity: i32, + #[doc = "Upper bound on number of Application Gateway capacity."] + #[serde(rename = "maxCapacity", default, skip_serializing_if = "Option::is_none")] + pub max_capacity: Option, +} +impl ApplicationGatewayAutoscaleConfiguration { + pub fn new(min_capacity: i32) -> Self { + Self { + min_capacity, + max_capacity: None, + } + } +} +pub type ApplicationGatewayAvailableRequestHeadersResult = Vec; +pub type ApplicationGatewayAvailableResponseHeadersResult = Vec; +pub type ApplicationGatewayAvailableServerVariablesResult = Vec; +#[doc = "Response for ApplicationGatewayAvailableSslOptions API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAvailableSslOptions { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of ApplicationGatewayAvailableSslOptions."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApplicationGatewayAvailableSslOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ApplicationGatewayAvailableSslOptions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAvailableSslOptionsPropertiesFormat { + #[doc = "List of available Ssl predefined policy."] + #[serde(rename = "predefinedPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub predefined_policies: Vec, + #[doc = "Ssl predefined policy name enums."] + #[serde(rename = "defaultPolicy", default, skip_serializing_if = "Option::is_none")] + pub default_policy: Option, + #[doc = "List of available Ssl cipher suites."] + #[serde(rename = "availableCipherSuites", default, skip_serializing_if = "Vec::is_empty")] + pub available_cipher_suites: Vec, + #[doc = "List of available Ssl protocols."] + #[serde(rename = "availableProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub available_protocols: Vec, +} +impl ApplicationGatewayAvailableSslOptionsPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ApplicationGatewayAvailableSslOptions API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAvailableSslPredefinedPolicies { + #[doc = "List of available Ssl predefined policy."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplicationGatewayAvailableSslPredefinedPolicies { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ApplicationGatewayAvailableWafRuleSets API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayAvailableWafRuleSetsResult { + #[doc = "The list of application gateway rule sets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ApplicationGatewayAvailableWafRuleSetsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backend address of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendAddress { + #[doc = "Fully qualified domain name (FQDN)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} +impl ApplicationGatewayBackendAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backend Address Pool of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendAddressPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Backend Address Pool of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the backend address pool that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayBackendAddressPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Backend Address Pool of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendAddressPoolPropertiesFormat { + #[doc = "Collection of references to IPs defined in network interfaces."] + #[serde(rename = "backendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub backend_ip_configurations: Vec, + #[doc = "Backend addresses."] + #[serde(rename = "backendAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub backend_addresses: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayBackendAddressPoolPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ApplicationGatewayBackendHealth API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHealth { + #[doc = "A list of ApplicationGatewayBackendHealthPool resources."] + #[serde(rename = "backendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub backend_address_pools: Vec, +} +impl ApplicationGatewayBackendHealth { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway BackendHealthHttp settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHealthHttpSettings { + #[doc = "Backend address pool settings of an application gateway."] + #[serde(rename = "backendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_http_settings: Option, + #[doc = "List of ApplicationGatewayBackendHealthServer resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub servers: Vec, +} +impl ApplicationGatewayBackendHealthHttpSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of on demand test probe."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHealthOnDemand { + #[doc = "Backend Address Pool of an application gateway."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "Application gateway BackendHealthHttp settings."] + #[serde(rename = "backendHealthHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_health_http_settings: Option, +} +impl ApplicationGatewayBackendHealthOnDemand { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway BackendHealth pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHealthPool { + #[doc = "Backend Address Pool of an application gateway."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "List of ApplicationGatewayBackendHealthHttpSettings resources."] + #[serde(rename = "backendHttpSettingsCollection", default, skip_serializing_if = "Vec::is_empty")] + pub backend_http_settings_collection: Vec, +} +impl ApplicationGatewayBackendHealthPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway backendhealth http settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHealthServer { + #[doc = "IP address or FQDN of backend server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "IPConfiguration in a network interface."] + #[serde(rename = "ipConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ip_configuration: Option, + #[doc = "Health of backend server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "Health Probe Log."] + #[serde(rename = "healthProbeLog", default, skip_serializing_if = "Option::is_none")] + pub health_probe_log: Option, +} +impl ApplicationGatewayBackendHealthServer { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_backend_health_server { + use super::*; + #[doc = "Health of backend server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + Unknown, + Up, + Down, + Partial, + Draining, + } +} +#[doc = "Backend address pool settings of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHttpSettings { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Backend address pool settings of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the backend http settings that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayBackendHttpSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Backend address pool settings of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendHttpSettingsPropertiesFormat { + #[doc = "The destination port on the backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Cookie based affinity."] + #[serde(rename = "cookieBasedAffinity", default, skip_serializing_if = "Option::is_none")] + pub cookie_based_affinity: Option, + #[doc = "Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 seconds."] + #[serde(rename = "requestTimeout", default, skip_serializing_if = "Option::is_none")] + pub request_timeout: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub probe: Option, + #[doc = "Array of references to application gateway authentication certificates."] + #[serde(rename = "authenticationCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub authentication_certificates: Vec, + #[doc = "Array of references to application gateway trusted root certificates."] + #[serde(rename = "trustedRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub trusted_root_certificates: Vec, + #[doc = "Connection draining allows open connections to a backend server to be active for a specified time after the backend server got removed from the configuration."] + #[serde(rename = "connectionDraining", default, skip_serializing_if = "Option::is_none")] + pub connection_draining: Option, + #[doc = "Host header to be sent to the backend servers."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "Whether to pick host header should be picked from the host name of the backend server. Default value is false."] + #[serde(rename = "pickHostNameFromBackendAddress", default, skip_serializing_if = "Option::is_none")] + pub pick_host_name_from_backend_address: Option, + #[doc = "Cookie name to use for the affinity cookie."] + #[serde(rename = "affinityCookieName", default, skip_serializing_if = "Option::is_none")] + pub affinity_cookie_name: Option, + #[doc = "Whether the probe is enabled. Default value is false."] + #[serde(rename = "probeEnabled", default, skip_serializing_if = "Option::is_none")] + pub probe_enabled: Option, + #[doc = "Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayBackendHttpSettingsPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_backend_http_settings_properties_format { + use super::*; + #[doc = "Cookie based affinity."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CookieBasedAffinity { + Enabled, + Disabled, + } +} +#[doc = "Backend address pool settings of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendSettings { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Backend address pool settings of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the backend settings that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayBackendSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Backend address pool settings of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayBackendSettingsPropertiesFormat { + #[doc = "The destination port on the backend."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Connection timeout in seconds. Application Gateway will fail the request if response is not received within ConnectionTimeout. Acceptable values are from 1 second to 86400 seconds."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub probe: Option, + #[doc = "Array of references to application gateway trusted root certificates."] + #[serde(rename = "trustedRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub trusted_root_certificates: Vec, + #[doc = "Server name indication to be sent to the backend servers for Tls protocol."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false."] + #[serde(rename = "pickHostNameFromBackendAddress", default, skip_serializing_if = "Option::is_none")] + pub pick_host_name_from_backend_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayBackendSettingsPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway client authentication configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayClientAuthConfiguration { + #[doc = "Verify client certificate issuer name on the application gateway."] + #[serde(rename = "verifyClientCertIssuerDN", default, skip_serializing_if = "Option::is_none")] + pub verify_client_cert_issuer_dn: Option, +} +impl ApplicationGatewayClientAuthConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Connection draining allows open connections to a backend server to be active for a specified time after the backend server got removed from the configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayConnectionDraining { + #[doc = "Whether connection draining is enabled or not."] + pub enabled: bool, + #[doc = "The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds."] + #[serde(rename = "drainTimeoutInSec")] + pub drain_timeout_in_sec: i32, +} +impl ApplicationGatewayConnectionDraining { + pub fn new(enabled: bool, drain_timeout_in_sec: i32) -> Self { + Self { + enabled, + drain_timeout_in_sec, + } + } +} +#[doc = "Customer error of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayCustomError { + #[doc = "Status code of the application gateway customer error."] + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[doc = "Error page URL of the application gateway customer error."] + #[serde(rename = "customErrorPageUrl", default, skip_serializing_if = "Option::is_none")] + pub custom_error_page_url: Option, +} +impl ApplicationGatewayCustomError { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_custom_error { + use super::*; + #[doc = "Status code of the application gateway customer error."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StatusCode { + HttpStatus403, + HttpStatus502, + } +} +#[doc = "Allows to disable rules within a rule group or an entire rule group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayFirewallDisabledRuleGroup { + #[doc = "The name of the rule group that will be disabled."] + #[serde(rename = "ruleGroupName")] + pub rule_group_name: String, + #[doc = "The list of rules that will be disabled. If null, all rules of the rule group will be disabled."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +impl ApplicationGatewayFirewallDisabledRuleGroup { + pub fn new(rule_group_name: String) -> Self { + Self { + rule_group_name, + rules: Vec::new(), + } + } +} +#[doc = "Allow to exclude some variable satisfy the condition for the WAF check."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayFirewallExclusion { + #[doc = "The variable to be excluded."] + #[serde(rename = "matchVariable")] + pub match_variable: String, + #[doc = "When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to."] + #[serde(rename = "selectorMatchOperator")] + pub selector_match_operator: String, + #[doc = "When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to."] + pub selector: String, +} +impl ApplicationGatewayFirewallExclusion { + pub fn new(match_variable: String, selector_match_operator: String, selector: String) -> Self { + Self { + match_variable, + selector_match_operator, + selector, + } + } +} +#[doc = "A web application firewall rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayFirewallRule { + #[doc = "The identifier of the web application firewall rule."] + #[serde(rename = "ruleId")] + pub rule_id: i32, + #[doc = "The description of the web application firewall rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ApplicationGatewayFirewallRule { + pub fn new(rule_id: i32) -> Self { + Self { + rule_id, + description: None, + } + } +} +#[doc = "A web application firewall rule group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayFirewallRuleGroup { + #[doc = "The name of the web application firewall rule group."] + #[serde(rename = "ruleGroupName")] + pub rule_group_name: String, + #[doc = "The description of the web application firewall rule group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The rules of the web application firewall rule group."] + pub rules: Vec, +} +impl ApplicationGatewayFirewallRuleGroup { + pub fn new(rule_group_name: String, rules: Vec) -> Self { + Self { + rule_group_name, + description: None, + rules, + } + } +} +#[doc = "A web application firewall rule set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayFirewallRuleSet { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the web application firewall rule set."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApplicationGatewayFirewallRuleSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the web application firewall rule set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayFirewallRuleSetPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The type of the web application firewall rule set."] + #[serde(rename = "ruleSetType")] + pub rule_set_type: String, + #[doc = "The version of the web application firewall rule set type."] + #[serde(rename = "ruleSetVersion")] + pub rule_set_version: String, + #[doc = "The rule groups of the web application firewall rule set."] + #[serde(rename = "ruleGroups")] + pub rule_groups: Vec, +} +impl ApplicationGatewayFirewallRuleSetPropertiesFormat { + pub fn new(rule_set_type: String, rule_set_version: String, rule_groups: Vec) -> Self { + Self { + provisioning_state: None, + rule_set_type, + rule_set_version, + rule_groups, + } + } +} +#[doc = "Frontend IP configuration of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayFrontendIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Frontend IP configuration of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the frontend IP configuration that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayFrontendIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Frontend IP configuration of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayFrontendIpConfigurationPropertiesFormat { + #[doc = "PrivateIPAddress of the network interface IP Configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "privateLinkConfiguration", default, skip_serializing_if = "Option::is_none")] + pub private_link_configuration: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayFrontendIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Frontend port of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayFrontendPort { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Frontend port of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the frontend port that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayFrontendPort { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Frontend port of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayFrontendPortPropertiesFormat { + #[doc = "Frontend port."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayFrontendPortPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application Gateway global configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayGlobalConfiguration { + #[doc = "Enable request buffering."] + #[serde(rename = "enableRequestBuffering", default, skip_serializing_if = "Option::is_none")] + pub enable_request_buffering: Option, + #[doc = "Enable response buffering."] + #[serde(rename = "enableResponseBuffering", default, skip_serializing_if = "Option::is_none")] + pub enable_response_buffering: Option, +} +impl ApplicationGatewayGlobalConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Header configuration of the Actions set in Application Gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayHeaderConfiguration { + #[doc = "Header name of the header configuration."] + #[serde(rename = "headerName", default, skip_serializing_if = "Option::is_none")] + pub header_name: Option, + #[doc = "Header value of the header configuration."] + #[serde(rename = "headerValue", default, skip_serializing_if = "Option::is_none")] + pub header_value: Option, +} +impl ApplicationGatewayHeaderConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Http listener of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayHttpListener { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of HTTP listener of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the HTTP listener that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayHttpListener { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of HTTP listener of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayHttpListenerPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub frontend_ip_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendPort", default, skip_serializing_if = "Option::is_none")] + pub frontend_port: Option, + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Host name of HTTP listener."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "sslCertificate", default, skip_serializing_if = "Option::is_none")] + pub ssl_certificate: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "sslProfile", default, skip_serializing_if = "Option::is_none")] + pub ssl_profile: Option, + #[doc = "Applicable only if protocol is https. Enables SNI for multi-hosting."] + #[serde(rename = "requireServerNameIndication", default, skip_serializing_if = "Option::is_none")] + pub require_server_name_indication: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Custom error configurations of the HTTP listener."] + #[serde(rename = "customErrorConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub custom_error_configurations: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "firewallPolicy", default, skip_serializing_if = "Option::is_none")] + pub firewall_policy: Option, + #[doc = "List of Host names for HTTP Listener that allows special wildcard characters as well."] + #[serde(rename = "hostNames", default, skip_serializing_if = "Vec::is_empty")] + pub host_names: Vec, +} +impl ApplicationGatewayHttpListenerPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the IP configuration that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayIpConfigurationPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListApplicationGateways API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayListResult { + #[doc = "List of an application gateways in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplicationGatewayListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Listener of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayListener { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of listener of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the listener that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayListener { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of listener of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayListenerPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub frontend_ip_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendPort", default, skip_serializing_if = "Option::is_none")] + pub frontend_port: Option, + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "sslCertificate", default, skip_serializing_if = "Option::is_none")] + pub ssl_certificate: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "sslProfile", default, skip_serializing_if = "Option::is_none")] + pub ssl_profile: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayListenerPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Load Distribution Algorithm enums."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ApplicationGatewayLoadDistributionAlgorithmEnum { + RoundRobin, + LeastConnections, + IpHash, +} +#[doc = "Load Distribution Policy of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayLoadDistributionPolicy { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Load Distribution Policy of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the load distribution policy that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayLoadDistributionPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Load Distribution Policy of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayLoadDistributionPolicyPropertiesFormat { + #[doc = "Load Distribution Targets resource of an application gateway."] + #[serde(rename = "loadDistributionTargets", default, skip_serializing_if = "Vec::is_empty")] + pub load_distribution_targets: Vec, + #[doc = "Load Distribution Algorithm enums."] + #[serde(rename = "loadDistributionAlgorithm", default, skip_serializing_if = "Option::is_none")] + pub load_distribution_algorithm: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayLoadDistributionPolicyPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Load Distribution Target of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayLoadDistributionTarget { + #[serde(flatten)] + pub sub_resource: SubResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the load distribution policy that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayLoadDistributionTarget { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayLoadDistributionTargetPropertiesFormat { + #[doc = "Weight per server. Range between 1 and 100."] + #[serde(rename = "weightPerServer", default, skip_serializing_if = "Option::is_none")] + pub weight_per_server: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, +} +impl ApplicationGatewayLoadDistributionTargetPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of on demand test probe request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayOnDemandProbe { + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Host name to send the probe to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[doc = "Relative path of probe. Valid path starts from '/'. Probe is sent to ://:."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "Whether the host header should be picked from the backend http settings. Default value is false."] + #[serde(rename = "pickHostNameFromBackendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub pick_host_name_from_backend_http_settings: Option, + #[doc = "Application gateway probe health response match."] + #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")] + pub match_: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_http_settings: Option, +} +impl ApplicationGatewayOnDemandProbe { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Path rule of URL path map of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPathRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of path rule of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the path rule that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayPathRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of path rule of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPathRulePropertiesFormat { + #[doc = "Path rules of URL path map."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub paths: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_http_settings: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "redirectConfiguration", default, skip_serializing_if = "Option::is_none")] + pub redirect_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "rewriteRuleSet", default, skip_serializing_if = "Option::is_none")] + pub rewrite_rule_set: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "loadDistributionPolicy", default, skip_serializing_if = "Option::is_none")] + pub load_distribution_policy: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "firewallPolicy", default, skip_serializing_if = "Option::is_none")] + pub firewall_policy: Option, +} +impl ApplicationGatewayPathRulePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Endpoint connection on an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateEndpointConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Private Link Resource of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the private endpoint connection on an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayPrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private endpoint connections for an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateEndpointConnectionListResult { + #[doc = "List of private endpoint connections on an application gateway."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplicationGatewayPrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Private Link Resource of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateEndpointConnectionProperties { + #[doc = "Private endpoint resource."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The consumer link id."] + #[serde(rename = "linkIdentifier", default, skip_serializing_if = "Option::is_none")] + pub link_identifier: Option, +} +impl ApplicationGatewayPrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Link Configuration on an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of private link configuration on an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the private link configuration that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayPrivateLinkConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of private link configuration on an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkConfigurationProperties { + #[doc = "An array of application gateway private link ip configurations."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayPrivateLinkConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The application gateway private link ip configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of an application gateway private link IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of application gateway private link ip configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayPrivateLinkIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of an application gateway private link IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkIpConfigurationProperties { + #[doc = "The private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Whether the ip configuration is primary or not."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayPrivateLinkIpConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateLink Resource of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of a private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the private link resource that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayPrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListApplicationGatewayPrivateLinkResources API service call. Gets all private link resources for an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkResourceListResult { + #[doc = "List of private link resources of an application gateway."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplicationGatewayPrivateLinkResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPrivateLinkResourceProperties { + #[doc = "Group identifier of private link resource."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "Required member names of private link resource."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "Required DNS zone names of the the private link resource."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl ApplicationGatewayPrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Probe of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayProbe { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of probe of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the probe that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayProbe { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway probe health response match."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayProbeHealthResponseMatch { + #[doc = "Body that must be contained in the health response. Default value is empty."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[doc = "Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399."] + #[serde(rename = "statusCodes", default, skip_serializing_if = "Vec::is_empty")] + pub status_codes: Vec, +} +impl ApplicationGatewayProbeHealthResponseMatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of probe of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayProbePropertiesFormat { + #[doc = "Application Gateway protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Host name to send the probe to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[doc = "Relative path of probe. Valid path starts from '/'. Probe is sent to ://:."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[doc = "The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20."] + #[serde(rename = "unhealthyThreshold", default, skip_serializing_if = "Option::is_none")] + pub unhealthy_threshold: Option, + #[doc = "Whether the host header should be picked from the backend http settings. Default value is false."] + #[serde(rename = "pickHostNameFromBackendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub pick_host_name_from_backend_http_settings: Option, + #[doc = "Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false."] + #[serde(rename = "pickHostNameFromBackendSettings", default, skip_serializing_if = "Option::is_none")] + pub pick_host_name_from_backend_settings: Option, + #[doc = "Minimum number of servers that are always marked healthy. Default value is 0."] + #[serde(rename = "minServers", default, skip_serializing_if = "Option::is_none")] + pub min_servers: Option, + #[doc = "Application gateway probe health response match."] + #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")] + pub match_: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Custom port which will be used for probing the backend servers. The valid value ranges from 1 to 65535. In case not set, port from http settings will be used. This property is valid for Standard_v2 and WAF_v2 only."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl ApplicationGatewayProbePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayPropertiesFormat { + #[doc = "SKU of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Application Gateway Ssl policy."] + #[serde(rename = "sslPolicy", default, skip_serializing_if = "Option::is_none")] + pub ssl_policy: Option, + #[doc = "Operational state of the application gateway resource."] + #[serde(rename = "operationalState", default, skip_serializing_if = "Option::is_none")] + pub operational_state: Option, + #[doc = "Subnets of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "gatewayIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub gateway_ip_configurations: Vec, + #[doc = "Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "authenticationCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub authentication_certificates: Vec, + #[doc = "Trusted Root certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "trustedRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub trusted_root_certificates: Vec, + #[doc = "Trusted client certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "trustedClientCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub trusted_client_certificates: Vec, + #[doc = "SSL certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "sslCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub ssl_certificates: Vec, + #[doc = "Frontend IP addresses of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "frontendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub frontend_ip_configurations: Vec, + #[doc = "Frontend ports of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "frontendPorts", default, skip_serializing_if = "Vec::is_empty")] + pub frontend_ports: Vec, + #[doc = "Probes of the application gateway resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub probes: Vec, + #[doc = "Backend address pool of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "backendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub backend_address_pools: Vec, + #[doc = "Backend http settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "backendHttpSettingsCollection", default, skip_serializing_if = "Vec::is_empty")] + pub backend_http_settings_collection: Vec, + #[doc = "Backend settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "backendSettingsCollection", default, skip_serializing_if = "Vec::is_empty")] + pub backend_settings_collection: Vec, + #[doc = "Http listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "httpListeners", default, skip_serializing_if = "Vec::is_empty")] + pub http_listeners: Vec, + #[doc = "Listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub listeners: Vec, + #[doc = "SSL profiles of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "sslProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub ssl_profiles: Vec, + #[doc = "URL path map of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "urlPathMaps", default, skip_serializing_if = "Vec::is_empty")] + pub url_path_maps: Vec, + #[doc = "Request routing rules of the application gateway resource."] + #[serde(rename = "requestRoutingRules", default, skip_serializing_if = "Vec::is_empty")] + pub request_routing_rules: Vec, + #[doc = "Routing rules of the application gateway resource."] + #[serde(rename = "routingRules", default, skip_serializing_if = "Vec::is_empty")] + pub routing_rules: Vec, + #[doc = "Rewrite rules for the application gateway resource."] + #[serde(rename = "rewriteRuleSets", default, skip_serializing_if = "Vec::is_empty")] + pub rewrite_rule_sets: Vec, + #[doc = "Redirect configurations of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits)."] + #[serde(rename = "redirectConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub redirect_configurations: Vec, + #[doc = "Application gateway web application firewall configuration."] + #[serde(rename = "webApplicationFirewallConfiguration", default, skip_serializing_if = "Option::is_none")] + pub web_application_firewall_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "firewallPolicy", default, skip_serializing_if = "Option::is_none")] + pub firewall_policy: Option, + #[doc = "Whether HTTP2 is enabled on the application gateway resource."] + #[serde(rename = "enableHttp2", default, skip_serializing_if = "Option::is_none")] + pub enable_http2: Option, + #[doc = "Whether FIPS is enabled on the application gateway resource."] + #[serde(rename = "enableFips", default, skip_serializing_if = "Option::is_none")] + pub enable_fips: Option, + #[doc = "Application Gateway autoscale configuration."] + #[serde(rename = "autoscaleConfiguration", default, skip_serializing_if = "Option::is_none")] + pub autoscale_configuration: Option, + #[doc = "PrivateLink configurations on application gateway."] + #[serde(rename = "privateLinkConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_configurations: Vec, + #[doc = "Private Endpoint connections on application gateway."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "The resource GUID property of the application gateway resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Custom error configurations of the application gateway resource."] + #[serde(rename = "customErrorConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub custom_error_configurations: Vec, + #[doc = "If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config."] + #[serde(rename = "forceFirewallPolicyAssociation", default, skip_serializing_if = "Option::is_none")] + pub force_firewall_policy_association: Option, + #[doc = "Load distribution policies of the application gateway resource."] + #[serde(rename = "loadDistributionPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub load_distribution_policies: Vec, + #[doc = "Application Gateway global configuration."] + #[serde(rename = "globalConfiguration", default, skip_serializing_if = "Option::is_none")] + pub global_configuration: Option, +} +impl ApplicationGatewayPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_properties_format { + use super::*; + #[doc = "Operational state of the application gateway resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationalState { + Stopped, + Starting, + Running, + Stopping, + } +} +#[doc = "Application Gateway protocol."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ApplicationGatewayProtocol { + Http, + Https, + Tcp, + Tls, +} +#[doc = "Redirect configuration of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRedirectConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of redirect configuration of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the redirect configuration that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayRedirectConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of redirect configuration of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRedirectConfigurationPropertiesFormat { + #[doc = "Redirect type enum."] + #[serde(rename = "redirectType", default, skip_serializing_if = "Option::is_none")] + pub redirect_type: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "targetListener", default, skip_serializing_if = "Option::is_none")] + pub target_listener: Option, + #[doc = "Url to redirect the request to."] + #[serde(rename = "targetUrl", default, skip_serializing_if = "Option::is_none")] + pub target_url: Option, + #[doc = "Include path in the redirected url."] + #[serde(rename = "includePath", default, skip_serializing_if = "Option::is_none")] + pub include_path: Option, + #[doc = "Include query string in the redirected url."] + #[serde(rename = "includeQueryString", default, skip_serializing_if = "Option::is_none")] + pub include_query_string: Option, + #[doc = "Request routing specifying redirect configuration."] + #[serde(rename = "requestRoutingRules", default, skip_serializing_if = "Vec::is_empty")] + pub request_routing_rules: Vec, + #[doc = "Url path maps specifying default redirect configuration."] + #[serde(rename = "urlPathMaps", default, skip_serializing_if = "Vec::is_empty")] + pub url_path_maps: Vec, + #[doc = "Path rules specifying redirect configuration."] + #[serde(rename = "pathRules", default, skip_serializing_if = "Vec::is_empty")] + pub path_rules: Vec, +} +impl ApplicationGatewayRedirectConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request routing rule of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRequestRoutingRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of request routing rule of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the request routing rule that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayRequestRoutingRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of request routing rule of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRequestRoutingRulePropertiesFormat { + #[doc = "Rule type."] + #[serde(rename = "ruleType", default, skip_serializing_if = "Option::is_none")] + pub rule_type: Option, + #[doc = "Priority of the request routing rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_http_settings: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "httpListener", default, skip_serializing_if = "Option::is_none")] + pub http_listener: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "urlPathMap", default, skip_serializing_if = "Option::is_none")] + pub url_path_map: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "rewriteRuleSet", default, skip_serializing_if = "Option::is_none")] + pub rewrite_rule_set: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "redirectConfiguration", default, skip_serializing_if = "Option::is_none")] + pub redirect_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "loadDistributionPolicy", default, skip_serializing_if = "Option::is_none")] + pub load_distribution_policy: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayRequestRoutingRulePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_request_routing_rule_properties_format { + use super::*; + #[doc = "Rule type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleType { + Basic, + PathBasedRouting, + } +} +#[doc = "Rewrite rule of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRewriteRule { + #[doc = "Name of the rewrite rule that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet."] + #[serde(rename = "ruleSequence", default, skip_serializing_if = "Option::is_none")] + pub rule_sequence: Option, + #[doc = "Conditions based on which the action set execution will be evaluated."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub conditions: Vec, + #[doc = "Set of actions in the Rewrite Rule in Application Gateway."] + #[serde(rename = "actionSet", default, skip_serializing_if = "Option::is_none")] + pub action_set: Option, +} +impl ApplicationGatewayRewriteRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Set of actions in the Rewrite Rule in Application Gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRewriteRuleActionSet { + #[doc = "Request Header Actions in the Action Set."] + #[serde(rename = "requestHeaderConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub request_header_configurations: Vec, + #[doc = "Response Header Actions in the Action Set."] + #[serde(rename = "responseHeaderConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub response_header_configurations: Vec, + #[doc = "Url configuration of the Actions set in Application Gateway."] + #[serde(rename = "urlConfiguration", default, skip_serializing_if = "Option::is_none")] + pub url_configuration: Option, +} +impl ApplicationGatewayRewriteRuleActionSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Set of conditions in the Rewrite Rule in Application Gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRewriteRuleCondition { + #[doc = "The condition parameter of the RewriteRuleCondition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub variable: Option, + #[doc = "The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pattern: Option, + #[doc = "Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison."] + #[serde(rename = "ignoreCase", default, skip_serializing_if = "Option::is_none")] + pub ignore_case: Option, + #[doc = "Setting this value as truth will force to check the negation of the condition given by the user."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub negate: Option, +} +impl ApplicationGatewayRewriteRuleCondition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Rewrite rule set of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRewriteRuleSet { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of rewrite rule set of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the rewrite rule set that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ApplicationGatewayRewriteRuleSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of rewrite rule set of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRewriteRuleSetPropertiesFormat { + #[doc = "Rewrite rules in the rewrite rule set."] + #[serde(rename = "rewriteRules", default, skip_serializing_if = "Vec::is_empty")] + pub rewrite_rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayRewriteRuleSetPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Routing rule of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRoutingRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of routing rule of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the routing rule that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayRoutingRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of routing rule of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayRoutingRulePropertiesFormat { + #[doc = "Rule type."] + #[serde(rename = "ruleType", default, skip_serializing_if = "Option::is_none")] + pub rule_type: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendSettings", default, skip_serializing_if = "Option::is_none")] + pub backend_settings: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub listener: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayRoutingRulePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_routing_rule_properties_format { + use super::*; + #[doc = "Rule type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleType { + Basic, + PathBasedRouting, + } +} +#[doc = "SKU of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySku { + #[doc = "Name of an application gateway SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Tier of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "Capacity (instance count) of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl ApplicationGatewaySku { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_sku { + use super::*; + #[doc = "Name of an application gateway SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "Standard_Small")] + StandardSmall, + #[serde(rename = "Standard_Medium")] + StandardMedium, + #[serde(rename = "Standard_Large")] + StandardLarge, + #[serde(rename = "WAF_Medium")] + WafMedium, + #[serde(rename = "WAF_Large")] + WafLarge, + #[serde(rename = "Standard_v2")] + StandardV2, + #[serde(rename = "WAF_v2")] + WafV2, + } + #[doc = "Tier of an application gateway."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + #[serde(rename = "WAF")] + Waf, + #[serde(rename = "Standard_v2")] + StandardV2, + #[serde(rename = "WAF_v2")] + WafV2, + } +} +#[doc = "SSL certificates of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of SSL certificates of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the SSL certificate that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewaySslCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of SSL certificates of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslCertificatePropertiesFormat { + #[doc = "Base-64 encoded pfx certificate. Only applicable in PUT Request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "Password for the pfx file specified in data. Only applicable in PUT request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request."] + #[serde(rename = "publicCertData", default, skip_serializing_if = "Option::is_none")] + pub public_cert_data: Option, + #[doc = "Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault."] + #[serde(rename = "keyVaultSecretId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_secret_id: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewaySslCertificatePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application Gateway Ssl policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslPolicy { + #[doc = "Ssl protocols to be disabled on application gateway."] + #[serde(rename = "disabledSslProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub disabled_ssl_protocols: Vec, + #[doc = "Type of Ssl Policy."] + #[serde(rename = "policyType", default, skip_serializing_if = "Option::is_none")] + pub policy_type: Option, + #[doc = "Ssl predefined policy name enums."] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Ssl cipher suites to be enabled in the specified order to application gateway."] + #[serde(rename = "cipherSuites", default, skip_serializing_if = "Vec::is_empty")] + pub cipher_suites: Vec, + #[doc = "Ssl protocol enums."] + #[serde(rename = "minProtocolVersion", default, skip_serializing_if = "Option::is_none")] + pub min_protocol_version: Option, +} +impl ApplicationGatewaySslPolicy { + pub fn new() -> Self { + Self::default() + } +} +pub mod application_gateway_ssl_policy { + use super::*; + #[doc = "Type of Ssl Policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PolicyType { + Predefined, + Custom, + } +} +#[doc = "An Ssl predefined policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslPredefinedPolicy { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Name of the Ssl predefined policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Properties of ApplicationGatewaySslPredefinedPolicy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ApplicationGatewaySslPredefinedPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ApplicationGatewaySslPredefinedPolicy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslPredefinedPolicyPropertiesFormat { + #[doc = "Ssl cipher suites to be enabled in the specified order for application gateway."] + #[serde(rename = "cipherSuites", default, skip_serializing_if = "Vec::is_empty")] + pub cipher_suites: Vec, + #[doc = "Ssl protocol enums."] + #[serde(rename = "minProtocolVersion", default, skip_serializing_if = "Option::is_none")] + pub min_protocol_version: Option, +} +impl ApplicationGatewaySslPredefinedPolicyPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SSL profile of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslProfile { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of SSL profile of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the SSL profile that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewaySslProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of SSL profile of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewaySslProfilePropertiesFormat { + #[doc = "Array of references to application gateway trusted client certificates."] + #[serde(rename = "trustedClientCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub trusted_client_certificates: Vec, + #[doc = "Application Gateway Ssl policy."] + #[serde(rename = "sslPolicy", default, skip_serializing_if = "Option::is_none")] + pub ssl_policy: Option, + #[doc = "Application gateway client authentication configuration."] + #[serde(rename = "clientAuthConfiguration", default, skip_serializing_if = "Option::is_none")] + pub client_auth_configuration: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewaySslProfilePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trusted client certificates of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayTrustedClientCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Trusted client certificates properties of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the trusted client certificate that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayTrustedClientCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trusted client certificates properties of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayTrustedClientCertificatePropertiesFormat { + #[doc = "Certificate public data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "Validated certificate data."] + #[serde(rename = "validatedCertData", default, skip_serializing_if = "Option::is_none")] + pub validated_cert_data: Option, + #[doc = "Distinguished name of client certificate issuer."] + #[serde(rename = "clientCertIssuerDN", default, skip_serializing_if = "Option::is_none")] + pub client_cert_issuer_dn: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayTrustedClientCertificatePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trusted Root certificates of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayTrustedRootCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Trusted Root certificates properties of an application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the trusted root certificate that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayTrustedRootCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trusted Root certificates properties of an application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayTrustedRootCertificatePropertiesFormat { + #[doc = "Certificate public data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault."] + #[serde(rename = "keyVaultSecretId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_secret_id: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayTrustedRootCertificatePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Url configuration of the Actions set in Application Gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayUrlConfiguration { + #[doc = "Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null."] + #[serde(rename = "modifiedPath", default, skip_serializing_if = "Option::is_none")] + pub modified_path: Option, + #[doc = "Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null."] + #[serde(rename = "modifiedQueryString", default, skip_serializing_if = "Option::is_none")] + pub modified_query_string: Option, + #[doc = "If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path. Default value is false."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reroute: Option, +} +impl ApplicationGatewayUrlConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "UrlPathMaps give a url path to the backend mapping information for PathBasedRouting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayUrlPathMap { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of UrlPathMap of the application gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the URL path map that is unique within an Application Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ApplicationGatewayUrlPathMap { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of UrlPathMap of the application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationGatewayUrlPathMapPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultBackendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub default_backend_address_pool: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultBackendHttpSettings", default, skip_serializing_if = "Option::is_none")] + pub default_backend_http_settings: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultRewriteRuleSet", default, skip_serializing_if = "Option::is_none")] + pub default_rewrite_rule_set: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultRedirectConfiguration", default, skip_serializing_if = "Option::is_none")] + pub default_redirect_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultLoadDistributionPolicy", default, skip_serializing_if = "Option::is_none")] + pub default_load_distribution_policy: Option, + #[doc = "Path rule of URL path map resource."] + #[serde(rename = "pathRules", default, skip_serializing_if = "Vec::is_empty")] + pub path_rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationGatewayUrlPathMapPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application gateway web application firewall configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationGatewayWebApplicationFirewallConfiguration { + #[doc = "Whether the web application firewall is enabled or not."] + pub enabled: bool, + #[doc = "Web application firewall mode."] + #[serde(rename = "firewallMode")] + pub firewall_mode: application_gateway_web_application_firewall_configuration::FirewallMode, + #[doc = "The type of the web application firewall rule set. Possible values are: 'OWASP'."] + #[serde(rename = "ruleSetType")] + pub rule_set_type: String, + #[doc = "The version of the rule set type."] + #[serde(rename = "ruleSetVersion")] + pub rule_set_version: String, + #[doc = "The disabled rule groups."] + #[serde(rename = "disabledRuleGroups", default, skip_serializing_if = "Vec::is_empty")] + pub disabled_rule_groups: Vec, + #[doc = "Whether allow WAF to check request Body."] + #[serde(rename = "requestBodyCheck", default, skip_serializing_if = "Option::is_none")] + pub request_body_check: Option, + #[doc = "Maximum request body size for WAF."] + #[serde(rename = "maxRequestBodySize", default, skip_serializing_if = "Option::is_none")] + pub max_request_body_size: Option, + #[doc = "Maximum request body size in Kb for WAF."] + #[serde(rename = "maxRequestBodySizeInKb", default, skip_serializing_if = "Option::is_none")] + pub max_request_body_size_in_kb: Option, + #[doc = "Maximum file upload size in Mb for WAF."] + #[serde(rename = "fileUploadLimitInMb", default, skip_serializing_if = "Option::is_none")] + pub file_upload_limit_in_mb: Option, + #[doc = "The exclusion list."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub exclusions: Vec, +} +impl ApplicationGatewayWebApplicationFirewallConfiguration { + pub fn new( + enabled: bool, + firewall_mode: application_gateway_web_application_firewall_configuration::FirewallMode, + rule_set_type: String, + rule_set_version: String, + ) -> Self { + Self { + enabled, + firewall_mode, + rule_set_type, + rule_set_version, + disabled_rule_groups: Vec::new(), + request_body_check: None, + max_request_body_size: None, + max_request_body_size_in_kb: None, + file_upload_limit_in_mb: None, + exclusions: Vec::new(), + } + } +} +pub mod application_gateway_web_application_firewall_configuration { + use super::*; + #[doc = "Web application firewall mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FirewallMode { + Detection, + Prevention, + } +} +#[doc = "Rule of type application."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplicationRule { + #[serde(flatten)] + pub firewall_policy_rule: FirewallPolicyRule, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses or Service Tags."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "Array of Application Protocols."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, + #[doc = "List of FQDNs for this rule."] + #[serde(rename = "targetFqdns", default, skip_serializing_if = "Vec::is_empty")] + pub target_fqdns: Vec, + #[doc = "List of Urls for this rule condition."] + #[serde(rename = "targetUrls", default, skip_serializing_if = "Vec::is_empty")] + pub target_urls: Vec, + #[doc = "List of FQDN Tags for this rule."] + #[serde(rename = "fqdnTags", default, skip_serializing_if = "Vec::is_empty")] + pub fqdn_tags: Vec, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, + #[doc = "Terminate TLS connections for this rule."] + #[serde(rename = "terminateTLS", default, skip_serializing_if = "Option::is_none")] + pub terminate_tls: Option, + #[doc = "List of destination azure web categories."] + #[serde(rename = "webCategories", default, skip_serializing_if = "Vec::is_empty")] + pub web_categories: Vec, +} +impl ApplicationRule { + pub fn new(firewall_policy_rule: FirewallPolicyRule) -> Self { + Self { + firewall_policy_rule, + source_addresses: Vec::new(), + destination_addresses: Vec::new(), + protocols: Vec::new(), + target_fqdns: Vec::new(), + target_urls: Vec::new(), + fqdn_tags: Vec::new(), + source_ip_groups: Vec::new(), + terminate_tls: None, + web_categories: Vec::new(), + } + } +} +#[doc = "An application security group in a resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationSecurityGroup { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Application security group properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ApplicationSecurityGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of application security groups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationSecurityGroupListResult { + #[doc = "A list of application security groups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplicationSecurityGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application security group properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplicationSecurityGroupPropertiesFormat { + #[doc = "The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ApplicationSecurityGroupPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VPN client authentication method."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AuthenticationMethod { + #[serde(rename = "EAPTLS")] + Eaptls, + #[serde(rename = "EAPMSCHAPv2")] + EapmschaPv2, +} +#[doc = "Response for ListAuthorizations API service call retrieves all authorizations that belongs to an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationListResult { + #[doc = "The authorizations in an ExpressRoute Circuit."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AuthorizationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ExpressRouteCircuitAuthorization."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationPropertiesFormat { + #[doc = "The authorization key."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "The authorization use status."] + #[serde(rename = "authorizationUseStatus", default, skip_serializing_if = "Option::is_none")] + pub authorization_use_status: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AuthorizationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod authorization_properties_format { + use super::*; + #[doc = "The authorization use status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthorizationUseStatus { + Available, + InUse, + } +} +#[doc = "The information of an AutoApprovedPrivateLinkService."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoApprovedPrivateLinkService { + #[doc = "The id of the private link service resource."] + #[serde(rename = "privateLinkService", default, skip_serializing_if = "Option::is_none")] + pub private_link_service: Option, +} +impl AutoApprovedPrivateLinkService { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An array of private link service id that can be linked to a private end point with auto approved."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoApprovedPrivateLinkServicesResult { + #[doc = "An array of auto approved private link service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AutoApprovedPrivateLinkServicesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Availability of the metric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Availability { + #[doc = "The time grain of the availability."] + #[serde(rename = "timeGrain", default, skip_serializing_if = "Option::is_none")] + pub time_grain: Option, + #[doc = "The retention of the availability."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retention: Option, + #[doc = "Duration of the availability blob."] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl Availability { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The serviceName of an AvailableDelegation indicates a possible delegation for a subnet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableDelegation { + #[doc = "The name of the AvailableDelegation resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique identifier of the AvailableDelegation resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The name of the service and resource."] + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, + #[doc = "The actions permitted to the service upon delegation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} +impl AvailableDelegation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An array of available delegations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableDelegationsResult { + #[doc = "An array of available delegations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailableDelegationsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The information of an AvailablePrivateEndpointType."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailablePrivateEndpointType { + #[doc = "The name of the service and resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique identifier of the AvailablePrivateEndpoint Type resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The name of the service and resource."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, + #[doc = "Display name of the resource."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +impl AvailablePrivateEndpointType { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An array of available PrivateEndpoint types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailablePrivateEndpointTypesResult { + #[doc = "An array of available privateEndpoint type."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailablePrivateEndpointTypesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of available countries with details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableProvidersList { + #[doc = "List of available countries."] + pub countries: Vec, +} +impl AvailableProvidersList { + pub fn new(countries: Vec) -> Self { + Self { countries } + } +} +#[doc = "City or town details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableProvidersListCity { + #[doc = "The city or town name."] + #[serde(rename = "cityName", default, skip_serializing_if = "Option::is_none")] + pub city_name: Option, + #[doc = "A list of Internet service providers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub providers: Vec, +} +impl AvailableProvidersListCity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Country details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableProvidersListCountry { + #[doc = "The country name."] + #[serde(rename = "countryName", default, skip_serializing_if = "Option::is_none")] + pub country_name: Option, + #[doc = "A list of Internet service providers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub providers: Vec, + #[doc = "List of available states in the country."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub states: Vec, +} +impl AvailableProvidersListCountry { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Constraints that determine the list of available Internet service providers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableProvidersListParameters { + #[doc = "A list of Azure regions."] + #[serde(rename = "azureLocations", default, skip_serializing_if = "Vec::is_empty")] + pub azure_locations: Vec, + #[doc = "The country for available providers list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub country: Option, + #[doc = "The state for available providers list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The city or town for available providers list."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, +} +impl AvailableProvidersListParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "State details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableProvidersListState { + #[doc = "The state name."] + #[serde(rename = "stateName", default, skip_serializing_if = "Option::is_none")] + pub state_name: Option, + #[doc = "A list of Internet service providers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub providers: Vec, + #[doc = "List of available cities or towns in the state."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cities: Vec, +} +impl AvailableProvidersListState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The available service alias."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableServiceAlias { + #[doc = "The name of the service alias."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the service alias."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The resource name of the service alias."] + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, +} +impl AvailableServiceAlias { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An array of available service aliases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableServiceAliasesResult { + #[doc = "An array of available service aliases."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailableServiceAliasesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureAsyncOperationResult { + #[doc = "Status of the Azure async operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Common error representation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl AzureAsyncOperationResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod azure_async_operation_result { + use super::*; + #[doc = "Status of the Azure async operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + InProgress, + Succeeded, + Failed, + } +} +#[doc = "Azure Firewall resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewall { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Azure Firewall."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A list of availability zones denoting where the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureFirewall { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The additional properties of azure firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallAdditionalProperties {} +impl AzureFirewallAdditionalProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of an application rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallApplicationRule { + #[doc = "Name of the application rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "Array of ApplicationRuleProtocols."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, + #[doc = "List of FQDNs for this rule."] + #[serde(rename = "targetFqdns", default, skip_serializing_if = "Vec::is_empty")] + pub target_fqdns: Vec, + #[doc = "List of FQDN Tags for this rule."] + #[serde(rename = "fqdnTags", default, skip_serializing_if = "Vec::is_empty")] + pub fqdn_tags: Vec, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, +} +impl AzureFirewallApplicationRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Application rule collection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallApplicationRuleCollection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the application rule collection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the Azure firewall. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureFirewallApplicationRuleCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the application rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallApplicationRuleCollectionPropertiesFormat { + #[doc = "Priority of the application rule collection resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Properties of the AzureFirewallRCAction."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "Collection of rules used by a application rule collection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AzureFirewallApplicationRuleCollectionPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the application rule protocol."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallApplicationRuleProtocol { + #[doc = "The protocol type of a Application Rule resource."] + #[serde(rename = "protocolType", default, skip_serializing_if = "Option::is_none")] + pub protocol_type: Option, + #[doc = "Port number for the protocol, cannot be greater than 64000. This field is optional."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl AzureFirewallApplicationRuleProtocol { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The protocol type of a Application Rule resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFirewallApplicationRuleProtocolType { + Http, + Https, + Mssql, +} +#[doc = "Azure Firewall FQDN Tag Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallFqdnTag { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Azure Firewall FQDN Tag Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureFirewallFqdnTag { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListAzureFirewallFqdnTags API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallFqdnTagListResult { + #[doc = "List of Azure Firewall FQDN Tags in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AzureFirewallFqdnTagListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Firewall FQDN Tag Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallFqdnTagPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The name of this FQDN Tag."] + #[serde(rename = "fqdnTagName", default, skip_serializing_if = "Option::is_none")] + pub fqdn_tag_name: Option, +} +impl AzureFirewallFqdnTagPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP configuration of an Azure Firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration of an Azure Firewall."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AzureFirewallIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration of an Azure Firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallIpConfigurationPropertiesFormat { + #[doc = "The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AzureFirewallIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IpGroups associated with azure firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallIpGroups { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The iteration number."] + #[serde(rename = "changeNumber", default, skip_serializing_if = "Option::is_none")] + pub change_number: Option, +} +impl AzureFirewallIpGroups { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListAzureFirewalls API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallListResult { + #[doc = "List of Azure Firewalls in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AzureFirewallListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureFirewall NAT Rule Collection Action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNatRcAction { + #[doc = "The action type of a NAT rule collection."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AzureFirewallNatRcAction { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The action type of a NAT rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFirewallNatRcActionType { + Snat, + Dnat, +} +#[doc = "Properties of a NAT rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNatRule { + #[doc = "Name of the NAT rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "List of destination ports."] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, + #[doc = "The translated address for this NAT rule."] + #[serde(rename = "translatedAddress", default, skip_serializing_if = "Option::is_none")] + pub translated_address: Option, + #[doc = "The translated port for this NAT rule."] + #[serde(rename = "translatedPort", default, skip_serializing_if = "Option::is_none")] + pub translated_port: Option, + #[doc = "The translated FQDN for this NAT rule."] + #[serde(rename = "translatedFqdn", default, skip_serializing_if = "Option::is_none")] + pub translated_fqdn: Option, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, +} +impl AzureFirewallNatRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NAT rule collection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNatRuleCollection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the NAT rule collection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the Azure firewall. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureFirewallNatRuleCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the NAT rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNatRuleCollectionProperties { + #[doc = "Priority of the NAT rule collection resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "AzureFirewall NAT Rule Collection Action."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "Collection of rules used by a NAT rule collection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AzureFirewallNatRuleCollectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the network rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNetworkRule { + #[doc = "Name of the network rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Array of AzureFirewallNetworkRuleProtocols."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub protocols: Vec, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "List of destination ports."] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "List of destination FQDNs."] + #[serde(rename = "destinationFqdns", default, skip_serializing_if = "Vec::is_empty")] + pub destination_fqdns: Vec, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, + #[doc = "List of destination IpGroups for this rule."] + #[serde(rename = "destinationIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ip_groups: Vec, +} +impl AzureFirewallNetworkRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network rule collection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNetworkRuleCollection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the network rule collection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the Azure firewall. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureFirewallNetworkRuleCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the network rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallNetworkRuleCollectionPropertiesFormat { + #[doc = "Priority of the network rule collection resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Properties of the AzureFirewallRCAction."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "Collection of rules used by a network rule collection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AzureFirewallNetworkRuleCollectionPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The protocol of a Network Rule resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFirewallNetworkRuleProtocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + Any, + #[serde(rename = "ICMP")] + Icmp, +} +#[doc = "Properties of the Azure Firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallPropertiesFormat { + #[doc = "Collection of application rule collections used by Azure Firewall."] + #[serde(rename = "applicationRuleCollections", default, skip_serializing_if = "Vec::is_empty")] + pub application_rule_collections: Vec, + #[doc = "Collection of NAT rule collections used by Azure Firewall."] + #[serde(rename = "natRuleCollections", default, skip_serializing_if = "Vec::is_empty")] + pub nat_rule_collections: Vec, + #[doc = "Collection of network rule collections used by Azure Firewall."] + #[serde(rename = "networkRuleCollections", default, skip_serializing_if = "Vec::is_empty")] + pub network_rule_collections: Vec, + #[doc = "IP configuration of the Azure Firewall resource."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "IP configuration of an Azure Firewall."] + #[serde(rename = "managementIpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub management_ip_configuration: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The operation mode for Threat Intel."] + #[serde(rename = "threatIntelMode", default, skip_serializing_if = "Option::is_none")] + pub threat_intel_mode: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualHub", default, skip_serializing_if = "Option::is_none")] + pub virtual_hub: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "firewallPolicy", default, skip_serializing_if = "Option::is_none")] + pub firewall_policy: Option, + #[doc = "IP addresses associated with azure firewall."] + #[serde(rename = "hubIPAddresses", default, skip_serializing_if = "Option::is_none")] + pub hub_ip_addresses: Option, + #[doc = "List of IpGroups associated with azure firewall."] + #[serde(rename = "ipGroups", default, skip_serializing_if = "Option::is_none")] + pub ip_groups: Option, + #[doc = "SKU of an Azure Firewall."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The additional properties of azure firewall."] + #[serde(rename = "additionalProperties", default, skip_serializing_if = "Option::is_none")] + pub additional_properties: Option, +} +impl AzureFirewallPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Public IP Address associated with azure firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallPublicIpAddress { + #[doc = "Public IP Address value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, +} +impl AzureFirewallPublicIpAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the AzureFirewallRCAction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallRcAction { + #[doc = "The action type of a rule collection."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AzureFirewallRcAction { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The action type of a rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFirewallRcActionType { + Allow, + Deny, +} +#[doc = "SKU of an Azure Firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFirewallSku { + #[doc = "Name of an Azure Firewall SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Tier of an Azure Firewall."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl AzureFirewallSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod azure_firewall_sku { + use super::*; + #[doc = "Name of an Azure Firewall SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + #[serde(rename = "AZFW_VNet")] + AzfwVNet, + #[serde(rename = "AZFW_Hub")] + AzfwHub, + } + #[doc = "Tier of an Azure Firewall."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + Premium, + Basic, + } +} +#[doc = "The operation mode for Threat Intel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFirewallThreatIntelMode { + Alert, + Deny, + Off, +} +#[doc = "Azure reachability report details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureReachabilityReport { + #[doc = "The aggregation level of Azure reachability report. Can be Country, State or City."] + #[serde(rename = "aggregationLevel")] + pub aggregation_level: String, + #[doc = "Parameters that define a geographic location."] + #[serde(rename = "providerLocation")] + pub provider_location: AzureReachabilityReportLocation, + #[doc = "List of Azure reachability report items."] + #[serde(rename = "reachabilityReport")] + pub reachability_report: Vec, +} +impl AzureReachabilityReport { + pub fn new( + aggregation_level: String, + provider_location: AzureReachabilityReportLocation, + reachability_report: Vec, + ) -> Self { + Self { + aggregation_level, + provider_location, + reachability_report, + } + } +} +#[doc = "Azure reachability report details for a given provider location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureReachabilityReportItem { + #[doc = "The Internet service provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The Azure region."] + #[serde(rename = "azureLocation", default, skip_serializing_if = "Option::is_none")] + pub azure_location: Option, + #[doc = "List of latency details for each of the time series."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub latencies: Vec, +} +impl AzureReachabilityReportItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details on latency for a time series."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureReachabilityReportLatencyInfo { + #[doc = "The time stamp."] + #[serde(rename = "timeStamp", default, skip_serializing_if = "Option::is_none")] + pub time_stamp: Option, + #[doc = "The relative latency score between 1 and 100, higher values indicating a faster connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub score: Option, +} +impl AzureReachabilityReportLatencyInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define a geographic location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureReachabilityReportLocation { + #[doc = "The name of the country."] + pub country: String, + #[doc = "The name of the state."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The name of the city or town."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, +} +impl AzureReachabilityReportLocation { + pub fn new(country: String) -> Self { + Self { + country, + state: None, + city: None, + } + } +} +#[doc = "Geographic and time constraints for Azure reachability report."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureReachabilityReportParameters { + #[doc = "Parameters that define a geographic location."] + #[serde(rename = "providerLocation")] + pub provider_location: AzureReachabilityReportLocation, + #[doc = "List of Internet service providers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub providers: Vec, + #[doc = "Optional Azure regions to scope the query to."] + #[serde(rename = "azureLocations", default, skip_serializing_if = "Vec::is_empty")] + pub azure_locations: Vec, + #[doc = "The start time for the Azure reachability report."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "The end time for the Azure reachability report."] + #[serde(rename = "endTime")] + pub end_time: String, +} +impl AzureReachabilityReportParameters { + pub fn new(provider_location: AzureReachabilityReportLocation, start_time: String, end_time: String) -> Self { + Self { + provider_location, + providers: Vec::new(), + azure_locations: Vec::new(), + start_time, + end_time, + } + } +} +#[doc = "Azure Web Category Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWebCategory { + #[doc = "Azure Web Category Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureWebCategory { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListAzureWebCategories API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWebCategoryListResult { + #[doc = "List of Azure Web Categories for a given Subscription."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AzureWebCategoryListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Web Category Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWebCategoryPropertiesFormat { + #[doc = "The name of the group that the category belongs to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub group: Option, +} +impl AzureWebCategoryPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains bgp community information offered in Service Community resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpCommunity { + #[doc = "The region which the service support. e.g. For O365, region is Global."] + #[serde(rename = "serviceSupportedRegion", default, skip_serializing_if = "Option::is_none")] + pub service_supported_region: Option, + #[doc = "The name of the bgp community. e.g. Skype."] + #[serde(rename = "communityName", default, skip_serializing_if = "Option::is_none")] + pub community_name: Option, + #[doc = "The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing."] + #[serde(rename = "communityValue", default, skip_serializing_if = "Option::is_none")] + pub community_value: Option, + #[doc = "The prefixes that the bgp community contains."] + #[serde(rename = "communityPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub community_prefixes: Vec, + #[doc = "Customer is authorized to use bgp community or not."] + #[serde(rename = "isAuthorizedToUse", default, skip_serializing_if = "Option::is_none")] + pub is_authorized_to_use: Option, + #[doc = "The service group of the bgp community contains."] + #[serde(rename = "serviceGroup", default, skip_serializing_if = "Option::is_none")] + pub service_group: Option, +} +impl BgpCommunity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response for a QueryInboundNatRulePortMapping API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendAddressInboundNatRulePortMappings { + #[doc = "Collection of inbound NAT rule port mappings."] + #[serde(rename = "inboundNatRulePortMappings", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_rule_port_mappings: Vec, +} +impl BackendAddressInboundNatRulePortMappings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Pool of backend IP addresses."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendAddressPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the backend address pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl BackendAddressPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the backend address pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackendAddressPoolPropertiesFormat { + #[doc = "The location of the backend address pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "An array of gateway load balancer tunnel interfaces."] + #[serde(rename = "tunnelInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub tunnel_interfaces: Vec, + #[doc = "An array of backend addresses."] + #[serde(rename = "loadBalancerBackendAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_addresses: Vec, + #[doc = "An array of references to IP addresses defined in network interfaces."] + #[serde(rename = "backendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub backend_ip_configurations: Vec, + #[doc = "An array of references to load balancing rules that use this backend address pool."] + #[serde(rename = "loadBalancingRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancing_rules: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "outboundRule", default, skip_serializing_if = "Option::is_none")] + pub outbound_rule: Option, + #[doc = "An array of references to outbound rules that use this backend address pool."] + #[serde(rename = "outboundRules", default, skip_serializing_if = "Vec::is_empty")] + pub outbound_rules: Vec, + #[doc = "An array of references to inbound NAT rules that use this backend address pool."] + #[serde(rename = "inboundNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Amount of seconds Load Balancer waits for before sending RESET to client and backend address."] + #[serde(rename = "drainPeriodInSeconds", default, skip_serializing_if = "Option::is_none")] + pub drain_period_in_seconds: Option, +} +impl BackendAddressPoolPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The session detail for a target."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionActiveSession { + #[doc = "A unique id for the session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The time when the session started."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The subscription id for the target virtual machine."] + #[serde(rename = "targetSubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub target_subscription_id: Option, + #[doc = "The type of the resource."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "The host name of the target."] + #[serde(rename = "targetHostName", default, skip_serializing_if = "Option::is_none")] + pub target_host_name: Option, + #[doc = "The resource group of the target."] + #[serde(rename = "targetResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group: Option, + #[doc = "The user name who is active on this session."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The IP Address of the target."] + #[serde(rename = "targetIpAddress", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address: Option, + #[doc = "The protocol used to connect to the target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "The resource id of the target."] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + #[doc = "Duration in mins the session has been active."] + #[serde(rename = "sessionDurationInMins", default, skip_serializing_if = "Option::is_none")] + pub session_duration_in_mins: Option, +} +impl BastionActiveSession { + pub fn new() -> Self { + Self::default() + } +} +pub mod bastion_active_session { + use super::*; + #[doc = "The protocol used to connect to the target."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "SSH")] + Ssh, + #[serde(rename = "RDP")] + Rdp, + } +} +#[doc = "Response for GetActiveSessions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionActiveSessionListResult { + #[doc = "List of active sessions on the bastion."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BastionActiveSessionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Bastion Host resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionHost { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Bastion Host."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The sku of this Bastion Host."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +impl BastionHost { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP configuration of an Bastion Host."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionHostIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration of an Bastion Host."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Ip configuration type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl BastionHostIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration of an Bastion Host."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BastionHostIpConfigurationPropertiesFormat { + #[doc = "Reference to another subresource."] + pub subnet: SubResource, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPAddress")] + pub public_ip_address: SubResource, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, +} +impl BastionHostIpConfigurationPropertiesFormat { + pub fn new(subnet: SubResource, public_ip_address: SubResource) -> Self { + Self { + subnet, + public_ip_address, + provisioning_state: None, + private_ip_allocation_method: None, + } + } +} +#[doc = "Response for ListBastionHosts API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionHostListResult { + #[doc = "List of Bastion Hosts in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BastionHostListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Bastion Host."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionHostPropertiesFormat { + #[doc = "IP configuration of the Bastion Host resource."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "FQDN for the endpoint on which bastion host is accessible."] + #[serde(rename = "dnsName", default, skip_serializing_if = "Option::is_none")] + pub dns_name: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The scale units for the Bastion Host resource."] + #[serde(rename = "scaleUnits", default, skip_serializing_if = "Option::is_none")] + pub scale_units: Option, + #[doc = "Enable/Disable Copy/Paste feature of the Bastion Host resource."] + #[serde(rename = "disableCopyPaste", default, skip_serializing_if = "Option::is_none")] + pub disable_copy_paste: Option, + #[doc = "Enable/Disable File Copy feature of the Bastion Host resource."] + #[serde(rename = "enableFileCopy", default, skip_serializing_if = "Option::is_none")] + pub enable_file_copy: Option, + #[doc = "Enable/Disable IP Connect feature of the Bastion Host resource."] + #[serde(rename = "enableIpConnect", default, skip_serializing_if = "Option::is_none")] + pub enable_ip_connect: Option, + #[doc = "Enable/Disable Shareable Link of the Bastion Host resource."] + #[serde(rename = "enableShareableLink", default, skip_serializing_if = "Option::is_none")] + pub enable_shareable_link: Option, + #[doc = "Enable/Disable Tunneling feature of the Bastion Host resource."] + #[serde(rename = "enableTunneling", default, skip_serializing_if = "Option::is_none")] + pub enable_tunneling: Option, +} +impl BastionHostPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for DisconnectActiveSessions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionSessionDeleteResult { + #[doc = "List of sessions with their corresponding state."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BastionSessionDeleteResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The session state detail for a target."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionSessionState { + #[doc = "A unique id for the session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "Used for extra information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The state of the session. Disconnected/Failed/NotFound."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl BastionSessionState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Bastion Shareable Link."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BastionShareableLink { + #[doc = "Describes a Virtual Machine."] + pub vm: Vm, + #[doc = "The unique Bastion Shareable Link to the virtual machine."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bsl: Option, + #[doc = "The time when the link was created."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "Optional field indicating the warning or error message related to the vm in case of partial failure."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl BastionShareableLink { + pub fn new(vm: Vm) -> Self { + Self { + vm, + bsl: None, + created_at: None, + message: None, + } + } +} +#[doc = "Post request for all the Bastion Shareable Link endpoints."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionShareableLinkListRequest { + #[doc = "List of VM references."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub vms: Vec, +} +impl BastionShareableLinkListRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for all the Bastion Shareable Link endpoints."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BastionShareableLinkListResult { + #[doc = "List of Bastion Shareable Links for the request."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BastionShareableLinkListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Appliance Site resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the bgp connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Connection type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl BgpConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the bgp connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpConnectionProperties { + #[doc = "Peer ASN."] + #[serde(rename = "peerAsn", default, skip_serializing_if = "Option::is_none")] + pub peer_asn: Option, + #[doc = "Peer IP."] + #[serde(rename = "peerIp", default, skip_serializing_if = "Option::is_none")] + pub peer_ip: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "hubVirtualNetworkConnection", default, skip_serializing_if = "Option::is_none")] + pub hub_virtual_network_connection: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The current state of the VirtualHub to Peer."] + #[serde(rename = "connectionState", default, skip_serializing_if = "Option::is_none")] + pub connection_state: Option, +} +impl BgpConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod bgp_connection_properties { + use super::*; + #[doc = "The current state of the VirtualHub to Peer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionState { + Unknown, + Connecting, + Connected, + NotConnected, + } +} +#[doc = "BGP peer status details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpPeerStatus { + #[doc = "The virtual network gateway's local address."] + #[serde(rename = "localAddress", default, skip_serializing_if = "Option::is_none")] + pub local_address: Option, + #[doc = "The remote BGP peer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub neighbor: Option, + #[doc = "The autonomous system number of the remote BGP peer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub asn: Option, + #[doc = "The BGP peer state."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "For how long the peering has been up."] + #[serde(rename = "connectedDuration", default, skip_serializing_if = "Option::is_none")] + pub connected_duration: Option, + #[doc = "The number of routes learned from this peer."] + #[serde(rename = "routesReceived", default, skip_serializing_if = "Option::is_none")] + pub routes_received: Option, + #[doc = "The number of BGP messages sent."] + #[serde(rename = "messagesSent", default, skip_serializing_if = "Option::is_none")] + pub messages_sent: Option, + #[doc = "The number of BGP messages received."] + #[serde(rename = "messagesReceived", default, skip_serializing_if = "Option::is_none")] + pub messages_received: Option, +} +impl BgpPeerStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod bgp_peer_status { + use super::*; + #[doc = "The BGP peer state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Unknown, + Stopped, + Idle, + Connecting, + Connected, + } +} +#[doc = "Response for list BGP peer status API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpPeerStatusListResult { + #[doc = "List of BGP peers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BgpPeerStatusListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service Community Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpServiceCommunity { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of Service Community."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BgpServiceCommunity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListServiceCommunity API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpServiceCommunityListResult { + #[doc = "A list of service community resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl BgpServiceCommunityListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Service Community."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpServiceCommunityPropertiesFormat { + #[doc = "The name of the bgp community. e.g. Skype."] + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, + #[doc = "A list of bgp communities."] + #[serde(rename = "bgpCommunities", default, skip_serializing_if = "Vec::is_empty")] + pub bgp_communities: Vec, +} +impl BgpServiceCommunityPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BGP settings details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BgpSettings { + #[doc = "The BGP speaker's ASN."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub asn: Option, + #[doc = "The BGP peering address and BGP identifier of this BGP speaker."] + #[serde(rename = "bgpPeeringAddress", default, skip_serializing_if = "Option::is_none")] + pub bgp_peering_address: Option, + #[doc = "The weight added to routes learned from this BGP speaker."] + #[serde(rename = "peerWeight", default, skip_serializing_if = "Option::is_none")] + pub peer_weight: Option, + #[doc = "BGP peering address with IP configuration ID for virtual network gateway."] + #[serde(rename = "bgpPeeringAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub bgp_peering_addresses: Vec, +} +impl BgpSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Virtual Appliance Sku Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BreakOutCategoryPolicies { + #[doc = "Flag to control breakout of o365 allow category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub allow: Option, + #[doc = "Flag to control breakout of o365 optimize category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub optimize: Option, + #[doc = "Flag to control breakout of o365 default category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, +} +impl BreakOutCategoryPolicies { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body of the CheckPrivateLinkServiceVisibility API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckPrivateLinkServiceVisibilityRequest { + #[doc = "The alias of the private link service."] + #[serde(rename = "privateLinkServiceAlias", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_alias: Option, +} +impl CheckPrivateLinkServiceVisibilityRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Ssl cipher suites enums."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CipherSuitesEnum { + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384")] + TlsEcdheRsaWithAes256CbcSha384, + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256")] + TlsEcdheRsaWithAes128CbcSha256, + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA")] + TlsEcdheRsaWithAes256CbcSha, + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA")] + TlsEcdheRsaWithAes128CbcSha, + #[serde(rename = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384")] + TlsDheRsaWithAes256GcmSha384, + #[serde(rename = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256")] + TlsDheRsaWithAes128GcmSha256, + #[serde(rename = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA")] + TlsDheRsaWithAes256CbcSha, + #[serde(rename = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA")] + TlsDheRsaWithAes128CbcSha, + #[serde(rename = "TLS_RSA_WITH_AES_256_GCM_SHA384")] + TlsRsaWithAes256GcmSha384, + #[serde(rename = "TLS_RSA_WITH_AES_128_GCM_SHA256")] + TlsRsaWithAes128GcmSha256, + #[serde(rename = "TLS_RSA_WITH_AES_256_CBC_SHA256")] + TlsRsaWithAes256CbcSha256, + #[serde(rename = "TLS_RSA_WITH_AES_128_CBC_SHA256")] + TlsRsaWithAes128CbcSha256, + #[serde(rename = "TLS_RSA_WITH_AES_256_CBC_SHA")] + TlsRsaWithAes256CbcSha, + #[serde(rename = "TLS_RSA_WITH_AES_128_CBC_SHA")] + TlsRsaWithAes128CbcSha, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384")] + TlsEcdheEcdsaWithAes256GcmSha384, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256")] + TlsEcdheEcdsaWithAes128GcmSha256, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384")] + TlsEcdheEcdsaWithAes256CbcSha384, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256")] + TlsEcdheEcdsaWithAes128CbcSha256, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA")] + TlsEcdheEcdsaWithAes256CbcSha, + #[serde(rename = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA")] + TlsEcdheEcdsaWithAes128CbcSha, + #[serde(rename = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256")] + TlsDheDssWithAes256CbcSha256, + #[serde(rename = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256")] + TlsDheDssWithAes128CbcSha256, + #[serde(rename = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA")] + TlsDheDssWithAes256CbcSha, + #[serde(rename = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA")] + TlsDheDssWithAes128CbcSha, + #[serde(rename = "TLS_RSA_WITH_3DES_EDE_CBC_SHA")] + TlsRsaWith3desEdeCbcSha, + #[serde(rename = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA")] + TlsDheDssWith3desEdeCbcSha, + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")] + TlsEcdheRsaWithAes128GcmSha256, + #[serde(rename = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")] + TlsEcdheRsaWithAes256GcmSha384, +} +#[doc = "Express Route Circuit connection state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CircuitConnectionStatus { + Connected, + Connecting, + Disconnected, +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the operation to create a connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionMonitor { + #[doc = "Connection monitor location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Connection monitor tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Parameters that define the operation to create a connection monitor."] + pub properties: ConnectionMonitorParameters, +} +impl ConnectionMonitor { + pub fn new(properties: ConnectionMonitorParameters) -> Self { + Self { + location: None, + tags: None, + properties, + } + } +} +#[doc = "Describes the destination of connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorDestination { + #[doc = "The ID of the resource used as the destination by connection monitor."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Address of the connection monitor destination (IP or domain name)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "The destination port used by connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl ConnectionMonitorDestination { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the connection monitor endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionMonitorEndpoint { + #[doc = "The name of the connection monitor endpoint."] + pub name: String, + #[doc = "The endpoint type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource ID of the connection monitor endpoint."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Address of the connection monitor endpoint (IP or domain name)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "Describes the connection monitor endpoint filter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[doc = "Describes the connection monitor endpoint scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Test coverage for the endpoint."] + #[serde(rename = "coverageLevel", default, skip_serializing_if = "Option::is_none")] + pub coverage_level: Option, +} +impl ConnectionMonitorEndpoint { + pub fn new(name: String) -> Self { + Self { + name, + type_: None, + resource_id: None, + address: None, + filter: None, + scope: None, + coverage_level: None, + } + } +} +pub mod connection_monitor_endpoint { + use super::*; + #[doc = "The endpoint type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "AzureVM")] + AzureVm, + AzureVNet, + AzureSubnet, + ExternalAddress, + #[serde(rename = "MMAWorkspaceMachine")] + MmaWorkspaceMachine, + #[serde(rename = "MMAWorkspaceNetwork")] + MmaWorkspaceNetwork, + } + #[doc = "Test coverage for the endpoint."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CoverageLevel { + Default, + Low, + BelowAverage, + Average, + AboveAverage, + Full, + } +} +#[doc = "Describes the connection monitor endpoint filter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorEndpointFilter { + #[doc = "The behavior of the endpoint filter. Currently only 'Include' is supported."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "List of items in the filter."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub items: Vec, +} +impl ConnectionMonitorEndpointFilter { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_endpoint_filter { + use super::*; + #[doc = "The behavior of the endpoint filter. Currently only 'Include' is supported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Include, + } +} +#[doc = "Describes the connection monitor endpoint filter item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorEndpointFilterItem { + #[doc = "The type of item included in the filter. Currently only 'AgentAddress' is supported."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The address of the filter item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, +} +impl ConnectionMonitorEndpointFilterItem { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_endpoint_filter_item { + use super::*; + #[doc = "The type of item included in the filter. Currently only 'AgentAddress' is supported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + AgentAddress, + } +} +#[doc = "Describes the connection monitor endpoint scope."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorEndpointScope { + #[doc = "List of items which needs to be included to the endpoint scope."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub include: Vec, + #[doc = "List of items which needs to be excluded from the endpoint scope."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub exclude: Vec, +} +impl ConnectionMonitorEndpointScope { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the connection monitor endpoint scope item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorEndpointScopeItem { + #[doc = "The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, +} +impl ConnectionMonitorEndpointScopeItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the HTTP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorHttpConfiguration { + #[doc = "The port to connect to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The HTTP method to use."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "The path component of the URI. For instance, \"/dir1/dir2\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The HTTP headers to transmit with the request."] + #[serde(rename = "requestHeaders", default, skip_serializing_if = "Vec::is_empty")] + pub request_headers: Vec, + #[doc = "HTTP status codes to consider successful. For instance, \"2xx,301-304,418\"."] + #[serde(rename = "validStatusCodeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub valid_status_code_ranges: Vec, + #[doc = "Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit."] + #[serde(rename = "preferHTTPS", default, skip_serializing_if = "Option::is_none")] + pub prefer_https: Option, +} +impl ConnectionMonitorHttpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_http_configuration { + use super::*; + #[doc = "The HTTP method to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Method { + Get, + Post, + } +} +#[doc = "Describes the ICMP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorIcmpConfiguration { + #[doc = "Value indicating whether path evaluation with trace route should be disabled."] + #[serde(rename = "disableTraceRoute", default, skip_serializing_if = "Option::is_none")] + pub disable_trace_route: Option, +} +impl ConnectionMonitorIcmpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of connection monitors."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorListResult { + #[doc = "Information about connection monitors."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ConnectionMonitorListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes a connection monitor output destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorOutput { + #[doc = "Connection monitor output destination type. Currently, only \"Workspace\" is supported."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Describes the settings for producing output into a log analytics workspace."] + #[serde(rename = "workspaceSettings", default, skip_serializing_if = "Option::is_none")] + pub workspace_settings: Option, +} +impl ConnectionMonitorOutput { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_output { + use super::*; + #[doc = "Connection monitor output destination type. Currently, only \"Workspace\" is supported."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Workspace, + } +} +#[doc = "Parameters that define the operation to create a connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorParameters { + #[doc = "Describes the source of connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "Describes the destination of connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub destination: Option, + #[doc = "Determines if the connection monitor will start automatically once created."] + #[serde(rename = "autoStart", default, skip_serializing_if = "Option::is_none")] + pub auto_start: Option, + #[doc = "Monitoring interval in seconds."] + #[serde(rename = "monitoringIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub monitoring_interval_in_seconds: Option, + #[doc = "List of connection monitor endpoints."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub endpoints: Vec, + #[doc = "List of connection monitor test configurations."] + #[serde(rename = "testConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub test_configurations: Vec, + #[doc = "List of connection monitor test groups."] + #[serde(rename = "testGroups", default, skip_serializing_if = "Vec::is_empty")] + pub test_groups: Vec, + #[doc = "List of connection monitor outputs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub outputs: Vec, + #[doc = "Optional notes to be associated with the connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub notes: Option, +} +impl ConnectionMonitorParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of connection states snapshots."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorQueryResult { + #[doc = "Status of connection monitor source."] + #[serde(rename = "sourceStatus", default, skip_serializing_if = "Option::is_none")] + pub source_status: Option, + #[doc = "Information about connection states."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub states: Vec, +} +impl ConnectionMonitorQueryResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_query_result { + use super::*; + #[doc = "Status of connection monitor source."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceStatus { + Unknown, + Active, + Inactive, + } +} +#[doc = "Information about the connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorResult { + #[doc = "Name of the connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "ID of the connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Connection monitor type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Connection monitor location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Connection monitor tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Describes the properties of a connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ConnectionMonitorResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the properties of a connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorResultProperties { + #[serde(flatten)] + pub connection_monitor_parameters: ConnectionMonitorParameters, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The date and time when the connection monitor was started."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The monitoring status of the connection monitor."] + #[serde(rename = "monitoringStatus", default, skip_serializing_if = "Option::is_none")] + pub monitoring_status: Option, + #[doc = "Type of connection monitor."] + #[serde(rename = "connectionMonitorType", default, skip_serializing_if = "Option::is_none")] + pub connection_monitor_type: Option, +} +impl ConnectionMonitorResultProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_result_properties { + use super::*; + #[doc = "Type of connection monitor."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionMonitorType { + MultiEndpoint, + SingleSourceDestination, + } +} +#[doc = "Describes the source of connection monitor."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionMonitorSource { + #[doc = "The ID of the resource used as the source by connection monitor."] + #[serde(rename = "resourceId")] + pub resource_id: String, + #[doc = "The source port used by connection monitor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl ConnectionMonitorSource { + pub fn new(resource_id: String) -> Self { + Self { resource_id, port: None } + } +} +#[doc = "Describes the threshold for declaring a test successful."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorSuccessThreshold { + #[doc = "The maximum percentage of failed checks permitted for a test to evaluate as successful."] + #[serde(rename = "checksFailedPercent", default, skip_serializing_if = "Option::is_none")] + pub checks_failed_percent: Option, + #[doc = "The maximum round-trip time in milliseconds permitted for a test to evaluate as successful."] + #[serde(rename = "roundTripTimeMs", default, skip_serializing_if = "Option::is_none")] + pub round_trip_time_ms: Option, +} +impl ConnectionMonitorSuccessThreshold { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the TCP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorTcpConfiguration { + #[doc = "The port to connect to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Value indicating whether path evaluation with trace route should be disabled."] + #[serde(rename = "disableTraceRoute", default, skip_serializing_if = "Option::is_none")] + pub disable_trace_route: Option, + #[doc = "Destination port behavior."] + #[serde(rename = "destinationPortBehavior", default, skip_serializing_if = "Option::is_none")] + pub destination_port_behavior: Option, +} +impl ConnectionMonitorTcpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_monitor_tcp_configuration { + use super::*; + #[doc = "Destination port behavior."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DestinationPortBehavior { + None, + ListenIfAvailable, + } +} +#[doc = "Describes a connection monitor test configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionMonitorTestConfiguration { + #[doc = "The name of the connection monitor test configuration."] + pub name: String, + #[doc = "The frequency of test evaluation, in seconds."] + #[serde(rename = "testFrequencySec", default, skip_serializing_if = "Option::is_none")] + pub test_frequency_sec: Option, + #[doc = "The protocol to use in test evaluation."] + pub protocol: connection_monitor_test_configuration::Protocol, + #[doc = "The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters."] + #[serde(rename = "preferredIPVersion", default, skip_serializing_if = "Option::is_none")] + pub preferred_ip_version: Option, + #[doc = "Describes the HTTP configuration."] + #[serde(rename = "httpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub http_configuration: Option, + #[doc = "Describes the TCP configuration."] + #[serde(rename = "tcpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub tcp_configuration: Option, + #[doc = "Describes the ICMP configuration."] + #[serde(rename = "icmpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub icmp_configuration: Option, + #[doc = "Describes the threshold for declaring a test successful."] + #[serde(rename = "successThreshold", default, skip_serializing_if = "Option::is_none")] + pub success_threshold: Option, +} +impl ConnectionMonitorTestConfiguration { + pub fn new(name: String, protocol: connection_monitor_test_configuration::Protocol) -> Self { + Self { + name, + test_frequency_sec: None, + protocol, + preferred_ip_version: None, + http_configuration: None, + tcp_configuration: None, + icmp_configuration: None, + success_threshold: None, + } + } +} +pub mod connection_monitor_test_configuration { + use super::*; + #[doc = "The protocol to use in test evaluation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Http, + Icmp, + } + #[doc = "The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PreferredIpVersion { + IPv4, + IPv6, + } +} +#[doc = "Describes the connection monitor test group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionMonitorTestGroup { + #[doc = "The name of the connection monitor test group."] + pub name: String, + #[doc = "Value indicating whether test group is disabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disable: Option, + #[doc = "List of test configuration names."] + #[serde(rename = "testConfigurations")] + pub test_configurations: Vec, + #[doc = "List of source endpoint names."] + pub sources: Vec, + #[doc = "List of destination endpoint names."] + pub destinations: Vec, +} +impl ConnectionMonitorTestGroup { + pub fn new(name: String, test_configurations: Vec, sources: Vec, destinations: Vec) -> Self { + Self { + name, + disable: None, + test_configurations, + sources, + destinations, + } + } +} +#[doc = "Describes the settings for producing output into a log analytics workspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionMonitorWorkspaceSettings { + #[doc = "Log analytics workspace resource ID."] + #[serde(rename = "workspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_resource_id: Option, +} +impl ConnectionMonitorWorkspaceSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway connection protocol."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ConnectionProtocol { + #[serde(rename = "IKEv2")] + IkEv2, + #[serde(rename = "IKEv1")] + IkEv1, +} +#[doc = "The virtual network connection reset shared key."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionResetSharedKey { + #[doc = "The virtual network connection reset shared key length, should between 1 and 128."] + #[serde(rename = "keyLength")] + pub key_length: i32, +} +impl ConnectionResetSharedKey { + pub fn new(key_length: i32) -> Self { + Self { key_length } + } +} +#[doc = "Response for GetConnectionSharedKey API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionSharedKey { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "The virtual network connection shared key value."] + pub value: String, +} +impl ConnectionSharedKey { + pub fn new(value: String) -> Self { + Self { + sub_resource: SubResource::default(), + value, + } + } +} +#[doc = "Connection state snapshot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionStateSnapshot { + #[doc = "The connection state."] + #[serde(rename = "connectionState", default, skip_serializing_if = "Option::is_none")] + pub connection_state: Option, + #[doc = "The start time of the connection snapshot."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time of the connection snapshot."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Connectivity analysis evaluation state."] + #[serde(rename = "evaluationState", default, skip_serializing_if = "Option::is_none")] + pub evaluation_state: Option, + #[doc = "Average latency in ms."] + #[serde(rename = "avgLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub avg_latency_in_ms: Option, + #[doc = "Minimum latency in ms."] + #[serde(rename = "minLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub min_latency_in_ms: Option, + #[doc = "Maximum latency in ms."] + #[serde(rename = "maxLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub max_latency_in_ms: Option, + #[doc = "The number of sent probes."] + #[serde(rename = "probesSent", default, skip_serializing_if = "Option::is_none")] + pub probes_sent: Option, + #[doc = "The number of failed probes."] + #[serde(rename = "probesFailed", default, skip_serializing_if = "Option::is_none")] + pub probes_failed: Option, + #[doc = "List of hops between the source and the destination."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hops: Vec, +} +impl ConnectionStateSnapshot { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_state_snapshot { + use super::*; + #[doc = "The connection state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionState { + Reachable, + Unreachable, + Unknown, + } + #[doc = "Connectivity analysis evaluation state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EvaluationState { + NotStarted, + InProgress, + Completed, + } +} +#[doc = "Parameters that define destination of connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityDestination { + #[doc = "The ID of the resource to which a connection attempt will be made."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The IP address or URI the resource to which a connection attempt will be made."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "Port on which check connectivity will be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl ConnectivityDestination { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a hop between the source and the destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityHop { + #[doc = "The type of the hop."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The ID of the hop."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The IP address of the hop."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "The ID of the resource corresponding to this hop."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "List of next hop identifiers."] + #[serde(rename = "nextHopIds", default, skip_serializing_if = "Vec::is_empty")] + pub next_hop_ids: Vec, + #[doc = "List of previous hop identifiers."] + #[serde(rename = "previousHopIds", default, skip_serializing_if = "Vec::is_empty")] + pub previous_hop_ids: Vec, + #[doc = "List of hop links."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub links: Vec, + #[doc = "List of previous hop links."] + #[serde(rename = "previousLinks", default, skip_serializing_if = "Vec::is_empty")] + pub previous_links: Vec, + #[doc = "List of issues."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub issues: Vec, +} +impl ConnectivityHop { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information on the connectivity status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityInformation { + #[doc = "List of hops between the source and the destination."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hops: Vec, + #[doc = "The connection status."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Average latency in milliseconds."] + #[serde(rename = "avgLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub avg_latency_in_ms: Option, + #[doc = "Minimum latency in milliseconds."] + #[serde(rename = "minLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub min_latency_in_ms: Option, + #[doc = "Maximum latency in milliseconds."] + #[serde(rename = "maxLatencyInMs", default, skip_serializing_if = "Option::is_none")] + pub max_latency_in_ms: Option, + #[doc = "Total number of probes sent."] + #[serde(rename = "probesSent", default, skip_serializing_if = "Option::is_none")] + pub probes_sent: Option, + #[doc = "Number of failed probes."] + #[serde(rename = "probesFailed", default, skip_serializing_if = "Option::is_none")] + pub probes_failed: Option, +} +impl ConnectivityInformation { + pub fn new() -> Self { + Self::default() + } +} +pub mod connectivity_information { + use super::*; + #[doc = "The connection status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectionStatus { + Unknown, + Connected, + Disconnected, + Degraded, + } +} +#[doc = "Information about an issue encountered in the process of checking for connectivity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectivityIssue { + #[doc = "The origin of the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The severity of the issue."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "The type of issue."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Provides additional context on the issue."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub context: Vec, +} +impl ConnectivityIssue { + pub fn new() -> Self { + Self::default() + } +} +pub mod connectivity_issue { + use super::*; + #[doc = "The origin of the issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + Local, + Inbound, + Outbound, + } + #[doc = "The severity of the issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + Error, + Warning, + } + #[doc = "The type of issue."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Unknown, + AgentStopped, + GuestFirewall, + DnsResolution, + SocketBind, + NetworkSecurityRule, + UserDefinedRoute, + PortThrottled, + Platform, + } +} +#[doc = "Parameters that determine how the connectivity check will be performed."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectivityParameters { + #[doc = "Parameters that define the source of the connection."] + pub source: ConnectivitySource, + #[doc = "Parameters that define destination of connection."] + pub destination: ConnectivityDestination, + #[doc = "Network protocol."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Configuration of the protocol."] + #[serde(rename = "protocolConfiguration", default, skip_serializing_if = "Option::is_none")] + pub protocol_configuration: Option, + #[doc = "IP address version."] + #[serde(rename = "preferredIPVersion", default, skip_serializing_if = "Option::is_none")] + pub preferred_ip_version: Option, +} +impl ConnectivityParameters { + pub fn new(source: ConnectivitySource, destination: ConnectivityDestination) -> Self { + Self { + source, + destination, + protocol: None, + protocol_configuration: None, + preferred_ip_version: None, + } + } +} +pub mod connectivity_parameters { + use super::*; + #[doc = "Network protocol."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Http, + Https, + Icmp, + } +} +#[doc = "Parameters that define the source of the connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectivitySource { + #[doc = "The ID of the resource from which a connectivity check will be initiated."] + #[serde(rename = "resourceId")] + pub resource_id: String, + #[doc = "The source port from which a connectivity check will be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl ConnectivitySource { + pub fn new(resource_id: String) -> Self { + Self { resource_id, port: None } + } +} +#[doc = "Reference to container resource in remote resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Container { + #[serde(flatten)] + pub sub_resource: SubResource, +} +impl Container { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container network interface child resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterface { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of container network interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Sub Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ContainerNetworkInterface { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container network interface configuration child resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterfaceConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Container network interface configuration properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Sub Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ContainerNetworkInterfaceConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container network interface configuration properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterfaceConfigurationPropertiesFormat { + #[doc = "A list of ip configurations of the container network interface configuration."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "A list of container network interfaces created from this container network interface configuration."] + #[serde(rename = "containerNetworkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub container_network_interfaces: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ContainerNetworkInterfaceConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The ip configuration for a container network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterfaceIpConfiguration { + #[doc = "Properties of the container network interface IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Sub Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ContainerNetworkInterfaceIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the container network interface IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterfaceIpConfigurationPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ContainerNetworkInterfaceIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of container network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerNetworkInterfacePropertiesFormat { + #[doc = "Container network interface configuration child resource."] + #[serde( + rename = "containerNetworkInterfaceConfiguration", + default, + skip_serializing_if = "Option::is_none" + )] + pub container_network_interface_configuration: Option, + #[doc = "Reference to container resource in remote resource provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub container: Option, + #[doc = "Reference to the ip configuration on this container nic."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ContainerNetworkInterfacePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains custom Dns resolution configuration from customer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomDnsConfigPropertiesFormat { + #[doc = "Fqdn that resolves to private endpoint ip address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "A list of private ip addresses of the private endpoint."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, +} +impl CustomDnsConfigPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Custom IP prefix resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomIpPrefix { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Custom IP prefix properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting the IP allocated for the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl CustomIpPrefix { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListCustomIpPrefixes API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomIpPrefixListResult { + #[doc = "A list of Custom IP prefixes that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl CustomIpPrefixListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Custom IP prefix properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomIpPrefixPropertiesFormat { + #[doc = "The prefix range in CIDR notation. Should include the start address and the prefix length."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cidr: Option, + #[doc = "Signed message for WAN validation."] + #[serde(rename = "signedMessage", default, skip_serializing_if = "Option::is_none")] + pub signed_message: Option, + #[doc = "Authorization message for WAN validation."] + #[serde(rename = "authorizationMessage", default, skip_serializing_if = "Option::is_none")] + pub authorization_message: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "customIpPrefixParent", default, skip_serializing_if = "Option::is_none")] + pub custom_ip_prefix_parent: Option, + #[doc = "The list of all Children for IPv6 /48 CustomIpPrefix."] + #[serde(rename = "childCustomIpPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub child_custom_ip_prefixes: Vec, + #[doc = "The commissioned state of the Custom IP Prefix."] + #[serde(rename = "commissionedState", default, skip_serializing_if = "Option::is_none")] + pub commissioned_state: Option, + #[doc = "The list of all referenced PublicIpPrefixes."] + #[serde(rename = "publicIpPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + #[doc = "The resource GUID property of the custom IP prefix resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The reason why resource is in failed state."] + #[serde(rename = "failedReason", default, skip_serializing_if = "Option::is_none")] + pub failed_reason: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl CustomIpPrefixPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod custom_ip_prefix_properties_format { + use super::*; + #[doc = "The commissioned state of the Custom IP Prefix."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CommissionedState { + Provisioning, + Provisioned, + Commissioning, + Commissioned, + Decommissioning, + Deprovisioning, + } +} +#[doc = "A DDoS custom policy in a resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosCustomPolicy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "DDoS custom policy properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl DdosCustomPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DDoS custom policy properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosCustomPolicyPropertiesFormat { + #[doc = "The resource GUID property of the DDoS custom policy resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The list of public IPs associated with the DDoS custom policy resource. This list is read-only."] + #[serde(rename = "publicIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_addresses: Vec, + #[doc = "The protocol-specific DDoS policy customization parameters."] + #[serde(rename = "protocolCustomSettings", default, skip_serializing_if = "Vec::is_empty")] + pub protocol_custom_settings: Vec, +} +impl DdosCustomPolicyPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A DDoS protection plan in a resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosProtectionPlan { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "DDoS protection plan properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl DdosProtectionPlan { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of DDoS protection plans."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosProtectionPlanListResult { + #[doc = "A list of DDoS protection plans."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DdosProtectionPlanListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DDoS protection plan properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosProtectionPlanPropertiesFormat { + #[doc = "The resource GUID property of the DDoS protection plan resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The list of virtual networks associated with the DDoS protection plan resource. This list is read-only."] + #[serde(rename = "virtualNetworks", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_networks: Vec, +} +impl DdosProtectionPlanPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains the DDoS protection settings of the public IP."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DdosSettings { + #[doc = "Reference to another subresource."] + #[serde(rename = "ddosCustomPolicy", default, skip_serializing_if = "Option::is_none")] + pub ddos_custom_policy: Option, + #[doc = "The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized."] + #[serde(rename = "protectionCoverage", default, skip_serializing_if = "Option::is_none")] + pub protection_coverage: Option, + #[doc = "Enables DDoS protection on the public IP."] + #[serde(rename = "protectedIP", default, skip_serializing_if = "Option::is_none")] + pub protected_ip: Option, +} +impl DdosSettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod ddos_settings { + use super::*; + #[doc = "The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionCoverage { + Basic, + Standard, + } +} +#[doc = "Details the service to which the subnet is delegated."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Delegation { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of a service delegation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a subnet. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Delegation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of properties of the device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceProperties { + #[doc = "Name of the device Vendor."] + #[serde(rename = "deviceVendor", default, skip_serializing_if = "Option::is_none")] + pub device_vendor: Option, + #[doc = "Model of the device."] + #[serde(rename = "deviceModel", default, skip_serializing_if = "Option::is_none")] + pub device_model: Option, + #[doc = "Link speed."] + #[serde(rename = "linkSpeedInMbps", default, skip_serializing_if = "Option::is_none")] + pub link_speed_in_mbps: Option, +} +impl DeviceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The DH Groups used in IKE Phase 1 for initial SA."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DhGroup { + None, + #[serde(rename = "DHGroup1")] + DhGroup1, + #[serde(rename = "DHGroup2")] + DhGroup2, + #[serde(rename = "DHGroup14")] + DhGroup14, + #[serde(rename = "DHGroup2048")] + DhGroup2048, + #[serde(rename = "ECP256")] + Ecp256, + #[serde(rename = "ECP384")] + Ecp384, + #[serde(rename = "DHGroup24")] + DhGroup24, +} +#[doc = "DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for a subnet overrides VNET DHCP options."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DhcpOptions { + #[doc = "The list of DNS servers IP addresses."] + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, +} +impl DhcpOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dimension of the metric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Dimension { + #[doc = "The name of the dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The display name of the dimension."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The internal name of the dimension."] + #[serde(rename = "internalName", default, skip_serializing_if = "Option::is_none")] + pub internal_name: Option, +} +impl Dimension { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The direction of the traffic."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Direction { + Inbound, + Outbound, +} +#[doc = "Response for the CheckDnsNameAvailability API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DnsNameAvailabilityResult { + #[doc = "Domain availability (True/False)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub available: Option, +} +impl DnsNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DNS Proxy Settings in Firewall Policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DnsSettings { + #[doc = "List of Custom DNS Servers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub servers: Vec, + #[doc = "Enable DNS Proxy on Firewalls attached to the Firewall Policy."] + #[serde(rename = "enableProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_proxy: Option, + #[doc = "FQDNs in Network Rules are supported when set to true."] + #[serde(rename = "requireProxyForNetworkRules", default, skip_serializing_if = "Option::is_none")] + pub require_proxy_for_network_rules: Option, +} +impl DnsSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Differentiated Services Code Point configuration for any given network interface"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DscpConfiguration { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Differentiated Services Code Point configuration properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl DscpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the DscpConfigurationList API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DscpConfigurationListResult { + #[doc = "A list of dscp configurations in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DscpConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Differentiated Services Code Point configuration properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DscpConfigurationPropertiesFormat { + #[doc = "List of markings to be used in the configuration."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub markings: Vec, + #[doc = "Source IP ranges."] + #[serde(rename = "sourceIpRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_ranges: Vec, + #[doc = "Destination IP ranges."] + #[serde(rename = "destinationIpRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ip_ranges: Vec, + #[doc = "Sources port ranges."] + #[serde(rename = "sourcePortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_port_ranges: Vec, + #[doc = "Destination port ranges."] + #[serde(rename = "destinationPortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_port_ranges: Vec, + #[doc = "RNM supported protocol types."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "QoS object definitions"] + #[serde(rename = "qosDefinitionCollection", default, skip_serializing_if = "Vec::is_empty")] + pub qos_definition_collection: Vec, + #[doc = "Qos Collection ID generated by RNM."] + #[serde(rename = "qosCollectionId", default, skip_serializing_if = "Option::is_none")] + pub qos_collection_id: Option, + #[doc = "Associated Network Interfaces to the DSCP Configuration."] + #[serde(rename = "associatedNetworkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub associated_network_interfaces: Vec, + #[doc = "The resource GUID property of the DSCP Configuration resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl DscpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod dscp_configuration_properties_format { + use super::*; + #[doc = "RNM supported protocol types."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + DoNotUse, + Icmp, + Tcp, + Udp, + Gre, + Esp, + Ah, + Vxlan, + All, + } +} +#[doc = "Effective network security group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveNetworkSecurityGroup { + #[doc = "Reference to another subresource."] + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[doc = "The effective network security group association."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub association: Option, + #[doc = "A collection of effective security rules."] + #[serde(rename = "effectiveSecurityRules", default, skip_serializing_if = "Vec::is_empty")] + pub effective_security_rules: Vec, + #[doc = "Mapping of tags to list of IP Addresses included within the tag."] + #[serde(rename = "tagMap", default, skip_serializing_if = "Option::is_none")] + pub tag_map: Option, +} +impl EffectiveNetworkSecurityGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The effective network security group association."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveNetworkSecurityGroupAssociation { + #[doc = "Reference to another subresource."] + #[serde(rename = "networkManager", default, skip_serializing_if = "Option::is_none")] + pub network_manager: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "networkInterface", default, skip_serializing_if = "Option::is_none")] + pub network_interface: Option, +} +impl EffectiveNetworkSecurityGroupAssociation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for list effective network security groups API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveNetworkSecurityGroupListResult { + #[doc = "A list of effective network security groups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EffectiveNetworkSecurityGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Effective network security rules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveNetworkSecurityRule { + #[doc = "The name of the security rule specified by the user (if created by the user)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The network protocol this rule applies to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "The source port or range."] + #[serde(rename = "sourcePortRange", default, skip_serializing_if = "Option::is_none")] + pub source_port_range: Option, + #[doc = "The destination port or range."] + #[serde(rename = "destinationPortRange", default, skip_serializing_if = "Option::is_none")] + pub destination_port_range: Option, + #[doc = "The source port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*)."] + #[serde(rename = "sourcePortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_port_ranges: Vec, + #[doc = "The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*)."] + #[serde(rename = "destinationPortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_port_ranges: Vec, + #[doc = "The source address prefix."] + #[serde(rename = "sourceAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub source_address_prefix: Option, + #[doc = "The destination address prefix."] + #[serde(rename = "destinationAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub destination_address_prefix: Option, + #[doc = "The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*)."] + #[serde(rename = "sourceAddressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub source_address_prefixes: Vec, + #[doc = "The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*)."] + #[serde(rename = "destinationAddressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub destination_address_prefixes: Vec, + #[doc = "The expanded source address prefix."] + #[serde(rename = "expandedSourceAddressPrefix", default, skip_serializing_if = "Vec::is_empty")] + pub expanded_source_address_prefix: Vec, + #[doc = "Expanded destination address prefix."] + #[serde(rename = "expandedDestinationAddressPrefix", default, skip_serializing_if = "Vec::is_empty")] + pub expanded_destination_address_prefix: Vec, + #[doc = "Whether network traffic is allowed or denied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub access: Option, + #[doc = "The priority of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, +} +impl EffectiveNetworkSecurityRule { + pub fn new() -> Self { + Self::default() + } +} +pub mod effective_network_security_rule { + use super::*; + #[doc = "The network protocol this rule applies to."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Udp, + All, + } +} +#[doc = "Effective Route."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveRoute { + #[doc = "The name of the user defined route. This is optional."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "If true, on-premises routes are not propagated to the network interfaces in the subnet."] + #[serde(rename = "disableBgpRoutePropagation", default, skip_serializing_if = "Option::is_none")] + pub disable_bgp_route_propagation: Option, + #[doc = "Who created the route."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The value of effective route."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The address prefixes of the effective routes in CIDR notation."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefix: Vec, + #[doc = "The IP address of the next hop of the effective route."] + #[serde(rename = "nextHopIpAddress", default, skip_serializing_if = "Vec::is_empty")] + pub next_hop_ip_address: Vec, + #[doc = "The type of Azure hop the packet should be sent to."] + #[serde(rename = "nextHopType", default, skip_serializing_if = "Option::is_none")] + pub next_hop_type: Option, +} +impl EffectiveRoute { + pub fn new() -> Self { + Self::default() + } +} +pub mod effective_route { + use super::*; + #[doc = "Who created the route."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Source { + Unknown, + User, + VirtualNetworkGateway, + Default, + } + #[doc = "The value of effective route."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Active, + Invalid, + } +} +#[doc = "Response for list effective route API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveRouteListResult { + #[doc = "A list of effective routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EffectiveRouteListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The parameters specifying the resource whose effective routes are being requested."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EffectiveRoutesParameters { + #[doc = "The resource whose effective routes are being requested."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection."] + #[serde(rename = "virtualWanResourceType", default, skip_serializing_if = "Option::is_none")] + pub virtual_wan_resource_type: Option, +} +impl EffectiveRoutesParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Endpoint service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointServiceResult { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Name of the endpoint service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the endpoint service."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl EndpointServiceResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListAvailableEndpointServices API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointServicesListResult { + #[doc = "List of available endpoint services in a region."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EndpointServicesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "Error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "Inner error message."] + #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")] + pub inner_error: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error details representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetails { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "Error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl ErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Common error details representation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Results of network security group evaluation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EvaluatedNetworkSecurityGroup { + #[doc = "Network security group ID."] + #[serde(rename = "networkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub network_security_group_id: Option, + #[doc = "Resource ID of nic or subnet to which network security group is applied."] + #[serde(rename = "appliedTo", default, skip_serializing_if = "Option::is_none")] + pub applied_to: Option, + #[doc = "Matched rule."] + #[serde(rename = "matchedRule", default, skip_serializing_if = "Option::is_none")] + pub matched_rule: Option, + #[doc = "List of network security rules evaluation results."] + #[serde(rename = "rulesEvaluationResult", default, skip_serializing_if = "Vec::is_empty")] + pub rules_evaluation_result: Vec, +} +impl EvaluatedNetworkSecurityGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines a managed rule to use for exclusion."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExclusionManagedRule { + #[doc = "Identifier for the managed rule."] + #[serde(rename = "ruleId")] + pub rule_id: String, +} +impl ExclusionManagedRule { + pub fn new(rule_id: String) -> Self { + Self { rule_id } + } +} +#[doc = "Defines a managed rule group to use for exclusion."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExclusionManagedRuleGroup { + #[doc = "The managed rule group for exclusion."] + #[serde(rename = "ruleGroupName")] + pub rule_group_name: String, + #[doc = "List of rules that will be excluded. If none specified, all rules in the group will be excluded."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +impl ExclusionManagedRuleGroup { + pub fn new(rule_group_name: String) -> Self { + Self { + rule_group_name, + rules: Vec::new(), + } + } +} +#[doc = "Defines a managed rule set for Exclusions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExclusionManagedRuleSet { + #[doc = "Defines the rule set type to use."] + #[serde(rename = "ruleSetType")] + pub rule_set_type: String, + #[doc = "Defines the version of the rule set to use."] + #[serde(rename = "ruleSetVersion")] + pub rule_set_version: String, + #[doc = "Defines the rule groups to apply to the rule set."] + #[serde(rename = "ruleGroups", default, skip_serializing_if = "Vec::is_empty")] + pub rule_groups: Vec, +} +impl ExclusionManagedRuleSet { + pub fn new(rule_set_type: String, rule_set_version: String) -> Self { + Self { + rule_set_type, + rule_set_version, + rule_groups: Vec::new(), + } + } +} +#[doc = "Explicit Proxy Settings in Firewall Policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExplicitProxySettings { + #[doc = "When set to true, explicit proxy mode is enabled."] + #[serde(rename = "enableExplicitProxy", default, skip_serializing_if = "Option::is_none")] + pub enable_explicit_proxy: Option, + #[doc = "Port number for explicit proxy http protocol, cannot be greater than 64000."] + #[serde(rename = "httpPort", default, skip_serializing_if = "Option::is_none")] + pub http_port: Option, + #[doc = "Port number for explicit proxy https protocol, cannot be greater than 64000."] + #[serde(rename = "httpsPort", default, skip_serializing_if = "Option::is_none")] + pub https_port: Option, + #[doc = "Port number for firewall to serve PAC file."] + #[serde(rename = "pacFilePort", default, skip_serializing_if = "Option::is_none")] + pub pac_file_port: Option, + #[doc = "SAS URL for PAC file."] + #[serde(rename = "pacFile", default, skip_serializing_if = "Option::is_none")] + pub pac_file: Option, +} +impl ExplicitProxySettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRouteCircuit resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuit { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Contains SKU in an ExpressRouteCircuit."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Properties of ExpressRouteCircuit."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExpressRouteCircuit { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The ARP table associated with the ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitArpTable { + #[doc = "Entry age in minutes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub age: Option, + #[doc = "Interface address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interface: Option, + #[doc = "The IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The MAC address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, +} +impl ExpressRouteCircuitArpTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Authorization in an ExpressRouteCircuit resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitAuthorization { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of ExpressRouteCircuitAuthorization."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExpressRouteCircuitAuthorization { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Express Route Circuit Connection in an ExpressRouteCircuitPeering resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the express route circuit connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExpressRouteCircuitConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListConnections API service call retrieves all global reach connections that belongs to a Private Peering for an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitConnectionListResult { + #[doc = "The global reach connection associated with Private Peering in an ExpressRoute Circuit."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the express route circuit connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitConnectionPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "expressRouteCircuitPeering", default, skip_serializing_if = "Option::is_none")] + pub express_route_circuit_peering: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "peerExpressRouteCircuitPeering", default, skip_serializing_if = "Option::is_none")] + pub peer_express_route_circuit_peering: Option, + #[doc = "/29 IP address space to carve out Customer addresses for tunnels."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "The authorization key."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "IPv6 Circuit Connection properties for global reach."] + #[serde(rename = "ipv6CircuitConnectionConfig", default, skip_serializing_if = "Option::is_none")] + pub ipv6_circuit_connection_config: Option, + #[doc = "Express Route Circuit connection state."] + #[serde(rename = "circuitConnectionStatus", default, skip_serializing_if = "Option::is_none")] + pub circuit_connection_status: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ExpressRouteCircuitConnectionPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListExpressRouteCircuit API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitListResult { + #[doc = "A list of ExpressRouteCircuits in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Peering in an ExpressRouteCircuit resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPeering { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the express route circuit peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExpressRouteCircuitPeering { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specifies the peering configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPeeringConfig { + #[doc = "The reference to AdvertisedPublicPrefixes."] + #[serde(rename = "advertisedPublicPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub advertised_public_prefixes: Vec, + #[doc = "The communities of bgp peering. Specified for microsoft peering."] + #[serde(rename = "advertisedCommunities", default, skip_serializing_if = "Vec::is_empty")] + pub advertised_communities: Vec, + #[doc = "The advertised public prefix state of the Peering resource."] + #[serde(rename = "advertisedPublicPrefixesState", default, skip_serializing_if = "Option::is_none")] + pub advertised_public_prefixes_state: Option, + #[doc = "The legacy mode of the peering."] + #[serde(rename = "legacyMode", default, skip_serializing_if = "Option::is_none")] + pub legacy_mode: Option, + #[doc = "The CustomerASN of the peering."] + #[serde(rename = "customerASN", default, skip_serializing_if = "Option::is_none")] + pub customer_asn: Option, + #[doc = "The RoutingRegistryName of the configuration."] + #[serde(rename = "routingRegistryName", default, skip_serializing_if = "Option::is_none")] + pub routing_registry_name: Option, +} +impl ExpressRouteCircuitPeeringConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_circuit_peering_config { + use super::*; + #[doc = "The advertised public prefix state of the Peering resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AdvertisedPublicPrefixesState { + NotConfigured, + Configuring, + Configured, + ValidationNeeded, + } +} +#[doc = "ExpressRoute circuit peering identifier."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPeeringId { + #[doc = "The ID of the ExpressRoute circuit peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ExpressRouteCircuitPeeringId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPeeringListResult { + #[doc = "The peerings in an express route circuit."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitPeeringListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the express route circuit peering."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPeeringPropertiesFormat { + #[doc = "The peering type."] + #[serde(rename = "peeringType", default, skip_serializing_if = "Option::is_none")] + pub peering_type: Option, + #[doc = "The state of peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The Azure ASN."] + #[serde(rename = "azureASN", default, skip_serializing_if = "Option::is_none")] + pub azure_asn: Option, + #[doc = "The peer ASN."] + #[serde(rename = "peerASN", default, skip_serializing_if = "Option::is_none")] + pub peer_asn: Option, + #[doc = "The primary address prefix."] + #[serde(rename = "primaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub primary_peer_address_prefix: Option, + #[doc = "The secondary address prefix."] + #[serde(rename = "secondaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub secondary_peer_address_prefix: Option, + #[doc = "The primary port."] + #[serde(rename = "primaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub primary_azure_port: Option, + #[doc = "The secondary port."] + #[serde(rename = "secondaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub secondary_azure_port: Option, + #[doc = "The shared key."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "The VLAN ID."] + #[serde(rename = "vlanId", default, skip_serializing_if = "Option::is_none")] + pub vlan_id: Option, + #[doc = "Specifies the peering configuration."] + #[serde(rename = "microsoftPeeringConfig", default, skip_serializing_if = "Option::is_none")] + pub microsoft_peering_config: Option, + #[doc = "Contains stats associated with the peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stats: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The GatewayManager Etag."] + #[serde(rename = "gatewayManagerEtag", default, skip_serializing_if = "Option::is_none")] + pub gateway_manager_etag: Option, + #[doc = "Who was the last to modify the peering."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "routeFilter", default, skip_serializing_if = "Option::is_none")] + pub route_filter: Option, + #[doc = "Contains IPv6 peering config."] + #[serde(rename = "ipv6PeeringConfig", default, skip_serializing_if = "Option::is_none")] + pub ipv6_peering_config: Option, + #[doc = "The ID of the ExpressRouteConnection."] + #[serde(rename = "expressRouteConnection", default, skip_serializing_if = "Option::is_none")] + pub express_route_connection: Option, + #[doc = "The list of circuit connections associated with Azure Private Peering for this circuit."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub connections: Vec, + #[doc = "The list of peered circuit connections associated with Azure Private Peering for this circuit."] + #[serde(rename = "peeredConnections", default, skip_serializing_if = "Vec::is_empty")] + pub peered_connections: Vec, +} +impl ExpressRouteCircuitPeeringPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitPropertiesFormat { + #[doc = "Allow classic operations."] + #[serde(rename = "allowClassicOperations", default, skip_serializing_if = "Option::is_none")] + pub allow_classic_operations: Option, + #[doc = "The CircuitProvisioningState state of the resource."] + #[serde(rename = "circuitProvisioningState", default, skip_serializing_if = "Option::is_none")] + pub circuit_provisioning_state: Option, + #[doc = "The ServiceProviderProvisioningState state of the resource."] + #[serde(rename = "serviceProviderProvisioningState", default, skip_serializing_if = "Option::is_none")] + pub service_provider_provisioning_state: Option, + #[doc = "The list of authorizations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub authorizations: Vec, + #[doc = "The list of peerings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub peerings: Vec, + #[doc = "The ServiceKey."] + #[serde(rename = "serviceKey", default, skip_serializing_if = "Option::is_none")] + pub service_key: Option, + #[doc = "The ServiceProviderNotes."] + #[serde(rename = "serviceProviderNotes", default, skip_serializing_if = "Option::is_none")] + pub service_provider_notes: Option, + #[doc = "Contains ServiceProviderProperties in an ExpressRouteCircuit."] + #[serde(rename = "serviceProviderProperties", default, skip_serializing_if = "Option::is_none")] + pub service_provider_properties: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "expressRoutePort", default, skip_serializing_if = "Option::is_none")] + pub express_route_port: Option, + #[doc = "The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource."] + #[serde(rename = "bandwidthInGbps", default, skip_serializing_if = "Option::is_none")] + pub bandwidth_in_gbps: Option, + #[doc = "The identifier of the circuit traffic. Outer tag for QinQ encapsulation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stag: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The GatewayManager Etag."] + #[serde(rename = "gatewayManagerEtag", default, skip_serializing_if = "Option::is_none")] + pub gateway_manager_etag: Option, + #[doc = "Flag denoting global reach status."] + #[serde(rename = "globalReachEnabled", default, skip_serializing_if = "Option::is_none")] + pub global_reach_enabled: Option, + #[doc = "The authorizationKey."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, +} +impl ExpressRouteCircuitPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to an express route circuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitReference { + #[doc = "Corresponding Express Route Circuit Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ExpressRouteCircuitReference { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The routes table associated with the ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitRoutesTable { + #[doc = "IP address of a network entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, + #[doc = "NextHop address."] + #[serde(rename = "nextHop", default, skip_serializing_if = "Option::is_none")] + pub next_hop: Option, + #[doc = "Local preference value as set with the set local-preference route-map configuration command."] + #[serde(rename = "locPrf", default, skip_serializing_if = "Option::is_none")] + pub loc_prf: Option, + #[doc = "Route Weight."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[doc = "Autonomous system paths to the destination network."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl ExpressRouteCircuitRoutesTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The routes table associated with the ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitRoutesTableSummary { + #[doc = "IP address of the neighbor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub neighbor: Option, + #[doc = "BGP version number spoken to the neighbor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub v: Option, + #[doc = "Autonomous system number."] + #[serde(rename = "as", default, skip_serializing_if = "Option::is_none")] + pub as_: Option, + #[doc = "The length of time that the BGP session has been in the Established state, or the current status if not in the Established state."] + #[serde(rename = "upDown", default, skip_serializing_if = "Option::is_none")] + pub up_down: Option, + #[doc = "Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group."] + #[serde(rename = "statePfxRcd", default, skip_serializing_if = "Option::is_none")] + pub state_pfx_rcd: Option, +} +impl ExpressRouteCircuitRoutesTableSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains ServiceProviderProperties in an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitServiceProviderProperties { + #[doc = "The serviceProviderName."] + #[serde(rename = "serviceProviderName", default, skip_serializing_if = "Option::is_none")] + pub service_provider_name: Option, + #[doc = "The peering location."] + #[serde(rename = "peeringLocation", default, skip_serializing_if = "Option::is_none")] + pub peering_location: Option, + #[doc = "The BandwidthInMbps."] + #[serde(rename = "bandwidthInMbps", default, skip_serializing_if = "Option::is_none")] + pub bandwidth_in_mbps: Option, +} +impl ExpressRouteCircuitServiceProviderProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains SKU in an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitSku { + #[doc = "The name of the SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The tier of the SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The family of the SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, +} +impl ExpressRouteCircuitSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_circuit_sku { + use super::*; + #[doc = "The tier of the SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + Premium, + Basic, + Local, + } + #[doc = "The family of the SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Family { + UnlimitedData, + MeteredData, + } +} +#[doc = "Contains stats associated with the peering."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitStats { + #[doc = "The Primary BytesIn of the peering."] + #[serde(rename = "primarybytesIn", default, skip_serializing_if = "Option::is_none")] + pub primarybytes_in: Option, + #[doc = "The primary BytesOut of the peering."] + #[serde(rename = "primarybytesOut", default, skip_serializing_if = "Option::is_none")] + pub primarybytes_out: Option, + #[doc = "The secondary BytesIn of the peering."] + #[serde(rename = "secondarybytesIn", default, skip_serializing_if = "Option::is_none")] + pub secondarybytes_in: Option, + #[doc = "The secondary BytesOut of the peering."] + #[serde(rename = "secondarybytesOut", default, skip_serializing_if = "Option::is_none")] + pub secondarybytes_out: Option, +} +impl ExpressRouteCircuitStats { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListArpTable associated with the Express Route Circuits API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitsArpTableListResult { + #[doc = "A list of the ARP tables."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitsArpTableListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListRoutesTable associated with the Express Route Circuits API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitsRoutesTableListResult { + #[doc = "The list of routes table."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitsRoutesTableListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListRoutesTable associated with the Express Route Circuits API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCircuitsRoutesTableSummaryListResult { + #[doc = "A list of the routes table."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCircuitsRoutesTableSummaryListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRouteConnection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExpressRouteConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the ExpressRouteConnection subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource."] + pub name: String, +} +impl ExpressRouteConnection { + pub fn new(name: String) -> Self { + Self { + sub_resource: SubResource::default(), + properties: None, + name, + } + } +} +#[doc = "The ID of the ExpressRouteConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteConnectionId { + #[doc = "The ID of the ExpressRouteConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ExpressRouteConnectionId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRouteConnection list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteConnectionList { + #[doc = "The list of ExpressRoute connections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ExpressRouteConnectionList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the ExpressRouteConnection subresource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExpressRouteConnectionProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "ExpressRoute circuit peering identifier."] + #[serde(rename = "expressRouteCircuitPeering")] + pub express_route_circuit_peering: ExpressRouteCircuitPeeringId, + #[doc = "Authorization key to establish the connection."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "The routing weight associated to the connection."] + #[serde(rename = "routingWeight", default, skip_serializing_if = "Option::is_none")] + pub routing_weight: Option, + #[doc = "Enable internet security."] + #[serde(rename = "enableInternetSecurity", default, skip_serializing_if = "Option::is_none")] + pub enable_internet_security: Option, + #[doc = "Enable FastPath to vWan Firewall hub."] + #[serde(rename = "expressRouteGatewayBypass", default, skip_serializing_if = "Option::is_none")] + pub express_route_gateway_bypass: Option, + #[doc = "Routing Configuration indicating the associated and propagated route tables for this connection."] + #[serde(rename = "routingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub routing_configuration: Option, +} +impl ExpressRouteConnectionProperties { + pub fn new(express_route_circuit_peering: ExpressRouteCircuitPeeringId) -> Self { + Self { + provisioning_state: None, + express_route_circuit_peering, + authorization_key: None, + routing_weight: None, + enable_internet_security: None, + express_route_gateway_bypass: None, + routing_configuration: None, + } + } +} +#[doc = "ExpressRouteCrossConnection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnection { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of ExpressRouteCrossConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExpressRouteCrossConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListExpressRouteCrossConnection API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionListResult { + #[doc = "A list of ExpressRouteCrossConnection resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCrossConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Peering in an ExpressRoute Cross Connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionPeering { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of express route cross connection peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExpressRouteCrossConnectionPeering { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListPeering API service call retrieves all peerings that belong to an ExpressRouteCrossConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionPeeringList { + #[doc = "The peerings in an express route cross connection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCrossConnectionPeeringList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of express route cross connection peering."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionPeeringProperties { + #[doc = "The peering type."] + #[serde(rename = "peeringType", default, skip_serializing_if = "Option::is_none")] + pub peering_type: Option, + #[doc = "The state of peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The Azure ASN."] + #[serde(rename = "azureASN", default, skip_serializing_if = "Option::is_none")] + pub azure_asn: Option, + #[doc = "The peer ASN."] + #[serde(rename = "peerASN", default, skip_serializing_if = "Option::is_none")] + pub peer_asn: Option, + #[doc = "The primary address prefix."] + #[serde(rename = "primaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub primary_peer_address_prefix: Option, + #[doc = "The secondary address prefix."] + #[serde(rename = "secondaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub secondary_peer_address_prefix: Option, + #[doc = "The primary port."] + #[serde(rename = "primaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub primary_azure_port: Option, + #[doc = "The secondary port."] + #[serde(rename = "secondaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub secondary_azure_port: Option, + #[doc = "The shared key."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "The VLAN ID."] + #[serde(rename = "vlanId", default, skip_serializing_if = "Option::is_none")] + pub vlan_id: Option, + #[doc = "Specifies the peering configuration."] + #[serde(rename = "microsoftPeeringConfig", default, skip_serializing_if = "Option::is_none")] + pub microsoft_peering_config: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The GatewayManager Etag."] + #[serde(rename = "gatewayManagerEtag", default, skip_serializing_if = "Option::is_none")] + pub gateway_manager_etag: Option, + #[doc = "Who was the last to modify the peering."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "Contains IPv6 peering config."] + #[serde(rename = "ipv6PeeringConfig", default, skip_serializing_if = "Option::is_none")] + pub ipv6_peering_config: Option, +} +impl ExpressRouteCrossConnectionPeeringProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ExpressRouteCrossConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionProperties { + #[doc = "The name of the primary port."] + #[serde(rename = "primaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub primary_azure_port: Option, + #[doc = "The name of the secondary port."] + #[serde(rename = "secondaryAzurePort", default, skip_serializing_if = "Option::is_none")] + pub secondary_azure_port: Option, + #[doc = "The identifier of the circuit traffic."] + #[serde(rename = "sTag", default, skip_serializing_if = "Option::is_none")] + pub s_tag: Option, + #[doc = "The peering location of the ExpressRoute circuit."] + #[serde(rename = "peeringLocation", default, skip_serializing_if = "Option::is_none")] + pub peering_location: Option, + #[doc = "The circuit bandwidth In Mbps."] + #[serde(rename = "bandwidthInMbps", default, skip_serializing_if = "Option::is_none")] + pub bandwidth_in_mbps: Option, + #[doc = "Reference to an express route circuit."] + #[serde(rename = "expressRouteCircuit", default, skip_serializing_if = "Option::is_none")] + pub express_route_circuit: Option, + #[doc = "The ServiceProviderProvisioningState state of the resource."] + #[serde(rename = "serviceProviderProvisioningState", default, skip_serializing_if = "Option::is_none")] + pub service_provider_provisioning_state: Option, + #[doc = "Additional read only notes set by the connectivity provider."] + #[serde(rename = "serviceProviderNotes", default, skip_serializing_if = "Option::is_none")] + pub service_provider_notes: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The list of peerings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub peerings: Vec, +} +impl ExpressRouteCrossConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The routes table associated with the ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionRoutesTableSummary { + #[doc = "IP address of Neighbor router."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub neighbor: Option, + #[doc = "Autonomous system number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub asn: Option, + #[doc = "The length of time that the BGP session has been in the Established state, or the current status if not in the Established state."] + #[serde(rename = "upDown", default, skip_serializing_if = "Option::is_none")] + pub up_down: Option, + #[doc = "Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group."] + #[serde(rename = "stateOrPrefixesReceived", default, skip_serializing_if = "Option::is_none")] + pub state_or_prefixes_received: Option, +} +impl ExpressRouteCrossConnectionRoutesTableSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListRoutesTable associated with the Express Route Cross Connections."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteCrossConnectionsRoutesTableSummaryListResult { + #[doc = "A list of the routes table."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteCrossConnectionsRoutesTableSummaryListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRoute gateway resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExpressRoute gateway resource properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExpressRouteGateway { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ExpressRoute gateways."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteGatewayList { + #[doc = "List of ExpressRoute gateways."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ExpressRouteGatewayList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRoute gateway resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExpressRouteGatewayProperties { + #[doc = "Configuration for auto scaling."] + #[serde(rename = "autoScaleConfiguration", default, skip_serializing_if = "Option::is_none")] + pub auto_scale_configuration: Option, + #[doc = "List of ExpressRoute connections to the ExpressRoute gateway."] + #[serde(rename = "expressRouteConnections", default, skip_serializing_if = "Vec::is_empty")] + pub express_route_connections: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Virtual Hub identifier."] + #[serde(rename = "virtualHub")] + pub virtual_hub: VirtualHubId, +} +impl ExpressRouteGatewayProperties { + pub fn new(virtual_hub: VirtualHubId) -> Self { + Self { + auto_scale_configuration: None, + express_route_connections: Vec::new(), + provisioning_state: None, + virtual_hub, + } + } +} +pub mod express_route_gateway_properties { + use super::*; + #[doc = "Configuration for auto scaling."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct AutoScaleConfiguration { + #[doc = "Minimum and maximum number of scale units to deploy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bounds: Option, + } + impl AutoScaleConfiguration { + pub fn new() -> Self { + Self::default() + } + } + pub mod auto_scale_configuration { + use super::*; + #[doc = "Minimum and maximum number of scale units to deploy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Bounds { + #[doc = "Minimum number of scale units deployed for ExpressRoute gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub min: Option, + #[doc = "Maximum number of scale units deployed for ExpressRoute gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max: Option, + } + impl Bounds { + pub fn new() -> Self { + Self::default() + } + } + } +} +#[doc = "ExpressRouteLink child resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteLink { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties specific to ExpressRouteLink resources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of child port resource that is unique among child port resources of the parent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ExpressRouteLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListExpressRouteLinks API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteLinkListResult { + #[doc = "The list of ExpressRouteLink sub-resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteLinkListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRouteLink Mac Security Configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteLinkMacSecConfig { + #[doc = "Keyvault Secret Identifier URL containing Mac security CKN key."] + #[serde(rename = "cknSecretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub ckn_secret_identifier: Option, + #[doc = "Keyvault Secret Identifier URL containing Mac security CAK key."] + #[serde(rename = "cakSecretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub cak_secret_identifier: Option, + #[doc = "Mac security cipher."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cipher: Option, + #[doc = "Sci mode enabled/disabled."] + #[serde(rename = "sciState", default, skip_serializing_if = "Option::is_none")] + pub sci_state: Option, +} +impl ExpressRouteLinkMacSecConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_link_mac_sec_config { + use super::*; + #[doc = "Mac security cipher."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Cipher { + GcmAes256, + GcmAes128, + GcmAesXpn128, + GcmAesXpn256, + } + #[doc = "Sci mode enabled/disabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SciState { + Disabled, + Enabled, + } +} +#[doc = "Properties specific to ExpressRouteLink resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteLinkPropertiesFormat { + #[doc = "Name of Azure router associated with physical port."] + #[serde(rename = "routerName", default, skip_serializing_if = "Option::is_none")] + pub router_name: Option, + #[doc = "Name of Azure router interface."] + #[serde(rename = "interfaceName", default, skip_serializing_if = "Option::is_none")] + pub interface_name: Option, + #[doc = "Mapping between physical port to patch panel port."] + #[serde(rename = "patchPanelId", default, skip_serializing_if = "Option::is_none")] + pub patch_panel_id: Option, + #[doc = "Mapping of physical patch panel to rack."] + #[serde(rename = "rackId", default, skip_serializing_if = "Option::is_none")] + pub rack_id: Option, + #[doc = "Physical fiber port type."] + #[serde(rename = "connectorType", default, skip_serializing_if = "Option::is_none")] + pub connector_type: Option, + #[doc = "Administrative state of the physical port."] + #[serde(rename = "adminState", default, skip_serializing_if = "Option::is_none")] + pub admin_state: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "ExpressRouteLink Mac Security Configuration."] + #[serde(rename = "macSecConfig", default, skip_serializing_if = "Option::is_none")] + pub mac_sec_config: Option, +} +impl ExpressRouteLinkPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_link_properties_format { + use super::*; + #[doc = "Physical fiber port type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConnectorType { + #[serde(rename = "LC")] + Lc, + #[serde(rename = "SC")] + Sc, + } + #[doc = "Administrative state of the physical port."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AdminState { + Enabled, + Disabled, + } +} +#[doc = "The state of peering."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExpressRoutePeeringState { + Disabled, + Enabled, +} +#[doc = "The peering type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExpressRoutePeeringType { + AzurePublicPeering, + AzurePrivatePeering, + MicrosoftPeering, +} +#[doc = "ExpressRoutePort resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePort { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties specific to ExpressRoutePort resources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl ExpressRoutePort { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExpressRoutePort Authorization resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortAuthorization { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of ExpressRoutePort Authorization."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExpressRoutePortAuthorization { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListExpressRoutePortAuthorizations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortAuthorizationListResult { + #[doc = "The authorizations in an ExpressRoute Port."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRoutePortAuthorizationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ExpressRoutePort Authorization."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortAuthorizationPropertiesFormat { + #[doc = "The authorization key."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "The authorization use status."] + #[serde(rename = "authorizationUseStatus", default, skip_serializing_if = "Option::is_none")] + pub authorization_use_status: Option, + #[doc = "The reference to the ExpressRoute circuit resource using the authorization."] + #[serde(rename = "circuitResourceUri", default, skip_serializing_if = "Option::is_none")] + pub circuit_resource_uri: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ExpressRoutePortAuthorizationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_port_authorization_properties_format { + use super::*; + #[doc = "The authorization use status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthorizationUseStatus { + Available, + InUse, + } +} +#[doc = "Response for ListExpressRoutePorts API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortListResult { + #[doc = "A list of ExpressRoutePort resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRoutePortListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties specific to ExpressRoutePort resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortPropertiesFormat { + #[doc = "The name of the peering location that the ExpressRoutePort is mapped to physically."] + #[serde(rename = "peeringLocation", default, skip_serializing_if = "Option::is_none")] + pub peering_location: Option, + #[doc = "Bandwidth of procured ports in Gbps."] + #[serde(rename = "bandwidthInGbps", default, skip_serializing_if = "Option::is_none")] + pub bandwidth_in_gbps: Option, + #[doc = "Aggregate Gbps of associated circuit bandwidths."] + #[serde(rename = "provisionedBandwidthInGbps", default, skip_serializing_if = "Option::is_none")] + pub provisioned_bandwidth_in_gbps: Option, + #[doc = "Maximum transmission unit of the physical port pair(s)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mtu: Option, + #[doc = "Encapsulation method on physical ports."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encapsulation: Option, + #[doc = "Ether type of the physical port."] + #[serde(rename = "etherType", default, skip_serializing_if = "Option::is_none")] + pub ether_type: Option, + #[doc = "Date of the physical port allocation to be used in Letter of Authorization."] + #[serde(rename = "allocationDate", default, skip_serializing_if = "Option::is_none")] + pub allocation_date: Option, + #[doc = "The set of physical links of the ExpressRoutePort resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub links: Vec, + #[doc = "Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub circuits: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The resource GUID property of the express route port resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, +} +impl ExpressRoutePortPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod express_route_port_properties_format { + use super::*; + #[doc = "Encapsulation method on physical ports."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Encapsulation { + Dot1Q, + QinQ, + } +} +#[doc = "Definition of the ExpressRoutePorts peering location resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortsLocation { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties specific to ExpressRoutePorts peering location resources."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ExpressRoutePortsLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Real-time inventory of available ExpressRoute port bandwidths."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortsLocationBandwidths { + #[doc = "Bandwidth descriptive name."] + #[serde(rename = "offerName", default, skip_serializing_if = "Option::is_none")] + pub offer_name: Option, + #[doc = "Bandwidth value in Gbps."] + #[serde(rename = "valueInGbps", default, skip_serializing_if = "Option::is_none")] + pub value_in_gbps: Option, +} +impl ExpressRoutePortsLocationBandwidths { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListExpressRoutePortsLocations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortsLocationListResult { + #[doc = "The list of all ExpressRoutePort peering locations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRoutePortsLocationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties specific to ExpressRoutePorts peering location resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRoutePortsLocationPropertiesFormat { + #[doc = "Address of peering location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address: Option, + #[doc = "Contact details of peering locations."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contact: Option, + #[doc = "The inventory of available ExpressRoutePort bandwidths."] + #[serde(rename = "availableBandwidths", default, skip_serializing_if = "Vec::is_empty")] + pub available_bandwidths: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ExpressRoutePortsLocationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A ExpressRouteResourceProvider object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteServiceProvider { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of ExpressRouteServiceProvider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ExpressRouteServiceProvider { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains bandwidths offered in ExpressRouteServiceProvider resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteServiceProviderBandwidthsOffered { + #[doc = "The OfferName."] + #[serde(rename = "offerName", default, skip_serializing_if = "Option::is_none")] + pub offer_name: Option, + #[doc = "The ValueInMbps."] + #[serde(rename = "valueInMbps", default, skip_serializing_if = "Option::is_none")] + pub value_in_mbps: Option, +} +impl ExpressRouteServiceProviderBandwidthsOffered { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListExpressRouteServiceProvider API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteServiceProviderListResult { + #[doc = "A list of ExpressRouteResourceProvider resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExpressRouteServiceProviderListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ExpressRouteServiceProvider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpressRouteServiceProviderPropertiesFormat { + #[doc = "A list of peering locations."] + #[serde(rename = "peeringLocations", default, skip_serializing_if = "Vec::is_empty")] + pub peering_locations: Vec, + #[doc = "A list of bandwidths offered."] + #[serde(rename = "bandwidthsOffered", default, skip_serializing_if = "Vec::is_empty")] + pub bandwidths_offered: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ExpressRouteServiceProviderPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ExtendedLocation complex type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedLocation { + #[doc = "The name of the extended location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network resources."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ExtendedLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExtendedLocationType { + EdgeZone, +} +#[doc = "Will contain the filter name and values to operate on"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FilterItems { + #[doc = "The name of the field we would like to filter"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub field: Option, + #[doc = "List of values to filter the current field by"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, +} +impl FilterItems { + pub fn new() -> Self { + Self::default() + } +} +pub type Filters = Vec; +#[doc = "FirewallPolicy Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Firewall Policy definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl FirewallPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trusted Root certificates properties for tls."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyCertificateAuthority { + #[doc = "Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault."] + #[serde(rename = "keyVaultSecretId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_secret_id: Option, + #[doc = "Name of the CA certificate."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl FirewallPolicyCertificateAuthority { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Firewall Policy Filter Rule Collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FirewallPolicyFilterRuleCollection { + #[serde(flatten)] + pub firewall_policy_rule_collection: FirewallPolicyRuleCollection, + #[doc = "Properties of the FirewallPolicyFilterRuleCollectionAction."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "List of rules included in a rule collection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +impl FirewallPolicyFilterRuleCollection { + pub fn new(firewall_policy_rule_collection: FirewallPolicyRuleCollection) -> Self { + Self { + firewall_policy_rule_collection, + action: None, + rules: Vec::new(), + } + } +} +#[doc = "Properties of the FirewallPolicyFilterRuleCollectionAction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyFilterRuleCollectionAction { + #[doc = "The action type of a rule."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl FirewallPolicyFilterRuleCollectionAction { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The action type of a rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyFilterRuleCollectionActionType { + Allow, + Deny, +} +#[doc = "Firewall Policy Insights."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyInsights { + #[doc = "A flag to indicate if the insights are enabled on the policy."] + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, + #[doc = "Number of days the insights should be enabled on the policy."] + #[serde(rename = "retentionDays", default, skip_serializing_if = "Option::is_none")] + pub retention_days: Option, + #[doc = "Log Analytics Resources for Firewall Policy Insights."] + #[serde(rename = "logAnalyticsResources", default, skip_serializing_if = "Option::is_none")] + pub log_analytics_resources: Option, +} +impl FirewallPolicyInsights { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configuration for intrusion detection mode and rules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyIntrusionDetection { + #[doc = "Possible state values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "The operation for configuring intrusion detection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub configuration: Option, +} +impl FirewallPolicyIntrusionDetection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Possible intrusion detection bypass traffic protocols."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyIntrusionDetectionBypassTrafficProtocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + #[serde(rename = "ICMP")] + Icmp, + #[serde(rename = "ANY")] + Any, +} +#[doc = "Intrusion detection bypass traffic specification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyIntrusionDetectionBypassTrafficSpecifications { + #[doc = "Name of the bypass traffic rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the bypass traffic rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Possible intrusion detection bypass traffic protocols."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "List of source IP addresses or ranges for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses or ranges for this rule."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "List of destination ports or ranges."] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, + #[doc = "List of destination IpGroups for this rule."] + #[serde(rename = "destinationIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ip_groups: Vec, +} +impl FirewallPolicyIntrusionDetectionBypassTrafficSpecifications { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The operation for configuring intrusion detection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyIntrusionDetectionConfiguration { + #[doc = "List of specific signatures states."] + #[serde(rename = "signatureOverrides", default, skip_serializing_if = "Vec::is_empty")] + pub signature_overrides: Vec, + #[doc = "List of rules for traffic to bypass."] + #[serde(rename = "bypassTrafficSettings", default, skip_serializing_if = "Vec::is_empty")] + pub bypass_traffic_settings: Vec, + #[doc = "IDPS Private IP address ranges are used to identify traffic direction (i.e. inbound, outbound, etc.). By default, only ranges defined by IANA RFC 1918 are considered private IP addresses. To modify default ranges, specify your Private IP address ranges with this property"] + #[serde(rename = "privateRanges", default, skip_serializing_if = "Vec::is_empty")] + pub private_ranges: Vec, +} +impl FirewallPolicyIntrusionDetectionConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Intrusion detection signatures specification states."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyIntrusionDetectionSignatureSpecification { + #[doc = "Signature id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Possible state values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, +} +impl FirewallPolicyIntrusionDetectionSignatureSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Possible state values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyIntrusionDetectionStateOptions { + Off, + Alert, + Deny, +} +#[doc = "Response for ListFirewallPolicies API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyListResult { + #[doc = "List of Firewall Policies in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl FirewallPolicyListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Log Analytics Resources for Firewall Policy Insights."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyLogAnalyticsResources { + #[doc = "List of workspaces for Firewall Policy Insights."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub workspaces: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "defaultWorkspaceId", default, skip_serializing_if = "Option::is_none")] + pub default_workspace_id: Option, +} +impl FirewallPolicyLogAnalyticsResources { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Log Analytics Workspace for Firewall Policy Insights."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyLogAnalyticsWorkspace { + #[doc = "Region to configure the Workspace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "workspaceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_id: Option, +} +impl FirewallPolicyLogAnalyticsWorkspace { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Firewall Policy NAT Rule Collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FirewallPolicyNatRuleCollection { + #[serde(flatten)] + pub firewall_policy_rule_collection: FirewallPolicyRuleCollection, + #[doc = "Properties of the FirewallPolicyNatRuleCollectionAction."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, + #[doc = "List of rules included in a rule collection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +impl FirewallPolicyNatRuleCollection { + pub fn new(firewall_policy_rule_collection: FirewallPolicyRuleCollection) -> Self { + Self { + firewall_policy_rule_collection, + action: None, + rules: Vec::new(), + } + } +} +#[doc = "Properties of the FirewallPolicyNatRuleCollectionAction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyNatRuleCollectionAction { + #[doc = "The action type of a rule."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl FirewallPolicyNatRuleCollectionAction { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The action type of a rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyNatRuleCollectionActionType { + #[serde(rename = "DNAT")] + Dnat, +} +#[doc = "Firewall Policy definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyPropertiesFormat { + #[doc = "List of references to FirewallPolicyRuleCollectionGroups."] + #[serde(rename = "ruleCollectionGroups", default, skip_serializing_if = "Vec::is_empty")] + pub rule_collection_groups: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "basePolicy", default, skip_serializing_if = "Option::is_none")] + pub base_policy: Option, + #[doc = "List of references to Azure Firewalls that this Firewall Policy is associated with."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub firewalls: Vec, + #[doc = "List of references to Child Firewall Policies."] + #[serde(rename = "childPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub child_policies: Vec, + #[doc = "The operation mode for Threat Intel."] + #[serde(rename = "threatIntelMode", default, skip_serializing_if = "Option::is_none")] + pub threat_intel_mode: Option, + #[doc = "ThreatIntel Whitelist for Firewall Policy."] + #[serde(rename = "threatIntelWhitelist", default, skip_serializing_if = "Option::is_none")] + pub threat_intel_whitelist: Option, + #[doc = "Firewall Policy Insights."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub insights: Option, + #[doc = "The private IP addresses/IP ranges to which traffic will not be SNAT."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snat: Option, + #[doc = "SQL Settings in Firewall Policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sql: Option, + #[doc = "DNS Proxy Settings in Firewall Policy."] + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[doc = "Explicit Proxy Settings in Firewall Policy."] + #[serde(rename = "explicitProxySettings", default, skip_serializing_if = "Option::is_none")] + pub explicit_proxy_settings: Option, + #[doc = "Configuration for intrusion detection mode and rules."] + #[serde(rename = "intrusionDetection", default, skip_serializing_if = "Option::is_none")] + pub intrusion_detection: Option, + #[doc = "Configuration needed to perform TLS termination & initiation."] + #[serde(rename = "transportSecurity", default, skip_serializing_if = "Option::is_none")] + pub transport_security: Option, + #[doc = "SKU of Firewall policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, +} +impl FirewallPolicyPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FirewallPolicyRule { + #[doc = "Name of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Rule Type."] + #[serde(rename = "ruleType")] + pub rule_type: firewall_policy_rule::RuleType, +} +impl FirewallPolicyRule { + pub fn new(rule_type: firewall_policy_rule::RuleType) -> Self { + Self { + name: None, + description: None, + rule_type, + } + } +} +pub mod firewall_policy_rule { + use super::*; + #[doc = "Rule Type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleType { + ApplicationRule, + NetworkRule, + NatRule, + } +} +#[doc = "Properties of the application rule protocol."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyRuleApplicationProtocol { + #[doc = "The application protocol type of a Rule."] + #[serde(rename = "protocolType", default, skip_serializing_if = "Option::is_none")] + pub protocol_type: Option, + #[doc = "Port number for the protocol, cannot be greater than 64000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl FirewallPolicyRuleApplicationProtocol { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The application protocol type of a Rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyRuleApplicationProtocolType { + Http, + Https, +} +#[doc = "Properties of the rule collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FirewallPolicyRuleCollection { + #[doc = "The type of the rule collection."] + #[serde(rename = "ruleCollectionType")] + pub rule_collection_type: firewall_policy_rule_collection::RuleCollectionType, + #[doc = "The name of the rule collection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Priority of the Firewall Policy Rule Collection resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, +} +impl FirewallPolicyRuleCollection { + pub fn new(rule_collection_type: firewall_policy_rule_collection::RuleCollectionType) -> Self { + Self { + rule_collection_type, + name: None, + priority: None, + } + } +} +pub mod firewall_policy_rule_collection { + use super::*; + #[doc = "The type of the rule collection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleCollectionType { + FirewallPolicyNatRuleCollection, + FirewallPolicyFilterRuleCollection, + } +} +#[doc = "Rule Collection Group resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyRuleCollectionGroup { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the rule collection group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Rule Group type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl FirewallPolicyRuleCollectionGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListFirewallPolicyRuleCollectionGroups API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyRuleCollectionGroupListResult { + #[doc = "List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl FirewallPolicyRuleCollectionGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the rule collection group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyRuleCollectionGroupProperties { + #[doc = "Priority of the Firewall Policy Rule Collection Group resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Group of Firewall Policy rule collections."] + #[serde(rename = "ruleCollections", default, skip_serializing_if = "Vec::is_empty")] + pub rule_collections: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl FirewallPolicyRuleCollectionGroupProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Network protocol of a Rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FirewallPolicyRuleNetworkProtocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + Any, + #[serde(rename = "ICMP")] + Icmp, +} +#[doc = "The private IP addresses/IP ranges to which traffic will not be SNAT."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicySnat { + #[doc = "List of private IP addresses/IP address ranges to not be SNAT."] + #[serde(rename = "privateRanges", default, skip_serializing_if = "Vec::is_empty")] + pub private_ranges: Vec, +} +impl FirewallPolicySnat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SQL Settings in Firewall Policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicySql { + #[doc = "A flag to indicate if SQL Redirect traffic filtering is enabled. Turning on the flag requires no rule using port 11000-11999."] + #[serde(rename = "allowSqlRedirect", default, skip_serializing_if = "Option::is_none")] + pub allow_sql_redirect: Option, +} +impl FirewallPolicySql { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SKU of Firewall policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicySku { + #[doc = "Tier of Firewall Policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl FirewallPolicySku { + pub fn new() -> Self { + Self::default() + } +} +pub mod firewall_policy_sku { + use super::*; + #[doc = "Tier of Firewall Policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + Premium, + Basic, + } +} +#[doc = "ThreatIntel Whitelist for Firewall Policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyThreatIntelWhitelist { + #[doc = "List of IP addresses for the ThreatIntel Whitelist."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "List of FQDNs for the ThreatIntel Whitelist."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub fqdns: Vec, +} +impl FirewallPolicyThreatIntelWhitelist { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configuration needed to perform TLS termination & initiation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FirewallPolicyTransportSecurity { + #[doc = "Trusted Root certificates properties for tls."] + #[serde(rename = "certificateAuthority", default, skip_serializing_if = "Option::is_none")] + pub certificate_authority: Option, +} +impl FirewallPolicyTransportSecurity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A flow log resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FlowLog { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters that define the configuration of flow log."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl FlowLog { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the flow log format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FlowLogFormatParameters { + #[doc = "The file type of flow log."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The version (revision) of the flow log."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl FlowLogFormatParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod flow_log_format_parameters { + use super::*; + #[doc = "The file type of flow log."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "JSON")] + Json, + } +} +#[doc = "Information on the configuration of flow log and traffic analytics (optional) ."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FlowLogInformation { + #[doc = "The ID of the resource to configure for flow log and traffic analytics (optional) ."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "Parameters that define the configuration of flow log."] + pub properties: FlowLogProperties, + #[doc = "Parameters that define the configuration of traffic analytics."] + #[serde(rename = "flowAnalyticsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub flow_analytics_configuration: Option, +} +impl FlowLogInformation { + pub fn new(target_resource_id: String, properties: FlowLogProperties) -> Self { + Self { + target_resource_id, + properties, + flow_analytics_configuration: None, + } + } +} +#[doc = "List of flow logs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FlowLogListResult { + #[doc = "Information about flow log resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl FlowLogListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the configuration of flow log."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FlowLogProperties { + #[doc = "ID of the storage account which is used to store the flow log."] + #[serde(rename = "storageId")] + pub storage_id: String, + #[doc = "Flag to enable/disable flow logging."] + pub enabled: bool, + #[doc = "Parameters that define the retention policy for flow log."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[doc = "Parameters that define the flow log format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, +} +impl FlowLogProperties { + pub fn new(storage_id: String, enabled: bool) -> Self { + Self { + storage_id, + enabled, + retention_policy: None, + format: None, + } + } +} +#[doc = "Parameters that define the configuration of flow log."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FlowLogPropertiesFormat { + #[doc = "ID of network security group to which flow log will be applied."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "Guid of network security group to which flow log will be applied."] + #[serde(rename = "targetResourceGuid", default, skip_serializing_if = "Option::is_none")] + pub target_resource_guid: Option, + #[doc = "ID of the storage account which is used to store the flow log."] + #[serde(rename = "storageId")] + pub storage_id: String, + #[doc = "Flag to enable/disable flow logging."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Parameters that define the retention policy for flow log."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[doc = "Parameters that define the flow log format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "Parameters that define the configuration of traffic analytics."] + #[serde(rename = "flowAnalyticsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub flow_analytics_configuration: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl FlowLogPropertiesFormat { + pub fn new(target_resource_id: String, storage_id: String) -> Self { + Self { + target_resource_id, + target_resource_guid: None, + storage_id, + enabled: None, + retention_policy: None, + format: None, + flow_analytics_configuration: None, + provisioning_state: None, + } + } +} +#[doc = "Parameters that define a resource to query flow log and traffic analytics (optional) status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FlowLogStatusParameters { + #[doc = "The target resource where getting the flow log and traffic analytics (optional) status."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, +} +impl FlowLogStatusParameters { + pub fn new(target_resource_id: String) -> Self { + Self { target_resource_id } + } +} +#[doc = "Frontend IP address of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FrontendIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Frontend IP Configuration of the load balancer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A list of availability zones denoting the IP allocated for the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl FrontendIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Frontend IP Configuration of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FrontendIpConfigurationPropertiesFormat { + #[doc = "An array of references to inbound rules that use this frontend IP."] + #[serde(rename = "inboundNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_rules: Vec, + #[doc = "An array of references to inbound pools that use this frontend IP."] + #[serde(rename = "inboundNatPools", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_pools: Vec, + #[doc = "An array of references to outbound rules that use this frontend IP."] + #[serde(rename = "outboundRules", default, skip_serializing_if = "Vec::is_empty")] + pub outbound_rules: Vec, + #[doc = "An array of references to load balancing rules that use this frontend IP."] + #[serde(rename = "loadBalancingRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancing_rules: Vec, + #[doc = "The private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "IP address version."] + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPPrefix", default, skip_serializing_if = "Option::is_none")] + pub public_ip_prefix: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "gatewayLoadBalancer", default, skip_serializing_if = "Option::is_none")] + pub gateway_load_balancer: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl FrontendIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "GatewayCustomBgpIpAddressIpConfiguration for a virtual network gateway connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GatewayCustomBgpIpAddressIpConfiguration { + #[doc = "The IpconfigurationId of ipconfiguration which belongs to gateway."] + #[serde(rename = "ipConfigurationId")] + pub ip_configuration_id: String, + #[doc = "The custom BgpPeeringAddress which belongs to IpconfigurationId."] + #[serde(rename = "customBgpIpAddress")] + pub custom_bgp_ip_address: String, +} +impl GatewayCustomBgpIpAddressIpConfiguration { + pub fn new(ip_configuration_id: String, custom_bgp_ip_address: String) -> Self { + Self { + ip_configuration_id, + custom_bgp_ip_address, + } + } +} +#[doc = "Gateway load balancer tunnel interface of a load balancer backend address pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayLoadBalancerTunnelInterface { + #[doc = "Port of gateway load balancer tunnel interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Identifier of gateway load balancer tunnel interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identifier: Option, + #[doc = "Protocol of gateway load balancer tunnel interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Traffic type of gateway load balancer tunnel interface."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl GatewayLoadBalancerTunnelInterface { + pub fn new() -> Self { + Self::default() + } +} +pub mod gateway_load_balancer_tunnel_interface { + use super::*; + #[doc = "Protocol of gateway load balancer tunnel interface."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + None, + Native, + #[serde(rename = "VXLAN")] + Vxlan, + } + #[doc = "Traffic type of gateway load balancer tunnel interface."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + None, + Internal, + External, + } +} +#[doc = "Gateway routing details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayRoute { + #[doc = "The gateway's local address."] + #[serde(rename = "localAddress", default, skip_serializing_if = "Option::is_none")] + pub local_address: Option, + #[doc = "The route's network prefix."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, + #[doc = "The route's next hop."] + #[serde(rename = "nextHop", default, skip_serializing_if = "Option::is_none")] + pub next_hop: Option, + #[doc = "The peer this route was learned from."] + #[serde(rename = "sourcePeer", default, skip_serializing_if = "Option::is_none")] + pub source_peer: Option, + #[doc = "The source this route was learned from."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The route's AS path sequence."] + #[serde(rename = "asPath", default, skip_serializing_if = "Option::is_none")] + pub as_path: Option, + #[doc = "The route's weight."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, +} +impl GatewayRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of virtual network gateway routes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GatewayRouteListResult { + #[doc = "List of gateway routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl GatewayRouteListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The customer name to be printed on a letter of authorization."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenerateExpressRoutePortsLoaRequest { + #[doc = "The customer name."] + #[serde(rename = "customerName")] + pub customer_name: String, +} +impl GenerateExpressRoutePortsLoaRequest { + pub fn new(customer_name: String) -> Self { + Self { customer_name } + } +} +#[doc = "Response for GenerateExpressRoutePortsLOA API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GenerateExpressRoutePortsLoaResult { + #[doc = "The content as a base64 encoded string."] + #[serde(rename = "encodedContent", default, skip_serializing_if = "Option::is_none")] + pub encoded_content: Option, +} +impl GenerateExpressRoutePortsLoaResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Vpn-Sites."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetVpnSitesConfigurationRequest { + #[doc = "List of resource-ids of the vpn-sites for which config is to be downloaded."] + #[serde(rename = "vpnSites", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_sites: Vec, + #[doc = "The sas-url to download the configurations for vpn-sites."] + #[serde(rename = "outputBlobSasUrl")] + pub output_blob_sas_url: String, +} +impl GetVpnSitesConfigurationRequest { + pub fn new(output_blob_sas_url: String) -> Self { + Self { + vpn_sites: Vec::new(), + output_blob_sas_url, + } + } +} +#[doc = "HTTP configuration of the connectivity check."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HttpConfiguration { + #[doc = "HTTP method."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub method: Option, + #[doc = "List of HTTP headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub headers: Vec, + #[doc = "Valid status codes."] + #[serde(rename = "validStatusCodes", default, skip_serializing_if = "Vec::is_empty")] + pub valid_status_codes: Vec, +} +impl HttpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +pub mod http_configuration { + use super::*; + #[doc = "HTTP method."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Method { + Get, + } +} +#[doc = "The HTTP header."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HttpHeader { + #[doc = "The name in HTTP header."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The value in HTTP header."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl HttpHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Hop link."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HopLink { + #[doc = "The ID of the next hop."] + #[serde(rename = "nextHopId", default, skip_serializing_if = "Option::is_none")] + pub next_hop_id: Option, + #[doc = "Link type."] + #[serde(rename = "linkType", default, skip_serializing_if = "Option::is_none")] + pub link_type: Option, + #[doc = "Hop link properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "List of issues."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub issues: Vec, + #[doc = "Provides additional context on links."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + #[doc = "Resource ID."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl HopLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Hop link properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HopLinkProperties { + #[doc = "Minimum roundtrip time in milliseconds."] + #[serde(rename = "roundTripTimeMin", default, skip_serializing_if = "Option::is_none")] + pub round_trip_time_min: Option, + #[doc = "Average roundtrip time in milliseconds."] + #[serde(rename = "roundTripTimeAvg", default, skip_serializing_if = "Option::is_none")] + pub round_trip_time_avg: Option, + #[doc = "Maximum roundtrip time in milliseconds."] + #[serde(rename = "roundTripTimeMax", default, skip_serializing_if = "Option::is_none")] + pub round_trip_time_max: Option, +} +impl HopLinkProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP addresses associated with azure firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubIpAddresses { + #[doc = "Public IP addresses associated with azure firewall."] + #[serde(rename = "publicIPs", default, skip_serializing_if = "Option::is_none")] + pub public_i_ps: Option, + #[doc = "Private IP Address associated with azure firewall."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, +} +impl HubIpAddresses { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubIpConfigurationPropertiesFormat { + #[doc = "The private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl HubIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IpConfigurations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the Ip Configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Ipconfiguration type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl HubIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Public IP addresses associated with azure firewall."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubPublicIpAddresses { + #[doc = "The list of Public IP addresses associated with azure firewall or IP addresses to be retained."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub addresses: Vec, + #[doc = "The number of Public IP addresses associated with azure firewall."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl HubPublicIpAddresses { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "RouteTable route."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HubRoute { + #[doc = "The name of the Route that is unique within a RouteTable. This name can be used to access this route."] + pub name: String, + #[doc = "The type of destinations (eg: CIDR, ResourceId, Service)."] + #[serde(rename = "destinationType")] + pub destination_type: String, + #[doc = "List of all destinations."] + pub destinations: Vec, + #[doc = "The type of next hop (eg: ResourceId)."] + #[serde(rename = "nextHopType")] + pub next_hop_type: String, + #[doc = "NextHop resource ID."] + #[serde(rename = "nextHop")] + pub next_hop: String, +} +impl HubRoute { + pub fn new(name: String, destination_type: String, destinations: Vec, next_hop_type: String, next_hop: String) -> Self { + Self { + name, + destination_type, + destinations, + next_hop_type, + next_hop, + } + } +} +#[doc = "RouteTable resource in a virtual hub."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubRouteTable { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for RouteTable."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl HubRouteTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for RouteTable."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubRouteTableProperties { + #[doc = "List of all routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub routes: Vec, + #[doc = "List of labels associated with this route table."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec, + #[doc = "List of all connections associated with this route table."] + #[serde(rename = "associatedConnections", default, skip_serializing_if = "Vec::is_empty")] + pub associated_connections: Vec, + #[doc = "List of all connections that advertise to this route table."] + #[serde(rename = "propagatingConnections", default, skip_serializing_if = "Vec::is_empty")] + pub propagating_connections: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl HubRouteTableProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The hub routing preference gateway types"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum HubRoutingPreference { + ExpressRoute, + VpnGateway, + #[serde(rename = "ASPath")] + AsPath, +} +#[doc = "HubVirtualNetworkConnection Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubVirtualNetworkConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for HubVirtualNetworkConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl HubVirtualNetworkConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for HubVirtualNetworkConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HubVirtualNetworkConnectionProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "remoteVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub remote_virtual_network: Option, + #[doc = "Deprecated: VirtualHub to RemoteVnet transit to enabled or not."] + #[serde(rename = "allowHubToRemoteVnetTransit", default, skip_serializing_if = "Option::is_none")] + pub allow_hub_to_remote_vnet_transit: Option, + #[doc = "Deprecated: Allow RemoteVnet to use Virtual Hub's gateways."] + #[serde(rename = "allowRemoteVnetToUseHubVnetGateways", default, skip_serializing_if = "Option::is_none")] + pub allow_remote_vnet_to_use_hub_vnet_gateways: Option, + #[doc = "Enable internet security."] + #[serde(rename = "enableInternetSecurity", default, skip_serializing_if = "Option::is_none")] + pub enable_internet_security: Option, + #[doc = "Routing Configuration indicating the associated and propagated route tables for this connection."] + #[serde(rename = "routingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub routing_configuration: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl HubVirtualNetworkConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current state of the VirtualHub to vnet connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum HubVirtualNetworkConnectionStatus { + Unknown, + Connecting, + Connected, + NotConnected, +} +#[doc = "Will describe the query to run against the IDPS signatures DB"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdpsQueryObject { + #[doc = "Describers the filters to filter response by"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filters: Option, + #[doc = "Search term in all columns"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub search: Option, + #[doc = "Describes a column to sort"] + #[serde(rename = "orderBy", default, skip_serializing_if = "Option::is_none")] + pub order_by: Option, + #[doc = "The number of the results to return in each page"] + #[serde(rename = "resultsPerPage", default, skip_serializing_if = "Option::is_none")] + pub results_per_page: Option, + #[doc = "The number of records matching the filter to skip"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip: Option, +} +impl IdpsQueryObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for CheckIPAddressAvailability API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpAddressAvailabilityResult { + #[doc = "Private IP address availability."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub available: Option, + #[doc = "Contains other available private IP addresses if the asked for address is taken."] + #[serde(rename = "availableIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub available_ip_addresses: Vec, + #[doc = "Private IP address platform reserved."] + #[serde(rename = "isPlatformReserved", default, skip_serializing_if = "Option::is_none")] + pub is_platform_reserved: Option, +} +impl IpAddressAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP address allocation method."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IpAllocationMethod { + Static, + Dynamic, +} +#[doc = "IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Box>, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl IpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IPConfigurationBgpPeeringAddress."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigurationBgpPeeringAddress { + #[doc = "The ID of IP configuration which belongs to gateway."] + #[serde(rename = "ipconfigurationId", default, skip_serializing_if = "Option::is_none")] + pub ipconfiguration_id: Option, + #[doc = "The list of default BGP peering addresses which belong to IP configuration."] + #[serde(rename = "defaultBgpIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub default_bgp_ip_addresses: Vec, + #[doc = "The list of custom BGP peering addresses which belong to IP configuration."] + #[serde(rename = "customBgpIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub custom_bgp_ip_addresses: Vec, + #[doc = "The list of tunnel public IP addresses which belong to IP configuration."] + #[serde(rename = "tunnelIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub tunnel_ip_addresses: Vec, +} +impl IpConfigurationBgpPeeringAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP configuration profile child resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigurationProfile { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "IP configuration profile properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Sub Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl IpConfigurationProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP configuration profile properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigurationProfilePropertiesFormat { + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl IpConfigurationProfilePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigurationPropertiesFormat { + #[doc = "The private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Box>, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl IpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IP address version."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IpVersion { + IPv4, + IPv6, +} +#[doc = "The IKE encryption algorithm (IKE phase 2)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IkeEncryption { + #[serde(rename = "DES")] + Des, + #[serde(rename = "DES3")] + Des3, + #[serde(rename = "AES128")] + Aes128, + #[serde(rename = "AES192")] + Aes192, + #[serde(rename = "AES256")] + Aes256, + #[serde(rename = "GCMAES256")] + Gcmaes256, + #[serde(rename = "GCMAES128")] + Gcmaes128, +} +#[doc = "The IKE integrity algorithm (IKE phase 2)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IkeIntegrity { + #[serde(rename = "MD5")] + Md5, + #[serde(rename = "SHA1")] + Sha1, + #[serde(rename = "SHA256")] + Sha256, + #[serde(rename = "SHA384")] + Sha384, + #[serde(rename = "GCMAES256")] + Gcmaes256, + #[serde(rename = "GCMAES128")] + Gcmaes128, +} +#[doc = "Inbound NAT pool of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundNatPool { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Inbound NAT pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl InboundNatPool { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Inbound NAT pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InboundNatPoolPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub frontend_ip_configuration: Option, + #[doc = "The transport protocol for the endpoint."] + pub protocol: TransportProtocol, + #[doc = "The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534."] + #[serde(rename = "frontendPortRangeStart")] + pub frontend_port_range_start: i32, + #[doc = "The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65535."] + #[serde(rename = "frontendPortRangeEnd")] + pub frontend_port_range_end: i32, + #[doc = "The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535."] + #[serde(rename = "backendPort")] + pub backend_port: i32, + #[doc = "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint."] + #[serde(rename = "enableFloatingIP", default, skip_serializing_if = "Option::is_none")] + pub enable_floating_ip: Option, + #[doc = "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP."] + #[serde(rename = "enableTcpReset", default, skip_serializing_if = "Option::is_none")] + pub enable_tcp_reset: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl InboundNatPoolPropertiesFormat { + pub fn new(protocol: TransportProtocol, frontend_port_range_start: i32, frontend_port_range_end: i32, backend_port: i32) -> Self { + Self { + frontend_ip_configuration: None, + protocol, + frontend_port_range_start, + frontend_port_range_end, + backend_port, + idle_timeout_in_minutes: None, + enable_floating_ip: None, + enable_tcp_reset: None, + provisioning_state: None, + } + } +} +#[doc = "Inbound NAT rule of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundNatRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the inbound NAT rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl InboundNatRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListInboundNatRule API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundNatRuleListResult { + #[doc = "A list of inbound NAT rules in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl InboundNatRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Individual port mappings for inbound NAT rule created for backend pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundNatRulePortMapping { + #[doc = "Name of inbound NAT rule."] + #[serde(rename = "inboundNatRuleName", default, skip_serializing_if = "Option::is_none")] + pub inbound_nat_rule_name: Option, + #[doc = "The transport protocol for the endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Frontend port."] + #[serde(rename = "frontendPort", default, skip_serializing_if = "Option::is_none")] + pub frontend_port: Option, + #[doc = "Backend port."] + #[serde(rename = "backendPort", default, skip_serializing_if = "Option::is_none")] + pub backend_port: Option, +} +impl InboundNatRulePortMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the inbound NAT rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundNatRulePropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub frontend_ip_configuration: Option, + #[doc = "IPConfiguration in a network interface."] + #[serde(rename = "backendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub backend_ip_configuration: Option, + #[doc = "The transport protocol for the endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values range from 1 to 65534."] + #[serde(rename = "frontendPort", default, skip_serializing_if = "Option::is_none")] + pub frontend_port: Option, + #[doc = "The port used for the internal endpoint. Acceptable values range from 1 to 65535."] + #[serde(rename = "backendPort", default, skip_serializing_if = "Option::is_none")] + pub backend_port: Option, + #[doc = "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint."] + #[serde(rename = "enableFloatingIP", default, skip_serializing_if = "Option::is_none")] + pub enable_floating_ip: Option, + #[doc = "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP."] + #[serde(rename = "enableTcpReset", default, skip_serializing_if = "Option::is_none")] + pub enable_tcp_reset: Option, + #[doc = "The port range start for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeEnd. Individual inbound NAT rule port mappings will be created for each backend address from BackendAddressPool. Acceptable values range from 1 to 65534."] + #[serde(rename = "frontendPortRangeStart", default, skip_serializing_if = "Option::is_none")] + pub frontend_port_range_start: Option, + #[doc = "The port range end for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT rule port mappings will be created for each backend address from BackendAddressPool. Acceptable values range from 1 to 65534."] + #[serde(rename = "frontendPortRangeEnd", default, skip_serializing_if = "Option::is_none")] + pub frontend_port_range_end: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl InboundNatRulePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NVA Inbound Security Rule resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundSecurityRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the Inbound Security Rules resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of security rule collection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "NVA inbound security rule type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl InboundSecurityRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Inbound Security Rules resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundSecurityRuleProperties { + #[doc = "List of allowed rules."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl InboundSecurityRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Inbound Security Rules resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InboundSecurityRules { + #[doc = "Protocol. This should be either TCP or UDP."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed."] + #[serde(rename = "sourceAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub source_address_prefix: Option, + #[doc = "NVA port ranges to be opened up. One needs to provide specific ports."] + #[serde(rename = "destinationPortRange", default, skip_serializing_if = "Option::is_none")] + pub destination_port_range: Option, +} +impl InboundSecurityRules { + pub fn new() -> Self { + Self::default() + } +} +pub mod inbound_security_rules { + use super::*; + #[doc = "Protocol. This should be either TCP or UDP."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + } +} +#[doc = "IpAllocation resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpAllocation { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the IpAllocation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl IpAllocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListIpAllocations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpAllocationListResult { + #[doc = "A list of IpAllocation resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IpAllocationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the IpAllocation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpAllocationPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub virtual_network: Option, + #[doc = "IpAllocation type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The address prefix for the IpAllocation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "The address prefix length for the IpAllocation."] + #[serde(rename = "prefixLength", default, skip_serializing_if = "Option::is_none")] + pub prefix_length: Option, + #[doc = "IP address version."] + #[serde(rename = "prefixType", default, skip_serializing_if = "Option::is_none")] + pub prefix_type: Option, + #[doc = "The IPAM allocation ID."] + #[serde(rename = "ipamAllocationId", default, skip_serializing_if = "Option::is_none")] + pub ipam_allocation_id: Option, + #[doc = "IpAllocation tags."] + #[serde(rename = "allocationTags", default, skip_serializing_if = "Option::is_none")] + pub allocation_tags: Option, +} +impl IpAllocationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IpAllocation type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IpAllocationType { + Undefined, + Hypernet, +} +#[doc = "The IpGroups resource information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpGroup { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The IpGroups property information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl IpGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListIpGroups API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpGroupListResult { + #[doc = "The list of IpGroups information resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IpGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The IpGroups property information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpGroupPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "IpAddresses/IpAddressPrefixes in the IpGroups resource."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "List of references to Firewall resources that this IpGroups is associated with."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub firewalls: Vec, + #[doc = "List of references to Firewall Policies resources that this IpGroups is associated with."] + #[serde(rename = "firewallPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub firewall_policies: Vec, +} +impl IpGroupPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub type IpGroups = Vec; +#[doc = "Contains the IpTag associated with the object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpTag { + #[doc = "The IP tag type. Example: FirstPartyUsage."] + #[serde(rename = "ipTagType", default, skip_serializing_if = "Option::is_none")] + pub ip_tag_type: Option, + #[doc = "The value of the IP tag associated with the public IP. Example: SQL."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, +} +impl IpTag { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The IPSec encryption algorithm (IKE phase 1)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IpsecEncryption { + None, + #[serde(rename = "DES")] + Des, + #[serde(rename = "DES3")] + Des3, + #[serde(rename = "AES128")] + Aes128, + #[serde(rename = "AES192")] + Aes192, + #[serde(rename = "AES256")] + Aes256, + #[serde(rename = "GCMAES128")] + Gcmaes128, + #[serde(rename = "GCMAES192")] + Gcmaes192, + #[serde(rename = "GCMAES256")] + Gcmaes256, +} +#[doc = "The IPSec integrity algorithm (IKE phase 1)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IpsecIntegrity { + #[serde(rename = "MD5")] + Md5, + #[serde(rename = "SHA1")] + Sha1, + #[serde(rename = "SHA256")] + Sha256, + #[serde(rename = "GCMAES128")] + Gcmaes128, + #[serde(rename = "GCMAES192")] + Gcmaes192, + #[serde(rename = "GCMAES256")] + Gcmaes256, +} +#[doc = "An IPSec Policy configuration for a virtual network gateway connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpsecPolicy { + #[doc = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel."] + #[serde(rename = "saLifeTimeSeconds")] + pub sa_life_time_seconds: i32, + #[doc = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel."] + #[serde(rename = "saDataSizeKilobytes")] + pub sa_data_size_kilobytes: i32, + #[doc = "The IPSec encryption algorithm (IKE phase 1)."] + #[serde(rename = "ipsecEncryption")] + pub ipsec_encryption: IpsecEncryption, + #[doc = "The IPSec integrity algorithm (IKE phase 1)."] + #[serde(rename = "ipsecIntegrity")] + pub ipsec_integrity: IpsecIntegrity, + #[doc = "The IKE encryption algorithm (IKE phase 2)."] + #[serde(rename = "ikeEncryption")] + pub ike_encryption: IkeEncryption, + #[doc = "The IKE integrity algorithm (IKE phase 2)."] + #[serde(rename = "ikeIntegrity")] + pub ike_integrity: IkeIntegrity, + #[doc = "The DH Groups used in IKE Phase 1 for initial SA."] + #[serde(rename = "dhGroup")] + pub dh_group: DhGroup, + #[doc = "The Pfs Groups used in IKE Phase 2 for new child SA."] + #[serde(rename = "pfsGroup")] + pub pfs_group: PfsGroup, +} +impl IpsecPolicy { + pub fn new( + sa_life_time_seconds: i32, + sa_data_size_kilobytes: i32, + ipsec_encryption: IpsecEncryption, + ipsec_integrity: IpsecIntegrity, + ike_encryption: IkeEncryption, + ike_integrity: IkeIntegrity, + dh_group: DhGroup, + pfs_group: PfsGroup, + ) -> Self { + Self { + sa_life_time_seconds, + sa_data_size_kilobytes, + ipsec_encryption, + ipsec_integrity, + ike_encryption, + ike_integrity, + dh_group, + pfs_group, + } + } +} +#[doc = "IPv6 Circuit Connection properties for global reach."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Ipv6CircuitConnectionConfig { + #[doc = "/125 IP address space to carve out customer addresses for global reach."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "Express Route Circuit connection state."] + #[serde(rename = "circuitConnectionStatus", default, skip_serializing_if = "Option::is_none")] + pub circuit_connection_status: Option, +} +impl Ipv6CircuitConnectionConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains IPv6 peering config."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Ipv6ExpressRouteCircuitPeeringConfig { + #[doc = "The primary address prefix."] + #[serde(rename = "primaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub primary_peer_address_prefix: Option, + #[doc = "The secondary address prefix."] + #[serde(rename = "secondaryPeerAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub secondary_peer_address_prefix: Option, + #[doc = "Specifies the peering configuration."] + #[serde(rename = "microsoftPeeringConfig", default, skip_serializing_if = "Option::is_none")] + pub microsoft_peering_config: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "routeFilter", default, skip_serializing_if = "Option::is_none")] + pub route_filter: Option, + #[doc = "The state of peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl Ipv6ExpressRouteCircuitPeeringConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod ipv6_express_route_circuit_peering_config { + use super::*; + #[doc = "The state of peering."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Disabled, + Enabled, + } +} +#[doc = "A key-value pair that provides additional context on the issue."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IssueContext {} +impl IssueContext { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of RouteTables and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListHubRouteTablesResult { + #[doc = "List of RouteTables."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListHubRouteTablesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of HubVirtualNetworkConnections and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListHubVirtualNetworkConnectionsResult { + #[doc = "List of HubVirtualNetworkConnections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListHubVirtualNetworkConnectionsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListP2sVpnGatewaysResult { + #[doc = "List of P2SVpnGateways."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListP2sVpnGatewaysResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of the routing intent result and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListRoutingIntentResult { + #[doc = "List of RoutingIntent resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListRoutingIntentResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHubBgpConnections list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualHubBgpConnectionResults { + #[doc = "The list of VirtualHubBgpConnections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualHubBgpConnectionResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHubIpConfigurations list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualHubIpConfigurationResults { + #[doc = "The list of VirtualHubIpConfigurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualHubIpConfigurationResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of VirtualHubRouteTableV2s and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualHubRouteTableV2sResult { + #[doc = "List of VirtualHubRouteTableV2s."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualHubRouteTableV2sResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualHubsResult { + #[doc = "List of VirtualHubs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualHubsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list all nat rules to a virtual network gateway. It contains a list of Nat rules and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualNetworkGatewayNatRulesResult { + #[doc = "List of Nat Rules."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualNetworkGatewayNatRulesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVirtualWaNsResult { + #[doc = "List of VirtualWANs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVirtualWaNsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a list of Vpn Connections and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnConnectionsResult { + #[doc = "List of Vpn Connections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnConnectionsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list all nat rules to a virtual wan vpn gateway. It contains a list of Nat rules and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnGatewayNatRulesResult { + #[doc = "List of Nat Rules."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnGatewayNatRulesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnGatewaysResult { + #[doc = "List of VpnGateways."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnGatewaysResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VpnServerConfigurationPolicyGroups. It contains a list of VpnServerConfigurationPolicyGroups and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnServerConfigurationPolicyGroupsResult { + #[doc = "List of VpnServerConfigurationPolicyGroups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnServerConfigurationPolicyGroupsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list all VpnServerConfigurations. It contains a list of VpnServerConfigurations and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnServerConfigurationsResult { + #[doc = "List of VpnServerConfigurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnServerConfigurationsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a list of Vpn Connections and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnSiteLinkConnectionsResult { + #[doc = "List of VpnSiteLinkConnections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnSiteLinkConnectionsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnSiteLinksResult { + #[doc = "List of VpnSitesLinks."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnSiteLinksResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListVpnSitesResult { + #[doc = "List of VpnSites."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ListVpnSitesResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "LoadBalancer resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancer { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "SKU of a load balancer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Properties of the load balancer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl LoadBalancer { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Load balancer backend addresses."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerBackendAddress { + #[doc = "Properties of the load balancer backend addresses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the backend address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl LoadBalancerBackendAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListBackendAddressPool API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerBackendAddressPoolListResult { + #[doc = "A list of backend address pools in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerBackendAddressPoolListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the load balancer backend addresses."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerBackendAddressPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub virtual_network: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "IP Address belonging to the referenced virtual network."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "networkInterfaceIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub network_interface_ip_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "loadBalancerFrontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_frontend_ip_configuration: Option, + #[doc = "Collection of inbound NAT rule port mappings."] + #[serde(rename = "inboundNatRulesPortMapping", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_rules_port_mapping: Vec, + #[doc = "A list of administrative states which once set can override health probe so that Load Balancer will always forward new connections to backend, or deny new connections and reset existing connections."] + #[serde(rename = "adminState", default, skip_serializing_if = "Option::is_none")] + pub admin_state: Option, +} +impl LoadBalancerBackendAddressPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod load_balancer_backend_address_properties_format { + use super::*; + #[doc = "A list of administrative states which once set can override health probe so that Load Balancer will always forward new connections to backend, or deny new connections and reset existing connections."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AdminState { + None, + Up, + Down, + Drain, + } +} +#[doc = "Response for ListFrontendIPConfiguration API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerFrontendIpConfigurationListResult { + #[doc = "A list of frontend IP configurations in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerFrontendIpConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListLoadBalancers API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerListResult { + #[doc = "A list of load balancers in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListLoadBalancingRule API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerLoadBalancingRuleListResult { + #[doc = "A list of load balancing rules in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerLoadBalancingRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListOutboundRule API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerOutboundRuleListResult { + #[doc = "A list of outbound rules in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerOutboundRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListProbe API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerProbeListResult { + #[doc = "A list of probes in a load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LoadBalancerProbeListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerPropertiesFormat { + #[doc = "Object representing the frontend IPs to be used for the load balancer."] + #[serde(rename = "frontendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub frontend_ip_configurations: Vec, + #[doc = "Collection of backend address pools used by a load balancer."] + #[serde(rename = "backendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub backend_address_pools: Vec, + #[doc = "Object collection representing the load balancing rules Gets the provisioning."] + #[serde(rename = "loadBalancingRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancing_rules: Vec, + #[doc = "Collection of probe objects used in the load balancer."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub probes: Vec, + #[doc = "Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to reference individual inbound NAT rules."] + #[serde(rename = "inboundNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_rules: Vec, + #[doc = "Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules."] + #[serde(rename = "inboundNatPools", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_nat_pools: Vec, + #[doc = "The outbound rules."] + #[serde(rename = "outboundRules", default, skip_serializing_if = "Vec::is_empty")] + pub outbound_rules: Vec, + #[doc = "The resource GUID property of the load balancer resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl LoadBalancerPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SKU of a load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerSku { + #[doc = "Name of a load balancer SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Tier of a load balancer SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl LoadBalancerSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod load_balancer_sku { + use super::*; + #[doc = "Name of a load balancer SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + Standard, + Gateway, + } + #[doc = "Tier of a load balancer SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Regional, + Global, + } +} +#[doc = "The request for a VIP swap."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerVipSwapRequest { + #[doc = "A list of frontend IP configuration resources that should swap VIPs."] + #[serde(rename = "frontendIPConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub frontend_ip_configurations: Vec, +} +impl LoadBalancerVipSwapRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VIP swap request's frontend IP configuration object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerVipSwapRequestFrontendIpConfiguration { + #[doc = "The ID of frontend IP configuration resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The properties of VIP swap request's frontend IP configuration object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LoadBalancerVipSwapRequestFrontendIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of VIP swap request's frontend IP configuration object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancerVipSwapRequestFrontendIpConfigurationProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, +} +impl LoadBalancerVipSwapRequestFrontendIpConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A load balancing rule for a load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LoadBalancingRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the load balancer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl LoadBalancingRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoadBalancingRulePropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "frontendIPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub frontend_ip_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool", default, skip_serializing_if = "Option::is_none")] + pub backend_address_pool: Option, + #[doc = "An array of references to pool of DIPs."] + #[serde(rename = "backendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub backend_address_pools: Vec, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub probe: Option, + #[doc = "The transport protocol for the endpoint."] + pub protocol: TransportProtocol, + #[doc = "The load distribution policy for this rule."] + #[serde(rename = "loadDistribution", default, skip_serializing_if = "Option::is_none")] + pub load_distribution: Option, + #[doc = "The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 enables \"Any Port\"."] + #[serde(rename = "frontendPort")] + pub frontend_port: i32, + #[doc = "The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables \"Any Port\"."] + #[serde(rename = "backendPort", default, skip_serializing_if = "Option::is_none")] + pub backend_port: Option, + #[doc = "The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint."] + #[serde(rename = "enableFloatingIP", default, skip_serializing_if = "Option::is_none")] + pub enable_floating_ip: Option, + #[doc = "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP."] + #[serde(rename = "enableTcpReset", default, skip_serializing_if = "Option::is_none")] + pub enable_tcp_reset: Option, + #[doc = "Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule."] + #[serde(rename = "disableOutboundSnat", default, skip_serializing_if = "Option::is_none")] + pub disable_outbound_snat: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl LoadBalancingRulePropertiesFormat { + pub fn new(protocol: TransportProtocol, frontend_port: i32) -> Self { + Self { + frontend_ip_configuration: None, + backend_address_pool: None, + backend_address_pools: Vec::new(), + probe: None, + protocol, + load_distribution: None, + frontend_port, + backend_port: None, + idle_timeout_in_minutes: None, + enable_floating_ip: None, + enable_tcp_reset: None, + disable_outbound_snat: None, + provisioning_state: None, + } + } +} +pub mod load_balancing_rule_properties_format { + use super::*; + #[doc = "The load distribution policy for this rule."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LoadDistribution { + Default, + #[serde(rename = "SourceIP")] + SourceIp, + #[serde(rename = "SourceIPProtocol")] + SourceIpProtocol, + } +} +#[doc = "A common class for general resource information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LocalNetworkGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "LocalNetworkGateway properties."] + pub properties: LocalNetworkGatewayPropertiesFormat, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl LocalNetworkGateway { + pub fn new(properties: LocalNetworkGatewayPropertiesFormat) -> Self { + Self { + resource: Resource::default(), + properties, + etag: None, + } + } +} +#[doc = "Response for ListLocalNetworkGateways API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocalNetworkGatewayListResult { + #[doc = "A list of local network gateways that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LocalNetworkGatewayListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "LocalNetworkGateway properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LocalNetworkGatewayPropertiesFormat { + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "localNetworkAddressSpace", default, skip_serializing_if = "Option::is_none")] + pub local_network_address_space: Option, + #[doc = "IP address of local network gateway."] + #[serde(rename = "gatewayIpAddress", default, skip_serializing_if = "Option::is_none")] + pub gateway_ip_address: Option, + #[doc = "FQDN of local network gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "BGP settings details."] + #[serde(rename = "bgpSettings", default, skip_serializing_if = "Option::is_none")] + pub bgp_settings: Option, + #[doc = "The resource GUID property of the local network gateway resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl LocalNetworkGatewayPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of logging specification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LogSpecification { + #[doc = "The name of the specification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The display name of the specification."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Duration of the blob."] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl LogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines a managed rule group override setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleGroupOverride { + #[doc = "The managed rule group to override."] + #[serde(rename = "ruleGroupName")] + pub rule_group_name: String, + #[doc = "List of rules that will be disabled. If none specified, all rules in the group will be disabled."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, +} +impl ManagedRuleGroupOverride { + pub fn new(rule_group_name: String) -> Self { + Self { + rule_group_name, + rules: Vec::new(), + } + } +} +#[doc = "Defines a managed rule group override setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleOverride { + #[doc = "Identifier for the managed rule."] + #[serde(rename = "ruleId")] + pub rule_id: String, + #[doc = "The state of the managed rule. Defaults to Disabled if not specified."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl ManagedRuleOverride { + pub fn new(rule_id: String) -> Self { + Self { rule_id, state: None } + } +} +pub mod managed_rule_override { + use super::*; + #[doc = "The state of the managed rule. Defaults to Disabled if not specified."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Disabled, + } +} +#[doc = "Defines a managed rule set."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRuleSet { + #[doc = "Defines the rule set type to use."] + #[serde(rename = "ruleSetType")] + pub rule_set_type: String, + #[doc = "Defines the version of the rule set to use."] + #[serde(rename = "ruleSetVersion")] + pub rule_set_version: String, + #[doc = "Defines the rule group overrides to apply to the rule set."] + #[serde(rename = "ruleGroupOverrides", default, skip_serializing_if = "Vec::is_empty")] + pub rule_group_overrides: Vec, +} +impl ManagedRuleSet { + pub fn new(rule_set_type: String, rule_set_version: String) -> Self { + Self { + rule_set_type, + rule_set_version, + rule_group_overrides: Vec::new(), + } + } +} +#[doc = "Allow to exclude some variable satisfy the condition for the WAF check."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedRulesDefinition { + #[doc = "The Exclusions that are applied on the policy."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub exclusions: Vec, + #[doc = "The managed rule sets that are associated with the policy."] + #[serde(rename = "managedRuleSets")] + pub managed_rule_sets: Vec, +} +impl ManagedRulesDefinition { + pub fn new(managed_rule_sets: Vec) -> Self { + Self { + exclusions: Vec::new(), + managed_rule_sets, + } + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedServiceIdentity { + #[doc = "The principal id of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant id of the system assigned identity. This property will only be provided for a system assigned identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl ManagedServiceIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_service_identity { + use super::*; + #[doc = "The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[doc = "Define match conditions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MatchCondition { + #[doc = "List of match variables."] + #[serde(rename = "matchVariables")] + pub match_variables: Vec, + #[doc = "The operator to be matched."] + pub operator: match_condition::Operator, + #[doc = "Whether this is negate condition or not."] + #[serde(rename = "negationConditon", default, skip_serializing_if = "Option::is_none")] + pub negation_conditon: Option, + #[doc = "Match value."] + #[serde(rename = "matchValues")] + pub match_values: Vec, + #[doc = "List of transforms."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transforms: Vec, +} +impl MatchCondition { + pub fn new(match_variables: Vec, operator: match_condition::Operator, match_values: Vec) -> Self { + Self { + match_variables, + operator, + negation_conditon: None, + match_values, + transforms: Vec::new(), + } + } +} +pub mod match_condition { + use super::*; + #[doc = "The operator to be matched."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + #[serde(rename = "IPMatch")] + IpMatch, + Equal, + Contains, + LessThan, + GreaterThan, + LessThanOrEqual, + GreaterThanOrEqual, + BeginsWith, + EndsWith, + Regex, + GeoMatch, + } +} +#[doc = "Define match variables."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MatchVariable { + #[doc = "Match Variable."] + #[serde(rename = "variableName")] + pub variable_name: match_variable::VariableName, + #[doc = "The selector of match variable."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub selector: Option, +} +impl MatchVariable { + pub fn new(variable_name: match_variable::VariableName) -> Self { + Self { + variable_name, + selector: None, + } + } +} +pub mod match_variable { + use super::*; + #[doc = "Match Variable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VariableName { + RemoteAddr, + RequestMethod, + QueryString, + PostArgs, + RequestUri, + RequestHeaders, + RequestBody, + RequestCookies, + } +} +#[doc = "Matched rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MatchedRule { + #[doc = "Name of the matched network security rule."] + #[serde(rename = "ruleName", default, skip_serializing_if = "Option::is_none")] + pub rule_name: Option, + #[doc = "The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, +} +impl MatchedRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of metrics specification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetricSpecification { + #[doc = "The name of the metric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The display name of the metric."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The description of the metric."] + #[serde(rename = "displayDescription", default, skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[doc = "Units the metric to be displayed in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "The aggregation type."] + #[serde(rename = "aggregationType", default, skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[doc = "List of availability."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub availabilities: Vec, + #[doc = "Whether regional MDM account enabled."] + #[serde(rename = "enableRegionalMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub enable_regional_mdm_account: Option, + #[doc = "Whether gaps would be filled with zeros."] + #[serde(rename = "fillGapWithZero", default, skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[doc = "Pattern for the filter of the metric."] + #[serde(rename = "metricFilterPattern", default, skip_serializing_if = "Option::is_none")] + pub metric_filter_pattern: Option, + #[doc = "List of dimensions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dimensions: Vec, + #[doc = "Whether the metric is internal."] + #[serde(rename = "isInternal", default, skip_serializing_if = "Option::is_none")] + pub is_internal: Option, + #[doc = "The source MDM account."] + #[serde(rename = "sourceMdmAccount", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_account: Option, + #[doc = "The source MDM namespace."] + #[serde(rename = "sourceMdmNamespace", default, skip_serializing_if = "Option::is_none")] + pub source_mdm_namespace: Option, + #[doc = "The resource Id dimension name override."] + #[serde(rename = "resourceIdDimensionNameOverride", default, skip_serializing_if = "Option::is_none")] + pub resource_id_dimension_name_override: Option, +} +impl MetricSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Nat Gateway resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NatGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "SKU of nat gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Nat Gateway properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A list of availability zones denoting the zone in which Nat Gateway should be deployed."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NatGateway { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNatGateways API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NatGatewayListResult { + #[doc = "A list of Nat Gateways that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NatGatewayListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Nat Gateway properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NatGatewayPropertiesFormat { + #[doc = "The idle timeout of the nat gateway."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "An array of public ip addresses associated with the nat gateway resource."] + #[serde(rename = "publicIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_addresses: Vec, + #[doc = "An array of public ip prefixes associated with the nat gateway resource."] + #[serde(rename = "publicIpPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_prefixes: Vec, + #[doc = "An array of references to the subnets using this nat gateway resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "The resource GUID property of the NAT gateway resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NatGatewayPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SKU of nat gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NatGatewaySku { + #[doc = "Name of Nat Gateway SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl NatGatewaySku { + pub fn new() -> Self { + Self::default() + } +} +pub mod nat_gateway_sku { + use super::*; + #[doc = "Name of Nat Gateway SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + } +} +#[doc = "Rule of type nat."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NatRule { + #[serde(flatten)] + pub firewall_policy_rule: FirewallPolicyRule, + #[doc = "Array of FirewallPolicyRuleNetworkProtocols."] + #[serde(rename = "ipProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub ip_protocols: Vec, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses or Service Tags."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "List of destination ports."] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "The translated address for this NAT rule."] + #[serde(rename = "translatedAddress", default, skip_serializing_if = "Option::is_none")] + pub translated_address: Option, + #[doc = "The translated port for this NAT rule."] + #[serde(rename = "translatedPort", default, skip_serializing_if = "Option::is_none")] + pub translated_port: Option, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, + #[doc = "The translated FQDN for this NAT rule."] + #[serde(rename = "translatedFqdn", default, skip_serializing_if = "Option::is_none")] + pub translated_fqdn: Option, +} +impl NatRule { + pub fn new(firewall_policy_rule: FirewallPolicyRule) -> Self { + Self { + firewall_policy_rule, + ip_protocols: Vec::new(), + source_addresses: Vec::new(), + destination_addresses: Vec::new(), + destination_ports: Vec::new(), + translated_address: None, + translated_port: None, + source_ip_groups: Vec::new(), + translated_fqdn: None, + } + } +} +#[doc = "Individual port mappings for inbound NAT rule created for backend pool."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NatRulePortMapping { + #[doc = "Name of inbound NAT rule."] + #[serde(rename = "inboundNatRuleName", default, skip_serializing_if = "Option::is_none")] + pub inbound_nat_rule_name: Option, + #[doc = "Frontend port."] + #[serde(rename = "frontendPort", default, skip_serializing_if = "Option::is_none")] + pub frontend_port: Option, + #[doc = "Backend port."] + #[serde(rename = "backendPort", default, skip_serializing_if = "Option::is_none")] + pub backend_port: Option, +} +impl NatRulePortMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to get network configuration diagnostic."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkConfigurationDiagnosticParameters { + #[doc = "The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "Verbosity level."] + #[serde(rename = "verbosityLevel", default, skip_serializing_if = "Option::is_none")] + pub verbosity_level: Option, + #[doc = "List of network configuration diagnostic profiles."] + pub profiles: Vec, +} +impl NetworkConfigurationDiagnosticParameters { + pub fn new(target_resource_id: String, profiles: Vec) -> Self { + Self { + target_resource_id, + verbosity_level: None, + profiles, + } + } +} +pub mod network_configuration_diagnostic_parameters { + use super::*; + #[doc = "Verbosity level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VerbosityLevel { + Normal, + Minimum, + Full, + } +} +#[doc = "Parameters to compare with network configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkConfigurationDiagnosticProfile { + #[doc = "The direction of the traffic."] + pub direction: Direction, + #[doc = "Protocol to be verified on. Accepted values are '*', TCP, UDP."] + pub protocol: String, + #[doc = "Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag."] + pub source: String, + #[doc = "Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag."] + pub destination: String, + #[doc = "Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535)."] + #[serde(rename = "destinationPort")] + pub destination_port: String, +} +impl NetworkConfigurationDiagnosticProfile { + pub fn new(direction: Direction, protocol: String, source: String, destination: String, destination_port: String) -> Self { + Self { + direction, + protocol, + source, + destination, + destination_port, + } + } +} +#[doc = "Results of network configuration diagnostic on the target resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkConfigurationDiagnosticResponse { + #[doc = "List of network configuration diagnostic results."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub results: Vec, +} +impl NetworkConfigurationDiagnosticResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network configuration diagnostic result corresponded to provided traffic query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkConfigurationDiagnosticResult { + #[doc = "Parameters to compare with network configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub profile: Option, + #[doc = "Network configuration diagnostic result corresponded provided traffic query."] + #[serde(rename = "networkSecurityGroupResult", default, skip_serializing_if = "Option::is_none")] + pub network_security_group_result: Option, +} +impl NetworkConfigurationDiagnosticResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Intent Policy resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkIntentPolicy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkIntentPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkIntentPolicyConfiguration { + #[doc = "The name of the Network Intent Policy for storing in target subscription."] + #[serde(rename = "networkIntentPolicyName", default, skip_serializing_if = "Option::is_none")] + pub network_intent_policy_name: Option, + #[doc = "Network Intent Policy resource."] + #[serde(rename = "sourceNetworkIntentPolicy", default, skip_serializing_if = "Option::is_none")] + pub source_network_intent_policy: Option, +} +impl NetworkIntentPolicyConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A network interface in a resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterface { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "NetworkInterface properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkInterface { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network interface and its custom security rules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceAssociation { + #[doc = "Network interface ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Collection of custom security rules."] + #[serde(rename = "securityRules", default, skip_serializing_if = "Vec::is_empty")] + pub security_rules: Vec, +} +impl NetworkInterfaceAssociation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DNS settings of a network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceDnsSettings { + #[doc = "List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the only value in dnsServers collection."] + #[serde(rename = "dnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub dns_servers: Vec, + #[doc = "If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs."] + #[serde(rename = "appliedDnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub applied_dns_servers: Vec, + #[doc = "Relative DNS name for this NIC used for internal communications between VMs in the same virtual network."] + #[serde(rename = "internalDnsNameLabel", default, skip_serializing_if = "Option::is_none")] + pub internal_dns_name_label: Option, + #[doc = "Fully qualified DNS name supporting internal communications between VMs in the same virtual network."] + #[serde(rename = "internalFqdn", default, skip_serializing_if = "Option::is_none")] + pub internal_fqdn: Option, + #[doc = "Even if internalDnsNameLabel is not specified, a DNS entry is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the VM name with the value of internalDomainNameSuffix."] + #[serde(rename = "internalDomainNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub internal_domain_name_suffix: Option, +} +impl NetworkInterfaceDnsSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IPConfiguration in a network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl NetworkInterfaceIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for list ip configurations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceIpConfigurationListResult { + #[doc = "A list of ip configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkInterfaceIpConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateLinkConnection properties for the network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceIpConfigurationPrivateLinkConnectionProperties { + #[doc = "The group ID for current private link connection."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The required member name for current private link connection."] + #[serde(rename = "requiredMemberName", default, skip_serializing_if = "Option::is_none")] + pub required_member_name: Option, + #[doc = "List of FQDNs for current private link connection."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub fqdns: Vec, +} +impl NetworkInterfaceIpConfigurationPrivateLinkConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceIpConfigurationPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "gatewayLoadBalancer", default, skip_serializing_if = "Option::is_none")] + pub gateway_load_balancer: Option, + #[doc = "The reference to Virtual Network Taps."] + #[serde(rename = "virtualNetworkTaps", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_taps: Vec, + #[doc = "The reference to ApplicationGatewayBackendAddressPool resource."] + #[serde(rename = "applicationGatewayBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateway_backend_address_pools: Vec, + #[doc = "The reference to LoadBalancerBackendAddressPool resource."] + #[serde(rename = "loadBalancerBackendAddressPools", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_backend_address_pools: Vec, + #[doc = "A list of references of LoadBalancerInboundNatRules."] + #[serde(rename = "loadBalancerInboundNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_inbound_nat_rules: Vec, + #[doc = "Private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "IP address version."] + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Whether this is a primary customer address on the network interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "Application security groups in which the IP configuration is included."] + #[serde(rename = "applicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub application_security_groups: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "PrivateLinkConnection properties for the network interface."] + #[serde(rename = "privateLinkConnectionProperties", default, skip_serializing_if = "Option::is_none")] + pub private_link_connection_properties: Option, +} +impl NetworkInterfaceIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListNetworkInterface API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceListResult { + #[doc = "A list of network interfaces in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkInterfaceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for list ip configurations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceLoadBalancerListResult { + #[doc = "A list of load balancers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkInterfaceLoadBalancerListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NetworkInterface properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfacePropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualMachine", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine: Option, + #[doc = "NetworkSecurityGroup resource."] + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[doc = "Private endpoint resource."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A list of IPConfigurations of the network interface."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "A list of TapConfigurations of the network interface."] + #[serde(rename = "tapConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub tap_configurations: Vec, + #[doc = "DNS settings of a network interface."] + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[doc = "The MAC address of the network interface."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[doc = "Whether this is a primary network interface on a virtual machine."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[doc = "Whether the virtual machine this nic is attached to supports encryption."] + #[serde(rename = "vnetEncryptionSupported", default, skip_serializing_if = "Option::is_none")] + pub vnet_encryption_supported: Option, + #[doc = "If the network interface is accelerated networking enabled."] + #[serde(rename = "enableAcceleratedNetworking", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking: Option, + #[doc = "Indicates whether IP forwarding is enabled on this network interface."] + #[serde(rename = "enableIPForwarding", default, skip_serializing_if = "Option::is_none")] + pub enable_ip_forwarding: Option, + #[doc = "A list of references to linked BareMetal resources."] + #[serde(rename = "hostedWorkloads", default, skip_serializing_if = "Vec::is_empty")] + pub hosted_workloads: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "dscpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub dscp_configuration: Option, + #[doc = "The resource GUID property of the network interface resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "WorkloadType of the NetworkInterface for BareMetal resources"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Type of Network Interface resource."] + #[serde(rename = "nicType", default, skip_serializing_if = "Option::is_none")] + pub nic_type: Option, + #[doc = "Private link service resource."] + #[serde(rename = "privateLinkService", default, skip_serializing_if = "Option::is_none")] + pub private_link_service: Option, + #[doc = "Migration phase of Network Interface resource."] + #[serde(rename = "migrationPhase", default, skip_serializing_if = "Option::is_none")] + pub migration_phase: Option, + #[doc = "Auxiliary mode of Network Interface resource."] + #[serde(rename = "auxiliaryMode", default, skip_serializing_if = "Option::is_none")] + pub auxiliary_mode: Option, +} +impl NetworkInterfacePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod network_interface_properties_format { + use super::*; + #[doc = "Type of Network Interface resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NicType { + Standard, + Elastic, + } + #[doc = "Migration phase of Network Interface resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MigrationPhase { + None, + Prepare, + Commit, + Abort, + Committed, + } + #[doc = "Auxiliary mode of Network Interface resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuxiliaryMode { + None, + MaxConnections, + Floating, + } +} +#[doc = "Tap configuration in a Network Interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceTapConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of Virtual Network Tap configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Sub Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl NetworkInterfaceTapConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for list tap configurations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceTapConfigurationListResult { + #[doc = "A list of tap configurations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkInterfaceTapConfigurationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Virtual Network Tap configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaceTapConfigurationPropertiesFormat { + #[doc = "Virtual Network Tap resource."] + #[serde(rename = "virtualNetworkTap", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_tap: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NetworkInterfaceTapConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network profile resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfile { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Network profile properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkProfiles API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfileListResult { + #[doc = "A list of network profiles that exist in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkProfileListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network profile properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfilePropertiesFormat { + #[doc = "List of child container network interfaces."] + #[serde(rename = "containerNetworkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub container_network_interfaces: Vec, + #[doc = "List of chid container network interface configurations."] + #[serde(rename = "containerNetworkInterfaceConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub container_network_interface_configurations: Vec, + #[doc = "The resource GUID property of the network profile resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NetworkProfilePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Rule of type network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkRule { + #[serde(flatten)] + pub firewall_policy_rule: FirewallPolicyRule, + #[doc = "Array of FirewallPolicyRuleNetworkProtocols."] + #[serde(rename = "ipProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub ip_protocols: Vec, + #[doc = "List of source IP addresses for this rule."] + #[serde(rename = "sourceAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub source_addresses: Vec, + #[doc = "List of destination IP addresses or Service Tags."] + #[serde(rename = "destinationAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub destination_addresses: Vec, + #[doc = "List of destination ports."] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "List of source IpGroups for this rule."] + #[serde(rename = "sourceIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_groups: Vec, + #[doc = "List of destination IpGroups for this rule."] + #[serde(rename = "destinationIpGroups", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ip_groups: Vec, + #[doc = "List of destination FQDNs."] + #[serde(rename = "destinationFqdns", default, skip_serializing_if = "Vec::is_empty")] + pub destination_fqdns: Vec, +} +impl NetworkRule { + pub fn new(firewall_policy_rule: FirewallPolicyRule) -> Self { + Self { + firewall_policy_rule, + ip_protocols: Vec::new(), + source_addresses: Vec::new(), + destination_addresses: Vec::new(), + destination_ports: Vec::new(), + source_ip_groups: Vec::new(), + destination_ip_groups: Vec::new(), + destination_fqdns: Vec::new(), + } + } +} +#[doc = "NetworkSecurityGroup resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSecurityGroup { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Network Security Group resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkSecurityGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkSecurityGroups API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSecurityGroupListResult { + #[doc = "A list of NetworkSecurityGroup resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkSecurityGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Security Group resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSecurityGroupPropertiesFormat { + #[doc = "A collection of security rules of the network security group."] + #[serde(rename = "securityRules", default, skip_serializing_if = "Vec::is_empty")] + pub security_rules: Vec, + #[doc = "The default security rules of network security group."] + #[serde(rename = "defaultSecurityRules", default, skip_serializing_if = "Vec::is_empty")] + pub default_security_rules: Vec, + #[doc = "A collection of references to network interfaces."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, + #[doc = "A collection of references to subnets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "A collection of references to flow log resources."] + #[serde(rename = "flowLogs", default, skip_serializing_if = "Vec::is_empty")] + pub flow_logs: Vec, + #[doc = "The resource GUID property of the network security group resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NetworkSecurityGroupPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network configuration diagnostic result corresponded provided traffic query."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSecurityGroupResult { + #[doc = "Whether network traffic is allowed or denied."] + #[serde(rename = "securityRuleAccessResult", default, skip_serializing_if = "Option::is_none")] + pub security_rule_access_result: Option, + #[doc = "List of results network security groups diagnostic."] + #[serde(rename = "evaluatedNetworkSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub evaluated_network_security_groups: Vec, +} +impl NetworkSecurityGroupResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network security rules evaluation result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkSecurityRulesEvaluationResult { + #[doc = "Name of the network security rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Value indicating whether protocol is matched."] + #[serde(rename = "protocolMatched", default, skip_serializing_if = "Option::is_none")] + pub protocol_matched: Option, + #[doc = "Value indicating whether source is matched."] + #[serde(rename = "sourceMatched", default, skip_serializing_if = "Option::is_none")] + pub source_matched: Option, + #[doc = "Value indicating whether source port is matched."] + #[serde(rename = "sourcePortMatched", default, skip_serializing_if = "Option::is_none")] + pub source_port_matched: Option, + #[doc = "Value indicating whether destination is matched."] + #[serde(rename = "destinationMatched", default, skip_serializing_if = "Option::is_none")] + pub destination_matched: Option, + #[doc = "Value indicating whether destination port is matched."] + #[serde(rename = "destinationPortMatched", default, skip_serializing_if = "Option::is_none")] + pub destination_port_matched: Option, +} +impl NetworkSecurityRulesEvaluationResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NetworkVirtualAppliance Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualAppliance { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Network Virtual Appliance definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkVirtualAppliance { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkVirtualAppliances API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceListResult { + #[doc = "List of Network Virtual Appliances."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkVirtualApplianceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Virtual Appliance definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualAppliancePropertiesFormat { + #[doc = "Network Virtual Appliance Sku Properties."] + #[serde(rename = "nvaSku", default, skip_serializing_if = "Option::is_none")] + pub nva_sku: Option, + #[doc = "Address Prefix."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "BootStrapConfigurationBlobs storage URLs."] + #[serde(rename = "bootStrapConfigurationBlobs", default, skip_serializing_if = "Vec::is_empty")] + pub boot_strap_configuration_blobs: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualHub", default, skip_serializing_if = "Option::is_none")] + pub virtual_hub: Option, + #[doc = "CloudInitConfigurationBlob storage URLs."] + #[serde(rename = "cloudInitConfigurationBlobs", default, skip_serializing_if = "Vec::is_empty")] + pub cloud_init_configuration_blobs: Vec, + #[doc = "CloudInitConfiguration string in plain text."] + #[serde(rename = "cloudInitConfiguration", default, skip_serializing_if = "Option::is_none")] + pub cloud_init_configuration: Option, + #[doc = "VirtualAppliance ASN."] + #[serde(rename = "virtualApplianceAsn", default, skip_serializing_if = "Option::is_none")] + pub virtual_appliance_asn: Option, + #[doc = "Public key for SSH login."] + #[serde(rename = "sshPublicKey", default, skip_serializing_if = "Option::is_none")] + pub ssh_public_key: Option, + #[doc = "List of Virtual Appliance Network Interfaces."] + #[serde(rename = "virtualApplianceNics", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_appliance_nics: Vec, + #[doc = "List of references to VirtualApplianceSite."] + #[serde(rename = "virtualApplianceSites", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_appliance_sites: Vec, + #[doc = "List of references to InboundSecurityRules."] + #[serde(rename = "inboundSecurityRules", default, skip_serializing_if = "Vec::is_empty")] + pub inbound_security_rules: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NetworkVirtualAppliancePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkVirtualApplianceSites API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceSiteListResult { + #[doc = "List of Network Virtual Appliance sites."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkVirtualApplianceSiteListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Definition of the NetworkVirtualApplianceSkus resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceSku { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties specific to NetworkVirtualApplianceSkus."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl NetworkVirtualApplianceSku { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of available Sku and instances."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceSkuInstances { + #[doc = "Scale Unit."] + #[serde(rename = "scaleUnit", default, skip_serializing_if = "Option::is_none")] + pub scale_unit: Option, + #[doc = "Instance Count."] + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, +} +impl NetworkVirtualApplianceSkuInstances { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkVirtualApplianceSkus API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceSkuListResult { + #[doc = "List of Network Virtual Appliance Skus that are available."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkVirtualApplianceSkuListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties specific to NetworkVirtualApplianceSkus."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkVirtualApplianceSkuPropertiesFormat { + #[doc = "Network Virtual Appliance Sku vendor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vendor: Option, + #[doc = "Available Network Virtual Appliance versions."] + #[serde(rename = "availableVersions", default, skip_serializing_if = "Vec::is_empty")] + pub available_versions: Vec, + #[doc = "The list of scale units available."] + #[serde(rename = "availableScaleUnits", default, skip_serializing_if = "Vec::is_empty")] + pub available_scale_units: Vec, +} +impl NetworkVirtualApplianceSkuPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network watcher in a resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkWatcher { + #[serde(flatten)] + pub resource: Resource, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The network watcher properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NetworkWatcher { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListNetworkWatchers API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkWatcherListResult { + #[doc = "List of network watcher resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl NetworkWatcherListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The network watcher properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkWatcherPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl NetworkWatcherPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the source and destination endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NextHopParameters { + #[doc = "The resource identifier of the target resource against which the action is to be performed."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "The source IP address."] + #[serde(rename = "sourceIPAddress")] + pub source_ip_address: String, + #[doc = "The destination IP address."] + #[serde(rename = "destinationIPAddress")] + pub destination_ip_address: String, + #[doc = "The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional)."] + #[serde(rename = "targetNicResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_nic_resource_id: Option, +} +impl NextHopParameters { + pub fn new(target_resource_id: String, source_ip_address: String, destination_ip_address: String) -> Self { + Self { + target_resource_id, + source_ip_address, + destination_ip_address, + target_nic_resource_id: None, + } + } +} +#[doc = "The information about next hop from the specified VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NextHopResult { + #[doc = "Next hop type."] + #[serde(rename = "nextHopType", default, skip_serializing_if = "Option::is_none")] + pub next_hop_type: Option, + #[doc = "Next hop IP Address."] + #[serde(rename = "nextHopIpAddress", default, skip_serializing_if = "Option::is_none")] + pub next_hop_ip_address: Option, + #[doc = "The resource identifier for the route table associated with the route being returned. If the route being returned does not correspond to any user created routes then this field will be the string 'System Route'."] + #[serde(rename = "routeTableId", default, skip_serializing_if = "Option::is_none")] + pub route_table_id: Option, +} +impl NextHopResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod next_hop_result { + use super::*; + #[doc = "Next hop type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NextHopType { + Internet, + VirtualAppliance, + VirtualNetworkGateway, + VnetLocal, + HyperNetGateway, + None, + } +} +#[doc = "Office365 breakout categories."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct O365BreakOutCategoryPolicies { + #[doc = "Flag to control allow category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub allow: Option, + #[doc = "Flag to control optimize category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub optimize: Option, + #[doc = "Flag to control default category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, +} +impl O365BreakOutCategoryPolicies { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Office365 breakout policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct O365PolicyProperties { + #[doc = "Office365 breakout categories."] + #[serde(rename = "breakOutCategories", default, skip_serializing_if = "Option::is_none")] + pub break_out_categories: Option, +} +impl O365PolicyProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Virtual Appliance Sku Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Office365PolicyProperties { + #[doc = "Network Virtual Appliance Sku Properties."] + #[serde(rename = "breakOutCategories", default, skip_serializing_if = "Option::is_none")] + pub break_out_categories: Option, +} +impl Office365PolicyProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The office traffic category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OfficeTrafficCategory { + Optimize, + OptimizeAndAllow, + All, + None, +} +#[doc = "Network REST API operation definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation name: {provider}/{resource}/{operation}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display metadata associated with the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Origin of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Description of operation properties format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Display metadata associated with the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Service provider: Microsoft Network."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource on which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Type of the operation: get, read, delete, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Result of the request to list Network operations. It contains a list of operations and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of Network operations supported by the Network resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of operation properties format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationPropertiesFormat { + #[doc = "Specification of the service."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl OperationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_properties_format { + use super::*; + #[doc = "Specification of the service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ServiceSpecification { + #[doc = "Operation service specification."] + #[serde(rename = "metricSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub metric_specifications: Vec, + #[doc = "Operation log specification."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, + } + impl ServiceSpecification { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Describes a column to sort"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OrderBy { + #[doc = "Describes the actual column name to sort by"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub field: Option, + #[doc = "Describes if results should be in ascending/descending order"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, +} +impl OrderBy { + pub fn new() -> Self { + Self::default() + } +} +pub mod order_by { + use super::*; + #[doc = "Describes if results should be in ascending/descending order"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Order { + Ascending, + Descending, + } +} +#[doc = "Outbound rule of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OutboundRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Outbound rule of the load balancer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl OutboundRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Outbound rule of the load balancer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OutboundRulePropertiesFormat { + #[doc = "The number of outbound ports to be used for NAT."] + #[serde(rename = "allocatedOutboundPorts", default, skip_serializing_if = "Option::is_none")] + pub allocated_outbound_ports: Option, + #[doc = "The Frontend IP addresses of the load balancer."] + #[serde(rename = "frontendIPConfigurations")] + pub frontend_ip_configurations: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "backendAddressPool")] + pub backend_address_pool: SubResource, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The protocol for the outbound rule in load balancer."] + pub protocol: outbound_rule_properties_format::Protocol, + #[doc = "Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP."] + #[serde(rename = "enableTcpReset", default, skip_serializing_if = "Option::is_none")] + pub enable_tcp_reset: Option, + #[doc = "The timeout for the TCP idle connection."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, +} +impl OutboundRulePropertiesFormat { + pub fn new( + frontend_ip_configurations: Vec, + backend_address_pool: SubResource, + protocol: outbound_rule_properties_format::Protocol, + ) -> Self { + Self { + allocated_outbound_ports: None, + frontend_ip_configurations, + backend_address_pool, + provisioning_state: None, + protocol, + enable_tcp_reset: None, + idle_timeout_in_minutes: None, + } + } +} +pub mod outbound_rule_properties_format { + use super::*; + #[doc = "The protocol for the outbound rule in load balancer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Udp, + All, + } +} +#[doc = "Allow to exclude some variable satisfy the condition for the WAF check."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OwaspCrsExclusionEntry { + #[doc = "The variable to be excluded."] + #[serde(rename = "matchVariable")] + pub match_variable: owasp_crs_exclusion_entry::MatchVariable, + #[doc = "When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to."] + #[serde(rename = "selectorMatchOperator")] + pub selector_match_operator: owasp_crs_exclusion_entry::SelectorMatchOperator, + #[doc = "When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to."] + pub selector: String, + #[doc = "The managed rule sets that are associated with the exclusion."] + #[serde(rename = "exclusionManagedRuleSets", default, skip_serializing_if = "Vec::is_empty")] + pub exclusion_managed_rule_sets: Vec, +} +impl OwaspCrsExclusionEntry { + pub fn new( + match_variable: owasp_crs_exclusion_entry::MatchVariable, + selector_match_operator: owasp_crs_exclusion_entry::SelectorMatchOperator, + selector: String, + ) -> Self { + Self { + match_variable, + selector_match_operator, + selector, + exclusion_managed_rule_sets: Vec::new(), + } + } +} +pub mod owasp_crs_exclusion_entry { + use super::*; + #[doc = "The variable to be excluded."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MatchVariable { + RequestHeaderNames, + RequestCookieNames, + RequestArgNames, + RequestHeaderKeys, + RequestHeaderValues, + RequestCookieKeys, + RequestCookieValues, + RequestArgKeys, + RequestArgValues, + } + #[doc = "When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SelectorMatchOperator { + Equals, + Contains, + StartsWith, + EndsWith, + EqualsAny, + } +} +#[doc = "P2SConnectionConfiguration Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sConnectionConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for P2SConnectionConfiguration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl P2sConnectionConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for P2SConnectionConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sConnectionConfigurationProperties { + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "vpnClientAddressPool", default, skip_serializing_if = "Option::is_none")] + pub vpn_client_address_pool: Option, + #[doc = "Routing Configuration indicating the associated and propagated route tables for this connection."] + #[serde(rename = "routingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub routing_configuration: Option, + #[doc = "Flag indicating whether the enable internet security flag is turned on for the P2S Connections or not."] + #[serde(rename = "enableInternetSecurity", default, skip_serializing_if = "Option::is_none")] + pub enable_internet_security: Option, + #[doc = "List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to."] + #[serde(rename = "configurationPolicyGroupAssociations", default, skip_serializing_if = "Vec::is_empty")] + pub configuration_policy_group_associations: Vec, + #[doc = "List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to."] + #[serde( + rename = "previousConfigurationPolicyGroupAssociations", + default, + skip_serializing_if = "Vec::is_empty" + )] + pub previous_configuration_policy_group_associations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl P2sConnectionConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "P2S Vpn connection detailed health written to sas url."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sVpnConnectionHealth { + #[doc = "Returned sas url of the blob to which the p2s vpn connection detailed health will be written."] + #[serde(rename = "sasUrl", default, skip_serializing_if = "Option::is_none")] + pub sas_url: Option, +} +impl P2sVpnConnectionHealth { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of P2S Vpn connection health request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sVpnConnectionHealthRequest { + #[doc = "The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for."] + #[serde(rename = "vpnUserNamesFilter", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_user_names_filter: Vec, + #[doc = "The sas-url to download the P2S Vpn connection health detail."] + #[serde(rename = "outputBlobSasUrl", default, skip_serializing_if = "Option::is_none")] + pub output_blob_sas_url: Option, +} +impl P2sVpnConnectionHealthRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of p2s vpn connections to be disconnected."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sVpnConnectionRequest { + #[doc = "List of p2s vpn connection Ids."] + #[serde(rename = "vpnConnectionIds", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_connection_ids: Vec, +} +impl P2sVpnConnectionRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "P2SVpnGateway Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct P2sVpnGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for P2SVpnGateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl P2sVpnGateway { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + } + } +} +#[doc = "Parameters for P2SVpnGateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sVpnGatewayProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualHub", default, skip_serializing_if = "Option::is_none")] + pub virtual_hub: Option, + #[doc = "List of all p2s connection configurations of the gateway."] + #[serde(rename = "p2SConnectionConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub p2_s_connection_configurations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The scale unit for this p2s vpn gateway."] + #[serde(rename = "vpnGatewayScaleUnit", default, skip_serializing_if = "Option::is_none")] + pub vpn_gateway_scale_unit: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "vpnServerConfiguration", default, skip_serializing_if = "Option::is_none")] + pub vpn_server_configuration: Option, + #[doc = "VpnClientConnectionHealth properties."] + #[serde(rename = "vpnClientConnectionHealth", default, skip_serializing_if = "Option::is_none")] + pub vpn_client_connection_health: Option, + #[doc = "List of all customer specified DNS servers IP addresses."] + #[serde(rename = "customDnsServers", default, skip_serializing_if = "Vec::is_empty")] + pub custom_dns_servers: Vec, + #[doc = "Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway."] + #[serde(rename = "isRoutingPreferenceInternet", default, skip_serializing_if = "Option::is_none")] + pub is_routing_preference_internet: Option, +} +impl P2sVpnGatewayProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vpn Client Parameters for package generation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct P2sVpnProfileParameters { + #[doc = "VPN client authentication method."] + #[serde(rename = "authenticationMethod", default, skip_serializing_if = "Option::is_none")] + pub authentication_method: Option, +} +impl P2sVpnProfileParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the create packet capture operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PacketCapture { + #[doc = "Parameters that define the create packet capture operation."] + pub properties: PacketCaptureParameters, +} +impl PacketCapture { + pub fn new(properties: PacketCaptureParameters) -> Self { + Self { properties } + } +} +#[doc = "Filter that is applied to packet capture request. Multiple filters can be applied."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PacketCaptureFilter { + #[doc = "Protocol to be filtered on."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Local IP Address to be filtered on. Notation: \"127.0.0.1\" for single address entry. \"127.0.0.1-127.0.0.255\" for range. \"127.0.0.1;127.0.0.5\"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null."] + #[serde(rename = "localIPAddress", default, skip_serializing_if = "Option::is_none")] + pub local_ip_address: Option, + #[doc = "Local IP Address to be filtered on. Notation: \"127.0.0.1\" for single address entry. \"127.0.0.1-127.0.0.255\" for range. \"127.0.0.1;127.0.0.5;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null."] + #[serde(rename = "remoteIPAddress", default, skip_serializing_if = "Option::is_none")] + pub remote_ip_address: Option, + #[doc = "Local port to be filtered on. Notation: \"80\" for single port entry.\"80-85\" for range. \"80;443;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null."] + #[serde(rename = "localPort", default, skip_serializing_if = "Option::is_none")] + pub local_port: Option, + #[doc = "Remote port to be filtered on. Notation: \"80\" for single port entry.\"80-85\" for range. \"80;443;\" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null."] + #[serde(rename = "remotePort", default, skip_serializing_if = "Option::is_none")] + pub remote_port: Option, +} +impl PacketCaptureFilter { + pub fn new() -> Self { + Self::default() + } +} +pub mod packet_capture_filter { + use super::*; + #[doc = "Protocol to be filtered on."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + Any, + } + impl Default for Protocol { + fn default() -> Self { + Self::Any + } + } +} +#[doc = "List of packet capture sessions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PacketCaptureListResult { + #[doc = "Information about packet capture sessions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PacketCaptureListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the create packet capture operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PacketCaptureParameters { + #[doc = "The ID of the targeted resource, only VM is currently supported."] + pub target: String, + #[doc = "Number of bytes captured per packet, the remaining bytes are truncated."] + #[serde(rename = "bytesToCapturePerPacket", default, skip_serializing_if = "Option::is_none")] + pub bytes_to_capture_per_packet: Option, + #[doc = "Maximum size of the capture output."] + #[serde(rename = "totalBytesPerSession", default, skip_serializing_if = "Option::is_none")] + pub total_bytes_per_session: Option, + #[doc = "Maximum duration of the capture session in seconds."] + #[serde(rename = "timeLimitInSeconds", default, skip_serializing_if = "Option::is_none")] + pub time_limit_in_seconds: Option, + #[doc = "The storage location for a packet capture session."] + #[serde(rename = "storageLocation")] + pub storage_location: PacketCaptureStorageLocation, + #[doc = "A list of packet capture filters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub filters: Vec, +} +impl PacketCaptureParameters { + pub fn new(target: String, storage_location: PacketCaptureStorageLocation) -> Self { + Self { + target, + bytes_to_capture_per_packet: None, + total_bytes_per_session: None, + time_limit_in_seconds: None, + storage_location, + filters: Vec::new(), + } + } +} +#[doc = "Status of packet capture session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PacketCaptureQueryStatusResult { + #[doc = "The name of the packet capture resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the packet capture resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The start time of the packet capture session."] + #[serde(rename = "captureStartTime", default, skip_serializing_if = "Option::is_none")] + pub capture_start_time: Option, + #[doc = "The status of the packet capture session."] + #[serde(rename = "packetCaptureStatus", default, skip_serializing_if = "Option::is_none")] + pub packet_capture_status: Option, + #[doc = "The reason the current packet capture session was stopped."] + #[serde(rename = "stopReason", default, skip_serializing_if = "Option::is_none")] + pub stop_reason: Option, + #[doc = "List of errors of packet capture session."] + #[serde(rename = "packetCaptureError", default, skip_serializing_if = "Vec::is_empty")] + pub packet_capture_error: Vec, +} +impl PacketCaptureQueryStatusResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod packet_capture_query_status_result { + use super::*; + #[doc = "The status of the packet capture session."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PacketCaptureStatus { + NotStarted, + Running, + Stopped, + Error, + Unknown, + } +} +#[doc = "Information about packet capture session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PacketCaptureResult { + #[doc = "Name of the packet capture session."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "ID of the packet capture operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The properties of a packet capture session."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PacketCaptureResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a packet capture session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PacketCaptureResultProperties { + #[serde(flatten)] + pub packet_capture_parameters: PacketCaptureParameters, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PacketCaptureResultProperties { + pub fn new(packet_capture_parameters: PacketCaptureParameters) -> Self { + Self { + packet_capture_parameters, + provisioning_state: None, + } + } +} +#[doc = "The storage location for a packet capture session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PacketCaptureStorageLocation { + #[doc = "The ID of the storage account to save the packet capture session. Required if no local file path is provided."] + #[serde(rename = "storageId", default, skip_serializing_if = "Option::is_none")] + pub storage_id: Option, + #[doc = "The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet capture."] + #[serde(rename = "storagePath", default, skip_serializing_if = "Option::is_none")] + pub storage_path: Option, + #[doc = "A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if no storage ID is provided, otherwise optional."] + #[serde(rename = "filePath", default, skip_serializing_if = "Option::is_none")] + pub file_path: Option, +} +impl PacketCaptureStorageLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchRouteFilter { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Route Filter Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PatchRouteFilter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Rule Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchRouteFilterRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Route Filter Rule Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PatchRouteFilterRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeerExpressRouteCircuitConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the peer express route circuit connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PeerExpressRouteCircuitConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListPeeredConnections API service call retrieves all global reach peer circuit connections that belongs to a Private Peering for an ExpressRouteCircuit."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeerExpressRouteCircuitConnectionListResult { + #[doc = "The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PeerExpressRouteCircuitConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the peer express route circuit connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeerExpressRouteCircuitConnectionPropertiesFormat { + #[doc = "Reference to another subresource."] + #[serde(rename = "expressRouteCircuitPeering", default, skip_serializing_if = "Option::is_none")] + pub express_route_circuit_peering: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "peerExpressRouteCircuitPeering", default, skip_serializing_if = "Option::is_none")] + pub peer_express_route_circuit_peering: Option, + #[doc = "/29 IP address space to carve out Customer addresses for tunnels."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "Express Route Circuit connection state."] + #[serde(rename = "circuitConnectionStatus", default, skip_serializing_if = "Option::is_none")] + pub circuit_connection_status: Option, + #[doc = "The name of the express route circuit connection resource."] + #[serde(rename = "connectionName", default, skip_serializing_if = "Option::is_none")] + pub connection_name: Option, + #[doc = "The resource guid of the authorization used for the express route circuit connection."] + #[serde(rename = "authResourceGuid", default, skip_serializing_if = "Option::is_none")] + pub auth_resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PeerExpressRouteCircuitConnectionPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Peer routing details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeerRoute { + #[doc = "The peer's local address."] + #[serde(rename = "localAddress", default, skip_serializing_if = "Option::is_none")] + pub local_address: Option, + #[doc = "The route's network prefix."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, + #[doc = "The route's next hop."] + #[serde(rename = "nextHop", default, skip_serializing_if = "Option::is_none")] + pub next_hop: Option, + #[doc = "The peer this route was learned from."] + #[serde(rename = "sourcePeer", default, skip_serializing_if = "Option::is_none")] + pub source_peer: Option, + #[doc = "The source this route was learned from."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "The route's AS path sequence."] + #[serde(rename = "asPath", default, skip_serializing_if = "Option::is_none")] + pub as_path: Option, + #[doc = "The route's weight."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, +} +impl PeerRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of virtual router peer routes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PeerRouteList { + #[doc = "List of peer routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl PeerRouteList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Pfs Groups used in IKE Phase 2 for new child SA."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PfsGroup { + None, + #[serde(rename = "PFS1")] + Pfs1, + #[serde(rename = "PFS2")] + Pfs2, + #[serde(rename = "PFS2048")] + Pfs2048, + #[serde(rename = "ECP256")] + Ecp256, + #[serde(rename = "ECP384")] + Ecp384, + #[serde(rename = "PFS24")] + Pfs24, + #[serde(rename = "PFS14")] + Pfs14, + #[serde(rename = "PFSMM")] + Pfsmm, +} +#[doc = "Ssl predefined policy name enums."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PolicyNameEnum { + AppGwSslPolicy20150501, + AppGwSslPolicy20170401, + AppGwSslPolicy20170401S, +} +#[doc = "Defines contents of a web application firewall global configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicySettings { + #[doc = "The state of the policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The mode of the policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "Whether to allow WAF to check request Body."] + #[serde(rename = "requestBodyCheck", default, skip_serializing_if = "Option::is_none")] + pub request_body_check: Option, + #[doc = "Maximum request body size in Kb for WAF."] + #[serde(rename = "maxRequestBodySizeInKb", default, skip_serializing_if = "Option::is_none")] + pub max_request_body_size_in_kb: Option, + #[doc = "Maximum file upload size in Mb for WAF."] + #[serde(rename = "fileUploadLimitInMb", default, skip_serializing_if = "Option::is_none")] + pub file_upload_limit_in_mb: Option, +} +impl PolicySettings { + pub fn new() -> Self { + Self::default() + } +} +pub mod policy_settings { + use super::*; + #[doc = "The state of the policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + Disabled, + Enabled, + } + #[doc = "The mode of the policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + Prevention, + Detection, + } +} +pub type PortsList = String; +#[doc = "The preferred routing gateway types"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PreferredRoutingGateway { + ExpressRoute, + VpnGateway, + None, +} +#[doc = "Details of PrepareNetworkPolicies for Subnet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrepareNetworkPoliciesRequest { + #[doc = "The name of the service for which subnet is being prepared for."] + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, + #[doc = "A list of NetworkIntentPolicyConfiguration."] + #[serde(rename = "networkIntentPolicyConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_intent_policy_configurations: Vec, +} +impl PrepareNetworkPoliciesRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateDnsZoneConfig resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateDnsZoneConfig { + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Properties of the private dns zone configuration resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateDnsZoneConfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private dns zone group resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateDnsZoneGroup { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Properties of the private dns zone group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateDnsZoneGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListPrivateDnsZoneGroups API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateDnsZoneGroupListResult { + #[doc = "A list of private dns zone group resources in a private endpoint."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateDnsZoneGroupListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private dns zone group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateDnsZoneGroupPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "A collection of private dns zone configurations of the private dns zone group."] + #[serde(rename = "privateDnsZoneConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub private_dns_zone_configs: Vec, +} +impl PrivateDnsZoneGroupPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private dns zone configuration resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateDnsZonePropertiesFormat { + #[doc = "The resource id of the private dns zone."] + #[serde(rename = "privateDnsZoneId", default, skip_serializing_if = "Option::is_none")] + pub private_dns_zone_id: Option, + #[doc = "A collection of information regarding a recordSet, holding information to identify private resources."] + #[serde(rename = "recordSets", default, skip_serializing_if = "Vec::is_empty")] + pub record_sets: Vec, +} +impl PrivateDnsZonePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private endpoint resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Properties of the private endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateEndpointConnection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the PrivateEndpointConnectProperties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListPrivateEndpointConnection API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "A list of PrivateEndpointConnection resources for a specific private link service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the PrivateEndpointConnectProperties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "Private endpoint resource."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The consumer link id."] + #[serde(rename = "linkIdentifier", default, skip_serializing_if = "Option::is_none")] + pub link_identifier: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An IP Configuration of the private endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointIpConfiguration { + #[doc = "Properties of an IP Configuration of the private endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PrivateEndpointIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of an IP Configuration of the private endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointIpConfigurationProperties { + #[doc = "The ID of a group obtained from the remote resource that this private endpoint should connect to."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The member name of a group obtained from the remote resource that this private endpoint should connect to."] + #[serde(rename = "memberName", default, skip_serializing_if = "Option::is_none")] + pub member_name: Option, + #[doc = "A private ip address obtained from the private endpoint's subnet."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, +} +impl PrivateEndpointIpConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListPrivateEndpoints API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointListResult { + #[doc = "A list of private endpoint resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateEndpointListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointProperties { + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "An array of references to the network interfaces created for this private endpoint."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "A grouping of information about the connection to the remote resource."] + #[serde(rename = "privateLinkServiceConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_link_service_connections: Vec, + #[doc = "A grouping of information about the connection to the remote resource. Used when the network admin does not have access to approve connections to the remote resource."] + #[serde(rename = "manualPrivateLinkServiceConnections", default, skip_serializing_if = "Vec::is_empty")] + pub manual_private_link_service_connections: Vec, + #[doc = "An array of custom dns configurations."] + #[serde(rename = "customDnsConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub custom_dns_configs: Vec, + #[doc = "Application security groups in which the private endpoint IP configuration is included."] + #[serde(rename = "applicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub application_security_groups: Vec, + #[doc = "A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "The custom name of the network interface attached to the private endpoint."] + #[serde(rename = "customNetworkInterfaceName", default, skip_serializing_if = "Option::is_none")] + pub custom_network_interface_name: Option, +} +impl PrivateEndpointProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private link service resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkService { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Properties of the private link service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PrivateLinkService { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateLinkServiceConnection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the PrivateLinkServiceConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl PrivateLinkServiceConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the PrivateLinkServiceConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The resource id of private link service."] + #[serde(rename = "privateLinkServiceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_id: Option, + #[doc = "The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to."] + #[serde(rename = "groupIds", default, skip_serializing_if = "Vec::is_empty")] + pub group_ids: Vec, + #[doc = "A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars."] + #[serde(rename = "requestMessage", default, skip_serializing_if = "Option::is_none")] + pub request_message: Option, + #[doc = "A collection of information about the state of the connection between service consumer and provider."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +impl PrivateLinkServiceConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A collection of information about the state of the connection between service consumer and provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The reason for approval/rejection of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "A message indicating if changes on the service provider require any updates on the consumer."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The private link service ip configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of private link service IP configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of private link service ip configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PrivateLinkServiceIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of private link service IP configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceIpConfigurationProperties { + #[doc = "The private IP address of the IP configuration."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Subnet in a virtual network resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Whether the ip configuration is primary or not."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "IP address version."] + #[serde(rename = "privateIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address_version: Option, +} +impl PrivateLinkServiceIpConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListPrivateLinkService API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceListResult { + #[doc = "A list of PrivateLinkService resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateLinkServiceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private link service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceProperties { + #[doc = "An array of references to the load balancer IP configurations."] + #[serde(rename = "loadBalancerFrontendIpConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancer_frontend_ip_configurations: Vec, + #[doc = "An array of private link service IP configurations."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "An array of references to the network interfaces created for this private link service."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "An array of list about connections to the private endpoint."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "The visibility list of the private link service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[doc = "The auto-approval list of the private link service."] + #[serde(rename = "autoApproval", default, skip_serializing_if = "Option::is_none")] + pub auto_approval: Option, + #[doc = "The list of Fqdn."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub fqdns: Vec, + #[doc = "The alias of the private link service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub alias: Option, + #[doc = "Whether the private link service is enabled for proxy protocol or not."] + #[serde(rename = "enableProxyProtocol", default, skip_serializing_if = "Option::is_none")] + pub enable_proxy_protocol: Option, +} +impl PrivateLinkServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the CheckPrivateLinkServiceVisibility API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceVisibility { + #[doc = "Private Link Service Visibility (True/False)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible: Option, +} +impl PrivateLinkServiceVisibility { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A load balancer probe."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Probe { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Load balancer probe resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Probe { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Load balancer probe resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProbePropertiesFormat { + #[doc = "The load balancer rules that use this probe."] + #[serde(rename = "loadBalancingRules", default, skip_serializing_if = "Vec::is_empty")] + pub load_balancing_rules: Vec, + #[doc = "The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful."] + pub protocol: probe_properties_format::Protocol, + #[doc = "The port for communicating the probe. Possible values range from 1 to 65535, inclusive."] + pub port: i32, + #[doc = "The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5."] + #[serde(rename = "intervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub interval_in_seconds: Option, + #[doc = "The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure."] + #[serde(rename = "numberOfProbes", default, skip_serializing_if = "Option::is_none")] + pub number_of_probes: Option, + #[doc = "The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value."] + #[serde(rename = "requestPath", default, skip_serializing_if = "Option::is_none")] + pub request_path: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ProbePropertiesFormat { + pub fn new(protocol: probe_properties_format::Protocol, port: i32) -> Self { + Self { + load_balancing_rules: Vec::new(), + protocol, + port, + interval_in_seconds: None, + number_of_probes: None, + request_path: None, + provisioning_state: None, + } + } +} +pub mod probe_properties_format { + use super::*; + #[doc = "The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Http, + Tcp, + Https, + } +} +#[doc = "The list of RouteTables to advertise the routes to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PropagatedRouteTable { + #[doc = "The list of labels."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec, + #[doc = "The list of resource ids of all the RouteTables."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ids: Vec, +} +impl PropagatedRouteTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configuration of the protocol."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtocolConfiguration { + #[doc = "HTTP configuration of the connectivity check."] + #[serde(rename = "HTTPConfiguration", default, skip_serializing_if = "Option::is_none")] + pub http_configuration: Option, +} +impl ProtocolConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DDoS custom policy properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtocolCustomSettingsFormat { + #[doc = "The protocol for which the DDoS protection policy is being customized."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "The customized DDoS protection trigger rate."] + #[serde(rename = "triggerRateOverride", default, skip_serializing_if = "Option::is_none")] + pub trigger_rate_override: Option, + #[doc = "The customized DDoS protection source rate."] + #[serde(rename = "sourceRateOverride", default, skip_serializing_if = "Option::is_none")] + pub source_rate_override: Option, + #[doc = "The customized DDoS protection trigger rate sensitivity degrees. High: Trigger rate set with most sensitivity w.r.t. normal traffic. Default: Trigger rate set with moderate sensitivity w.r.t. normal traffic. Low: Trigger rate set with less sensitivity w.r.t. normal traffic. Relaxed: Trigger rate set with least sensitivity w.r.t. normal traffic."] + #[serde(rename = "triggerSensitivityOverride", default, skip_serializing_if = "Option::is_none")] + pub trigger_sensitivity_override: Option, +} +impl ProtocolCustomSettingsFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod protocol_custom_settings_format { + use super::*; + #[doc = "The protocol for which the DDoS protection policy is being customized."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Udp, + Syn, + } + #[doc = "The customized DDoS protection trigger rate sensitivity degrees. High: Trigger rate set with most sensitivity w.r.t. normal traffic. Default: Trigger rate set with moderate sensitivity w.r.t. normal traffic. Low: Trigger rate set with less sensitivity w.r.t. normal traffic. Relaxed: Trigger rate set with least sensitivity w.r.t. normal traffic."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerSensitivityOverride { + Relaxed, + Low, + Default, + High, + } +} +#[doc = "Ssl protocol enums."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProtocolsEnum { + #[serde(rename = "TLSv1_0")] + TlSv10, + #[serde(rename = "TLSv1_1")] + TlSv11, + #[serde(rename = "TLSv1_2")] + TlSv12, +} +#[doc = "The current provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Succeeded, + Updating, + Deleting, + Failed, +} +#[doc = "Public IP address resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpAddress { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "SKU of a public IP address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Public IP address properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Box>, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting the IP allocated for the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl PublicIpAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains FQDN of the DNS record associated with the public IP address."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpAddressDnsSettings { + #[doc = "The domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system."] + #[serde(rename = "domainNameLabel", default, skip_serializing_if = "Option::is_none")] + pub domain_name_label: Option, + #[doc = "The Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN."] + #[serde(rename = "reverseFqdn", default, skip_serializing_if = "Option::is_none")] + pub reverse_fqdn: Option, +} +impl PublicIpAddressDnsSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListPublicIpAddresses API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpAddressListResult { + #[doc = "A list of public IP addresses that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PublicIpAddressListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Public IP address properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpAddressPropertiesFormat { + #[doc = "IP address allocation method."] + #[serde(rename = "publicIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub public_ip_allocation_method: Option, + #[doc = "IP address version."] + #[serde(rename = "publicIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_version: Option, + #[doc = "IP configuration."] + #[serde(rename = "ipConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ip_configuration: Box>, + #[doc = "Contains FQDN of the DNS record associated with the public IP address."] + #[serde(rename = "dnsSettings", default, skip_serializing_if = "Option::is_none")] + pub dns_settings: Option, + #[doc = "Contains the DDoS protection settings of the public IP."] + #[serde(rename = "ddosSettings", default, skip_serializing_if = "Option::is_none")] + pub ddos_settings: Option, + #[doc = "The list of tags associated with the public IP address."] + #[serde(rename = "ipTags", default, skip_serializing_if = "Vec::is_empty")] + pub ip_tags: Vec, + #[doc = "The IP address associated with the public IP address resource."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPPrefix", default, skip_serializing_if = "Option::is_none")] + pub public_ip_prefix: Option, + #[doc = "The idle timeout of the public IP address."] + #[serde(rename = "idleTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub idle_timeout_in_minutes: Option, + #[doc = "The resource GUID property of the public IP address resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "servicePublicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub service_public_ip_address: Option, + #[doc = "Nat Gateway resource."] + #[serde(rename = "natGateway", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway: Option, + #[doc = "Migration phase of Public IP Address."] + #[serde(rename = "migrationPhase", default, skip_serializing_if = "Option::is_none")] + pub migration_phase: Option, + #[doc = "Public IP address resource."] + #[serde(rename = "linkedPublicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub linked_public_ip_address: Option, + #[doc = "Specify what happens to the public IP address when the VM using it is deleted"] + #[serde(rename = "deleteOption", default, skip_serializing_if = "Option::is_none")] + pub delete_option: Option, +} +impl PublicIpAddressPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod public_ip_address_properties_format { + use super::*; + #[doc = "Migration phase of Public IP Address."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MigrationPhase { + None, + Prepare, + Commit, + Abort, + Committed, + } + #[doc = "Specify what happens to the public IP address when the VM using it is deleted"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DeleteOption { + Delete, + Detach, + } +} +#[doc = "SKU of a public IP address."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpAddressSku { + #[doc = "Name of a public IP address SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Tier of a public IP address SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl PublicIpAddressSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod public_ip_address_sku { + use super::*; + #[doc = "Name of a public IP address SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + Standard, + } + #[doc = "Tier of a public IP address SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Regional, + Global, + } +} +#[doc = "Public IP prefix resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpPrefix { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "SKU of a public IP prefix."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Public IP prefix properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "A list of availability zones denoting the IP allocated for the resource needs to come from."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl PublicIpPrefix { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListPublicIpPrefixes API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpPrefixListResult { + #[doc = "A list of public IP prefixes that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PublicIpPrefixListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Public IP prefix properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpPrefixPropertiesFormat { + #[doc = "IP address version."] + #[serde(rename = "publicIPAddressVersion", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address_version: Option, + #[doc = "The list of tags associated with the public IP prefix."] + #[serde(rename = "ipTags", default, skip_serializing_if = "Vec::is_empty")] + pub ip_tags: Vec, + #[doc = "The Length of the Public IP Prefix."] + #[serde(rename = "prefixLength", default, skip_serializing_if = "Option::is_none")] + pub prefix_length: Option, + #[doc = "The allocated Prefix."] + #[serde(rename = "ipPrefix", default, skip_serializing_if = "Option::is_none")] + pub ip_prefix: Option, + #[doc = "The list of all referenced PublicIPAddresses."] + #[serde(rename = "publicIPAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub public_ip_addresses: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "loadBalancerFrontendIpConfiguration", default, skip_serializing_if = "Option::is_none")] + pub load_balancer_frontend_ip_configuration: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "customIPPrefix", default, skip_serializing_if = "Option::is_none")] + pub custom_ip_prefix: Option, + #[doc = "The resource GUID property of the public IP prefix resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Nat Gateway resource."] + #[serde(rename = "natGateway", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway: Option, +} +impl PublicIpPrefixPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SKU of a public IP prefix."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PublicIpPrefixSku { + #[doc = "Name of a public IP prefix SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Tier of a public IP prefix SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl PublicIpPrefixSku { + pub fn new() -> Self { + Self::default() + } +} +pub mod public_ip_prefix_sku { + use super::*; + #[doc = "Name of a public IP prefix SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + } + #[doc = "Tier of a public IP prefix SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Regional, + Global, + } +} +#[doc = "Quality of Service defines the traffic configuration between endpoints. Mandatory to have one marking."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QosDefinition { + #[doc = "List of markings to be used in the configuration."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub markings: Vec, + #[doc = "Source IP ranges."] + #[serde(rename = "sourceIpRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_ip_ranges: Vec, + #[doc = "Destination IP ranges."] + #[serde(rename = "destinationIpRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ip_ranges: Vec, + #[doc = "Sources port ranges."] + #[serde(rename = "sourcePortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_port_ranges: Vec, + #[doc = "Destination port ranges."] + #[serde(rename = "destinationPortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_port_ranges: Vec, + #[doc = "RNM supported protocol types."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, +} +impl QosDefinition { + pub fn new() -> Self { + Self::default() + } +} +pub mod qos_definition { + use super::*; + #[doc = "RNM supported protocol types."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + DoNotUse, + Icmp, + Tcp, + Udp, + Gre, + Esp, + Ah, + Vxlan, + All, + } +} +#[doc = "Qos Traffic Profiler IP Range properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QosIpRange { + #[doc = "Start IP Address."] + #[serde(rename = "startIP", default, skip_serializing_if = "Option::is_none")] + pub start_ip: Option, + #[doc = "End IP Address."] + #[serde(rename = "endIP", default, skip_serializing_if = "Option::is_none")] + pub end_ip: Option, +} +impl QosIpRange { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Qos Traffic Profiler Port range properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QosPortRange { + #[doc = "Qos Port Range start."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start: Option, + #[doc = "Qos Port Range end."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end: Option, +} +impl QosPortRange { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The request for a QueryInboundNatRulePortMapping API. Either IpConfiguration or IpAddress should be set"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryInboundNatRulePortMappingRequest { + #[doc = "Reference to another subresource."] + #[serde(rename = "ipConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ip_configuration: Option, + #[doc = "IP address set in load balancer backend address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} +impl QueryInboundNatRulePortMappingRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query result"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryResults { + #[doc = "Number of total records matching the query."] + #[serde(rename = "matchingRecordsCount", default, skip_serializing_if = "Option::is_none")] + pub matching_records_count: Option, + #[doc = "Array containing the results of the query"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub signatures: Vec, +} +impl QueryResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the resource to query the troubleshooting result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryTroubleshootingParameters { + #[doc = "The target resource ID to query the troubleshooting result."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, +} +impl QueryTroubleshootingParameters { + pub fn new(target_resource_id: String) -> Self { + Self { target_resource_id } + } +} +#[doc = "Radius Server Settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RadiusServer { + #[doc = "The address of this radius server."] + #[serde(rename = "radiusServerAddress")] + pub radius_server_address: String, + #[doc = "The initial score assigned to this radius server."] + #[serde(rename = "radiusServerScore", default, skip_serializing_if = "Option::is_none")] + pub radius_server_score: Option, + #[doc = "The secret used for this radius server."] + #[serde(rename = "radiusServerSecret", default, skip_serializing_if = "Option::is_none")] + pub radius_server_secret: Option, +} +impl RadiusServer { + pub fn new(radius_server_address: String) -> Self { + Self { + radius_server_address, + radius_server_score: None, + radius_server_secret: None, + } + } +} +#[doc = "A collective group of information about the record set information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecordSet { + #[doc = "Resource record type."] + #[serde(rename = "recordType", default, skip_serializing_if = "Option::is_none")] + pub record_type: Option, + #[doc = "Recordset name."] + #[serde(rename = "recordSetName", default, skip_serializing_if = "Option::is_none")] + pub record_set_name: Option, + #[doc = "Fqdn that resolves to private endpoint ip address."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Recordset time to live."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ttl: Option, + #[doc = "The private ip address of the private endpoint."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, +} +impl RecordSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Redirect type enum."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RedirectTypeEnum { + Permanent, + Found, + SeeOther, + Temporary, +} +#[doc = "Reference to a public IP address."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReferencedPublicIpAddress { + #[doc = "The PublicIPAddress Reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ReferencedPublicIpAddress { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common resource representation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ResourceNavigationLink resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNavigationLink { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of ResourceNavigationLink."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource navigation link identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ResourceNavigationLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ResourceNavigationLink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNavigationLinkFormat { + #[doc = "Resource type of the linked resource."] + #[serde(rename = "linkedResourceType", default, skip_serializing_if = "Option::is_none")] + pub linked_resource_type: Option, + #[doc = "Link to the external resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub link: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ResourceNavigationLinkFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ResourceNavigationLinks_List operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNavigationLinksListResult { + #[doc = "The resource navigation links in a subnet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceNavigationLinksListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The base resource set for visibility and auto-approval."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceSet { + #[doc = "The list of subscriptions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subscriptions: Vec, +} +impl ResourceSet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the retention policy for flow log."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RetentionPolicyParameters { + #[doc = "Number of days to retain flow log records."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub days: Option, + #[doc = "Flag to enable/disable retention."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl RetentionPolicyParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Route { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Route resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Route { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteFilter { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Route Filter Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl RouteFilter { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + } + } +} +#[doc = "Response for the ListRouteFilters API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteFilterListResult { + #[doc = "A list of route filters in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RouteFilterListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteFilterPropertiesFormat { + #[doc = "Collection of RouteFilterRules contained within a route filter."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rules: Vec, + #[doc = "A collection of references to express route circuit peerings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub peerings: Vec, + #[doc = "A collection of references to express route circuit ipv6 peerings."] + #[serde(rename = "ipv6Peerings", default, skip_serializing_if = "Vec::is_empty")] + pub ipv6_peerings: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl RouteFilterPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Rule Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteFilterRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Route Filter Rule Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl RouteFilterRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListRouteFilterRules API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteFilterRuleListResult { + #[doc = "A list of RouteFilterRules in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RouteFilterRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Filter Rule Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RouteFilterRulePropertiesFormat { + #[doc = "Access to be allowed or denied."] + pub access: Access, + #[doc = "The rule type of the rule."] + #[serde(rename = "routeFilterRuleType")] + pub route_filter_rule_type: route_filter_rule_properties_format::RouteFilterRuleType, + #[doc = "The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']."] + pub communities: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl RouteFilterRulePropertiesFormat { + pub fn new( + access: Access, + route_filter_rule_type: route_filter_rule_properties_format::RouteFilterRuleType, + communities: Vec, + ) -> Self { + Self { + access, + route_filter_rule_type, + communities, + provisioning_state: None, + } + } +} +pub mod route_filter_rule_properties_format { + use super::*; + #[doc = "The rule type of the rule."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RouteFilterRuleType { + Community, + } +} +#[doc = "Response for the ListRoute API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteListResult { + #[doc = "A list of routes in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RouteListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The type of Azure hop the packet should be sent to."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RouteNextHopType { + VirtualNetworkGateway, + VnetLocal, + Internet, + VirtualAppliance, + None, +} +#[doc = "Route resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoutePropertiesFormat { + #[doc = "The destination CIDR to which the route applies."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "The type of Azure hop the packet should be sent to."] + #[serde(rename = "nextHopType")] + pub next_hop_type: RouteNextHopType, + #[doc = "The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance."] + #[serde(rename = "nextHopIpAddress", default, skip_serializing_if = "Option::is_none")] + pub next_hop_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "A value indicating whether this route overrides overlapping BGP routes regardless of LPM."] + #[serde(rename = "hasBgpOverride", default, skip_serializing_if = "Option::is_none")] + pub has_bgp_override: Option, +} +impl RoutePropertiesFormat { + pub fn new(next_hop_type: RouteNextHopType) -> Self { + Self { + address_prefix: None, + next_hop_type, + next_hop_ip_address: None, + provisioning_state: None, + has_bgp_override: None, + } + } +} +#[doc = "Route table resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteTable { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Route Table resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl RouteTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListRouteTable API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteTableListResult { + #[doc = "A list of route tables in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RouteTableListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Route Table resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RouteTablePropertiesFormat { + #[doc = "Collection of routes contained within a route table."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub routes: Vec, + #[doc = "A collection of references to subnets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "Whether to disable the routes learned by BGP on that route table. True means disable."] + #[serde(rename = "disableBgpRoutePropagation", default, skip_serializing_if = "Option::is_none")] + pub disable_bgp_route_propagation: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The resource GUID property of the route table."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, +} +impl RouteTablePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Routing Configuration indicating the associated and propagated route tables for this connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoutingConfiguration { + #[doc = "Reference to another subresource."] + #[serde(rename = "associatedRouteTable", default, skip_serializing_if = "Option::is_none")] + pub associated_route_table: Option, + #[doc = "The list of RouteTables to advertise the routes to."] + #[serde(rename = "propagatedRouteTables", default, skip_serializing_if = "Option::is_none")] + pub propagated_route_tables: Option, + #[doc = "List of routes that control routing from VirtualHub into a virtual network connection."] + #[serde(rename = "vnetRoutes", default, skip_serializing_if = "Option::is_none")] + pub vnet_routes: Option, +} +impl RoutingConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The routing intent child resource of a Virtual hub."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoutingIntent { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "The properties of a RoutingIntent resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl RoutingIntent { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a RoutingIntent resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoutingIntentProperties { + #[doc = "List of routing policies."] + #[serde(rename = "routingPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub routing_policies: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl RoutingIntentProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The routing policy object used in a RoutingIntent resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoutingPolicy { + #[doc = "The unique name for the routing policy."] + pub name: String, + #[doc = "List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic)."] + pub destinations: Vec, + #[doc = "The next hop resource id on which this routing policy is applicable to."] + #[serde(rename = "nextHop")] + pub next_hop: String, +} +impl RoutingPolicy { + pub fn new(name: String, destinations: Vec, next_hop: String) -> Self { + Self { + name, + destinations, + next_hop, + } + } +} +#[doc = "The current routing state of the VirtualHub."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RoutingState { + None, + Provisioned, + Provisioning, + Failed, +} +#[doc = "Network interface and all its associated security rules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityGroupNetworkInterface { + #[doc = "ID of the network interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "All security rules associated with the network interface."] + #[serde(rename = "securityRuleAssociations", default, skip_serializing_if = "Option::is_none")] + pub security_rule_associations: Option, +} +impl SecurityGroupNetworkInterface { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the VM to check security groups for."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityGroupViewParameters { + #[doc = "ID of the target VM."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, +} +impl SecurityGroupViewParameters { + pub fn new(target_resource_id: String) -> Self { + Self { target_resource_id } + } +} +#[doc = "The information about security rules applied to the specified VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityGroupViewResult { + #[doc = "List of network interfaces on the specified VM."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, +} +impl SecurityGroupViewResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Security Partner Provider resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityPartnerProvider { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Properties of the Security Partner Provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl SecurityPartnerProvider { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current state of the connection with Security Partner Provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecurityPartnerProviderConnectionStatus { + Unknown, + PartiallyConnected, + Connected, + NotConnected, +} +#[doc = "Response for ListSecurityPartnerProviders API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityPartnerProviderListResult { + #[doc = "List of Security Partner Providers in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SecurityPartnerProviderListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Security Partner Provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityPartnerProviderPropertiesFormat { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Security Providers."] + #[serde(rename = "securityProviderName", default, skip_serializing_if = "Option::is_none")] + pub security_provider_name: Option, + #[doc = "The current state of the connection with Security Partner Provider."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualHub", default, skip_serializing_if = "Option::is_none")] + pub virtual_hub: Option, +} +impl SecurityPartnerProviderPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Security Providers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecurityPartnerProvidersecurityProviderName { + ZScaler, + IBoss, + Checkpoint, +} +#[doc = "Network security rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Security rule resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl SecurityRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Whether network traffic is allowed or denied."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecurityRuleAccess { + Allow, + Deny, +} +#[doc = "All security rules associated with the network interface."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityRuleAssociations { + #[doc = "Network interface and its custom security rules."] + #[serde(rename = "networkInterfaceAssociation", default, skip_serializing_if = "Option::is_none")] + pub network_interface_association: Option, + #[doc = "Subnet and it's custom security rules."] + #[serde(rename = "subnetAssociation", default, skip_serializing_if = "Option::is_none")] + pub subnet_association: Option, + #[doc = "Collection of default security rules of the network security group."] + #[serde(rename = "defaultSecurityRules", default, skip_serializing_if = "Vec::is_empty")] + pub default_security_rules: Vec, + #[doc = "Collection of effective security rules."] + #[serde(rename = "effectiveSecurityRules", default, skip_serializing_if = "Vec::is_empty")] + pub effective_security_rules: Vec, +} +impl SecurityRuleAssociations { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecurityRuleDirection { + Inbound, + Outbound, +} +#[doc = "Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a network security group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityRuleListResult { + #[doc = "The security rules in a network security group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SecurityRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Security rule resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecurityRulePropertiesFormat { + #[doc = "A description for this rule. Restricted to 140 chars."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Network protocol this rule applies to."] + pub protocol: security_rule_properties_format::Protocol, + #[doc = "The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports."] + #[serde(rename = "sourcePortRange", default, skip_serializing_if = "Option::is_none")] + pub source_port_range: Option, + #[doc = "The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports."] + #[serde(rename = "destinationPortRange", default, skip_serializing_if = "Option::is_none")] + pub destination_port_range: Option, + #[doc = "The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from."] + #[serde(rename = "sourceAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub source_address_prefix: Option, + #[doc = "The CIDR or source IP ranges."] + #[serde(rename = "sourceAddressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub source_address_prefixes: Vec, + #[doc = "The application security group specified as source."] + #[serde(rename = "sourceApplicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub source_application_security_groups: Vec, + #[doc = "The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used."] + #[serde(rename = "destinationAddressPrefix", default, skip_serializing_if = "Option::is_none")] + pub destination_address_prefix: Option, + #[doc = "The destination address prefixes. CIDR or destination IP ranges."] + #[serde(rename = "destinationAddressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub destination_address_prefixes: Vec, + #[doc = "The application security group specified as destination."] + #[serde(rename = "destinationApplicationSecurityGroups", default, skip_serializing_if = "Vec::is_empty")] + pub destination_application_security_groups: Vec, + #[doc = "The source port ranges."] + #[serde(rename = "sourcePortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub source_port_ranges: Vec, + #[doc = "The destination port ranges."] + #[serde(rename = "destinationPortRanges", default, skip_serializing_if = "Vec::is_empty")] + pub destination_port_ranges: Vec, + #[doc = "Whether network traffic is allowed or denied."] + pub access: SecurityRuleAccess, + #[doc = "The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic."] + pub direction: SecurityRuleDirection, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl SecurityRulePropertiesFormat { + pub fn new(protocol: security_rule_properties_format::Protocol, access: SecurityRuleAccess, direction: SecurityRuleDirection) -> Self { + Self { + description: None, + protocol, + source_port_range: None, + destination_port_range: None, + source_address_prefix: None, + source_address_prefixes: Vec::new(), + source_application_security_groups: Vec::new(), + destination_address_prefix: None, + destination_address_prefixes: Vec::new(), + destination_application_security_groups: Vec::new(), + source_port_ranges: Vec::new(), + destination_port_ranges: Vec::new(), + access, + priority: None, + direction, + provisioning_state: None, + } + } +} +pub mod security_rule_properties_format { + use super::*; + #[doc = "Network protocol this rule applies to."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + Tcp, + Udp, + Icmp, + Esp, + #[serde(rename = "*")] + U2a, + Ah, + } +} +#[doc = "ServiceAssociationLink resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceAssociationLink { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of ServiceAssociationLink."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ServiceAssociationLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of ServiceAssociationLink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceAssociationLinkPropertiesFormat { + #[doc = "Resource type of the linked resource."] + #[serde(rename = "linkedResourceType", default, skip_serializing_if = "Option::is_none")] + pub linked_resource_type: Option, + #[doc = "Link to the external resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub link: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "If true, the resource can be deleted."] + #[serde(rename = "allowDelete", default, skip_serializing_if = "Option::is_none")] + pub allow_delete: Option, + #[doc = "A list of locations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, +} +impl ServiceAssociationLinkPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ServiceAssociationLinks_List operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceAssociationLinksListResult { + #[doc = "The service association links in a subnet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ServiceAssociationLinksListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a service delegation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceDelegationPropertiesFormat { + #[doc = "The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers)."] + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, + #[doc = "The actions permitted to the service upon delegation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ServiceDelegationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service End point policy resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Service Endpoint Policy resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Kind of service endpoint policy. This is metadata used for the Azure portal experience."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, +} +impl ServiceEndpointPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service Endpoint policy definitions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicyDefinition { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Service Endpoint policy definition resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The type of the resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ServiceEndpointPolicyDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListServiceEndpointPolicyDefinition API service call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicyDefinitionListResult { + #[doc = "The service endpoint policy definition in a service endpoint policy."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ServiceEndpointPolicyDefinitionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service Endpoint policy definition resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicyDefinitionPropertiesFormat { + #[doc = "A description for this rule. Restricted to 140 chars."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Service endpoint name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub service: Option, + #[doc = "A list of service resources."] + #[serde(rename = "serviceResources", default, skip_serializing_if = "Vec::is_empty")] + pub service_resources: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ServiceEndpointPolicyDefinitionPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListServiceEndpointPolicies API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicyListResult { + #[doc = "A list of ServiceEndpointPolicy resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ServiceEndpointPolicyListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Service Endpoint Policy resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPolicyPropertiesFormat { + #[doc = "A collection of service endpoint policy definitions of the service endpoint policy."] + #[serde(rename = "serviceEndpointPolicyDefinitions", default, skip_serializing_if = "Vec::is_empty")] + pub service_endpoint_policy_definitions: Vec, + #[doc = "A collection of references to subnets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "The resource GUID property of the service endpoint policy resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The alias indicating if the policy belongs to a service"] + #[serde(rename = "serviceAlias", default, skip_serializing_if = "Option::is_none")] + pub service_alias: Option, + #[doc = "A collection of contextual service endpoint policy."] + #[serde(rename = "contextualServiceEndpointPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub contextual_service_endpoint_policies: Vec, +} +impl ServiceEndpointPolicyPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The service endpoint properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceEndpointPropertiesFormat { + #[doc = "The type of the endpoint service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub service: Option, + #[doc = "A list of locations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl ServiceEndpointPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The ServiceProviderProvisioningState state of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServiceProviderProvisioningState { + NotProvisioned, + Provisioning, + Provisioned, + Deprovisioning, +} +#[doc = "The service tag information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceTagInformation { + #[doc = "Properties of the service tag information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of service tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of service tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The iteration number of service tag object for region."] + #[serde(rename = "serviceTagChangeNumber", default, skip_serializing_if = "Option::is_none")] + pub service_tag_change_number: Option, +} +impl ServiceTagInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for Get ServiceTagInformation API service call. Retrieves the list of service tag information resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceTagInformationListResult { + #[doc = "The list of service tag information resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ServiceTagInformationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the service tag information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceTagInformationPropertiesFormat { + #[doc = "The iteration number of service tag."] + #[serde(rename = "changeNumber", default, skip_serializing_if = "Option::is_none")] + pub change_number: Option, + #[doc = "The region of service tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[doc = "The name of system service."] + #[serde(rename = "systemService", default, skip_serializing_if = "Option::is_none")] + pub system_service: Option, + #[doc = "The list of IP address prefixes."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, + #[doc = "The state of the service tag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl ServiceTagInformationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListServiceTags API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceTagsListResult { + #[doc = "The name of the cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The azure resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The iteration number."] + #[serde(rename = "changeNumber", default, skip_serializing_if = "Option::is_none")] + pub change_number: Option, + #[doc = "The name of the cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cloud: Option, + #[doc = "The list of service tag information resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub values: Vec, + #[doc = "The URL to get next page of service tag information resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ServiceTagsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of session IDs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SessionIds { + #[doc = "List of session IDs."] + #[serde(rename = "sessionIds", default, skip_serializing_if = "Vec::is_empty")] + pub session_ids: Vec, +} +impl SessionIds { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the filter values possibles for a given column"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SignatureOverridesFilterValuesQuery { + #[doc = "Describes the name of the column which values will be returned"] + #[serde(rename = "filterName", default, skip_serializing_if = "Option::is_none")] + pub filter_name: Option, +} +impl SignatureOverridesFilterValuesQuery { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes the list of all possible values for a specific filter value"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SignatureOverridesFilterValuesResponse { + #[doc = "Describes the possible values"] + #[serde(rename = "filterValues", default, skip_serializing_if = "Vec::is_empty")] + pub filter_values: Vec, +} +impl SignatureOverridesFilterValuesResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Signatures {} +impl Signatures { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains all specific policy signatures overrides for the IDPS"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SignaturesOverrides { + #[doc = "Contains the name of the resource (default)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Will contain the resource id of the signature override resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Will contain the properties of the resource (the actual signature overrides)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SignaturesOverrides { + pub fn new() -> Self { + Self::default() + } +} +pub mod signatures_overrides { + use super::*; + #[doc = "Will contain the properties of the resource (the actual signature overrides)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signatures: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Describes an object containing an array with a single item"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SignaturesOverridesList { + #[doc = "Describes a list consisting exactly one item describing the policy's signature override status"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SignaturesOverridesList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SingleQueryResult { + #[doc = "The ID of the signature"] + #[serde(rename = "signatureId", default, skip_serializing_if = "Option::is_none")] + pub signature_id: Option, + #[doc = "The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, + #[doc = "Describes the groups the signature belongs to"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub group: Option, + #[doc = "Describes what is the signature enforces"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Describes the protocol the signatures is being enforced in"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, + #[doc = "Describes the list of source ports related to this signature"] + #[serde(rename = "sourcePorts", default, skip_serializing_if = "Vec::is_empty")] + pub source_ports: Vec, + #[doc = "Describes the list of destination ports related to this signature"] + #[serde(rename = "destinationPorts", default, skip_serializing_if = "Vec::is_empty")] + pub destination_ports: Vec, + #[doc = "Describes the last updated time of the signature (provided from 3rd party vendor)"] + #[serde(rename = "lastUpdated", default, skip_serializing_if = "Option::is_none")] + pub last_updated: Option, + #[doc = "Describes if this override is inherited from base policy or not"] + #[serde(rename = "inheritedFromParentPolicy", default, skip_serializing_if = "Option::is_none")] + pub inherited_from_parent_policy: Option, +} +impl SingleQueryResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod single_query_result { + use super::*; + #[doc = "The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode {} + #[doc = "Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity {} + #[doc = "Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction {} +} +#[doc = "The sku of this Bastion Host."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Sku { + #[doc = "The name of this Bastion Host."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl Sku { + pub fn new() -> Self { + Self::default() + } +} +pub mod sku { + use super::*; + #[doc = "The name of this Bastion Host."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + Standard, + } + impl Default for Name { + fn default() -> Self { + Self::Standard + } + } +} +#[doc = "List of all Static Routes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StaticRoute { + #[doc = "The name of the StaticRoute that is unique within a VnetRoute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "List of all address prefixes."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, + #[doc = "The ip address of the next hop."] + #[serde(rename = "nextHopIpAddress", default, skip_serializing_if = "Option::is_none")] + pub next_hop_ip_address: Option, +} +impl StaticRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to another subresource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubResource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl SubResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subnet in a virtual network resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Subnet { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the subnet."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Subnet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subnet and it's custom security rules."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubnetAssociation { + #[doc = "Subnet ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Collection of custom security rules."] + #[serde(rename = "securityRules", default, skip_serializing_if = "Vec::is_empty")] + pub security_rules: Vec, +} +impl SubnetAssociation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubnetListResult { + #[doc = "The subnets in a virtual network."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SubnetListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the subnet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubnetPropertiesFormat { + #[doc = "The address prefix for the subnet."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "List of address prefixes for the subnet."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, + #[doc = "NetworkSecurityGroup resource."] + #[serde(rename = "networkSecurityGroup", default, skip_serializing_if = "Option::is_none")] + pub network_security_group: Option, + #[doc = "Route table resource."] + #[serde(rename = "routeTable", default, skip_serializing_if = "Option::is_none")] + pub route_table: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "natGateway", default, skip_serializing_if = "Option::is_none")] + pub nat_gateway: Option, + #[doc = "An array of service endpoints."] + #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Vec::is_empty")] + pub service_endpoints: Vec, + #[doc = "An array of service endpoint policies."] + #[serde(rename = "serviceEndpointPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub service_endpoint_policies: Vec, + #[doc = "An array of references to private endpoints."] + #[serde(rename = "privateEndpoints", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoints: Vec, + #[doc = "An array of references to the network interface IP configurations using subnet."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "Array of IP configuration profiles which reference this subnet."] + #[serde(rename = "ipConfigurationProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configuration_profiles: Vec, + #[doc = "Array of IpAllocation which reference this subnet."] + #[serde(rename = "ipAllocations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_allocations: Vec, + #[doc = "An array of references to the external resources using subnet."] + #[serde(rename = "resourceNavigationLinks", default, skip_serializing_if = "Vec::is_empty")] + pub resource_navigation_links: Vec, + #[doc = "An array of references to services injecting into this subnet."] + #[serde(rename = "serviceAssociationLinks", default, skip_serializing_if = "Vec::is_empty")] + pub service_association_links: Vec, + #[doc = "An array of references to the delegations on the subnet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub delegations: Vec, + #[doc = "A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub purpose: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Enable or Disable apply network policies on private end point in the subnet."] + #[serde(rename = "privateEndpointNetworkPolicies", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_network_policies: Option, + #[doc = "Enable or Disable apply network policies on private link service in the subnet."] + #[serde(rename = "privateLinkServiceNetworkPolicies", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_network_policies: Option, + #[doc = "Application gateway IP configurations of virtual network resource."] + #[serde(rename = "applicationGatewayIpConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateway_ip_configurations: Vec, +} +impl SubnetPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod subnet_properties_format { + use super::*; + #[doc = "Enable or Disable apply network policies on private end point in the subnet."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointNetworkPolicies { + Enabled, + Disabled, + } + impl Default for PrivateEndpointNetworkPolicies { + fn default() -> Self { + Self::Enabled + } + } + #[doc = "Enable or Disable apply network policies on private link service in the subnet."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateLinkServiceNetworkPolicies { + Enabled, + Disabled, + } + impl Default for PrivateLinkServiceNetworkPolicies { + fn default() -> Self { + Self::Enabled + } + } +} +#[doc = "Tags object for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsObject { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Topology of the specified resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Topology { + #[doc = "GUID representing the operation id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The datetime when the topology was initially created for the resource group."] + #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")] + pub created_date_time: Option, + #[doc = "The datetime when the topology was last modified."] + #[serde(rename = "lastModified", default, skip_serializing_if = "Option::is_none")] + pub last_modified: Option, + #[doc = "A list of topology resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, +} +impl Topology { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resources that have an association with the parent resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TopologyAssociation { + #[doc = "The name of the resource that is associated with the parent resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the resource that is associated with the parent resource."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "The association type of the child resource to the parent resource."] + #[serde(rename = "associationType", default, skip_serializing_if = "Option::is_none")] + pub association_type: Option, +} +impl TopologyAssociation { + pub fn new() -> Self { + Self::default() + } +} +pub mod topology_association { + use super::*; + #[doc = "The association type of the child resource to the parent resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AssociationType { + Associated, + Contains, + } +} +#[doc = "Parameters that define the representation of topology."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TopologyParameters { + #[doc = "The name of the target resource group to perform topology on."] + #[serde(rename = "targetResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_name: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "targetVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_network: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "targetSubnet", default, skip_serializing_if = "Option::is_none")] + pub target_subnet: Option, +} +impl TopologyParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The network resource topology information for the given resource group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TopologyResource { + #[doc = "Name of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "ID of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Holds the associations the resource has with other resources in the resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub associations: Vec, +} +impl TopologyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the configuration of traffic analytics."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TrafficAnalyticsConfigurationProperties { + #[doc = "Flag to enable/disable traffic analytics."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "The resource guid of the attached workspace."] + #[serde(rename = "workspaceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_id: Option, + #[doc = "The location of the attached workspace."] + #[serde(rename = "workspaceRegion", default, skip_serializing_if = "Option::is_none")] + pub workspace_region: Option, + #[doc = "Resource Id of the attached workspace."] + #[serde(rename = "workspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_resource_id: Option, + #[doc = "The interval in minutes which would decide how frequently TA service should do flow analytics."] + #[serde(rename = "trafficAnalyticsInterval", default, skip_serializing_if = "Option::is_none")] + pub traffic_analytics_interval: Option, +} +impl TrafficAnalyticsConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the configuration of traffic analytics."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TrafficAnalyticsProperties { + #[doc = "Parameters that define the configuration of traffic analytics."] + #[serde( + rename = "networkWatcherFlowAnalyticsConfiguration", + default, + skip_serializing_if = "Option::is_none" + )] + pub network_watcher_flow_analytics_configuration: Option, +} +impl TrafficAnalyticsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An traffic selector policy for a virtual network gateway connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrafficSelectorPolicy { + #[doc = "A collection of local address spaces in CIDR format."] + #[serde(rename = "localAddressRanges")] + pub local_address_ranges: Vec, + #[doc = "A collection of remote address spaces in CIDR format."] + #[serde(rename = "remoteAddressRanges")] + pub remote_address_ranges: Vec, +} +impl TrafficSelectorPolicy { + pub fn new(local_address_ranges: Vec, remote_address_ranges: Vec) -> Self { + Self { + local_address_ranges, + remote_address_ranges, + } + } +} +#[doc = "Transforms applied before matching."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Transform { + Lowercase, + Trim, + UrlDecode, + UrlEncode, + RemoveNulls, + HtmlEntityDecode, +} +#[doc = "The transport protocol for the endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TransportProtocol { + Udp, + Tcp, + All, +} +#[doc = "Information gained from troubleshooting of specified resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TroubleshootingDetails { + #[doc = "The id of the get troubleshoot operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Reason type of failure."] + #[serde(rename = "reasonType", default, skip_serializing_if = "Option::is_none")] + pub reason_type: Option, + #[doc = "A summary of troubleshooting."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[doc = "Details on troubleshooting results."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub detail: Option, + #[doc = "List of recommended actions."] + #[serde(rename = "recommendedActions", default, skip_serializing_if = "Vec::is_empty")] + pub recommended_actions: Vec, +} +impl TroubleshootingDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the resource to troubleshoot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TroubleshootingParameters { + #[doc = "The target resource to troubleshoot."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "Storage location provided for troubleshoot."] + pub properties: TroubleshootingProperties, +} +impl TroubleshootingParameters { + pub fn new(target_resource_id: String, properties: TroubleshootingProperties) -> Self { + Self { + target_resource_id, + properties, + } + } +} +#[doc = "Storage location provided for troubleshoot."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TroubleshootingProperties { + #[doc = "The ID for the storage account to save the troubleshoot result."] + #[serde(rename = "storageId")] + pub storage_id: String, + #[doc = "The path to the blob to save the troubleshoot result in."] + #[serde(rename = "storagePath")] + pub storage_path: String, +} +impl TroubleshootingProperties { + pub fn new(storage_id: String, storage_path: String) -> Self { + Self { storage_id, storage_path } + } +} +#[doc = "Recommended actions based on discovered issues."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TroubleshootingRecommendedActions { + #[doc = "ID of the recommended action."] + #[serde(rename = "actionId", default, skip_serializing_if = "Option::is_none")] + pub action_id: Option, + #[doc = "Description of recommended actions."] + #[serde(rename = "actionText", default, skip_serializing_if = "Option::is_none")] + pub action_text: Option, + #[doc = "The uri linking to a documentation for the recommended troubleshooting actions."] + #[serde(rename = "actionUri", default, skip_serializing_if = "Option::is_none")] + pub action_uri: Option, + #[doc = "The information from the URI for the recommended troubleshooting actions."] + #[serde(rename = "actionUriText", default, skip_serializing_if = "Option::is_none")] + pub action_uri_text: Option, +} +impl TroubleshootingRecommendedActions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Troubleshooting information gained from specified resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TroubleshootingResult { + #[doc = "The start time of the troubleshooting."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time of the troubleshooting."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The result code of the troubleshooting."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Information from troubleshooting."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub results: Vec, +} +impl TroubleshootingResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualNetworkGatewayConnection properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TunnelConnectionHealth { + #[doc = "Tunnel name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tunnel: Option, + #[doc = "Virtual Network Gateway connection status."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "The Ingress Bytes Transferred in this connection."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "The Egress Bytes Transferred in this connection."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "The time at which connection was established in Utc format."] + #[serde(rename = "lastConnectionEstablishedUtcTime", default, skip_serializing_if = "Option::is_none")] + pub last_connection_established_utc_time: Option, +} +impl TunnelConnectionHealth { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current state of the tunnel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TunnelConnectionStatus { + Unknown, + Connecting, + Connected, + NotConnected, +} +#[doc = "Details of UnprepareNetworkPolicies for Subnet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnprepareNetworkPoliciesRequest { + #[doc = "The name of the service for which subnet is being unprepared for."] + #[serde(rename = "serviceName", default, skip_serializing_if = "Option::is_none")] + pub service_name: Option, +} +impl UnprepareNetworkPoliciesRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The network resource usage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Usage { + #[doc = "Resource identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "An enum describing the unit of measurement."] + pub unit: usage::Unit, + #[doc = "The current value of the usage."] + #[serde(rename = "currentValue")] + pub current_value: i64, + #[doc = "The limit of usage."] + pub limit: i64, + #[doc = "The usage names."] + pub name: UsageName, +} +impl Usage { + pub fn new(unit: usage::Unit, current_value: i64, limit: i64, name: UsageName) -> Self { + Self { + id: None, + unit, + current_value, + limit, + name, + } + } +} +pub mod usage { + use super::*; + #[doc = "An enum describing the unit of measurement."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + } +} +#[doc = "The usage names."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UsageName { + #[doc = "A string describing the resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "A localized string describing the resource name."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +impl UsageName { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The list usages operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UsagesListResult { + #[doc = "The list network resource usages."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UsagesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Describes a Virtual Machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Vm { + #[serde(flatten)] + pub resource: Resource, +} +impl Vm { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the IP flow to be verified."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VerificationIpFlowParameters { + #[doc = "The ID of the target resource to perform next-hop on."] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "The direction of the traffic."] + pub direction: Direction, + #[doc = "Protocol to be verified on."] + pub protocol: verification_ip_flow_parameters::Protocol, + #[doc = "The local port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction."] + #[serde(rename = "localPort")] + pub local_port: String, + #[doc = "The remote port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction."] + #[serde(rename = "remotePort")] + pub remote_port: String, + #[doc = "The local IP address. Acceptable values are valid IPv4 addresses."] + #[serde(rename = "localIPAddress")] + pub local_ip_address: String, + #[doc = "The remote IP address. Acceptable values are valid IPv4 addresses."] + #[serde(rename = "remoteIPAddress")] + pub remote_ip_address: String, + #[doc = "The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of them, then this parameter must be specified. Otherwise optional)."] + #[serde(rename = "targetNicResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_nic_resource_id: Option, +} +impl VerificationIpFlowParameters { + pub fn new( + target_resource_id: String, + direction: Direction, + protocol: verification_ip_flow_parameters::Protocol, + local_port: String, + remote_port: String, + local_ip_address: String, + remote_ip_address: String, + ) -> Self { + Self { + target_resource_id, + direction, + protocol, + local_port, + remote_port, + local_ip_address, + remote_ip_address, + target_nic_resource_id: None, + } + } +} +pub mod verification_ip_flow_parameters { + use super::*; + #[doc = "Protocol to be verified on."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + } +} +#[doc = "Results of IP flow verification on the target resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VerificationIpFlowResult { + #[doc = "Access to be allowed or denied."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub access: Option, + #[doc = "Name of the rule. If input is not matched against any security rule, it is not displayed."] + #[serde(rename = "ruleName", default, skip_serializing_if = "Option::is_none")] + pub rule_name: Option, +} +impl VerificationIpFlowResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Virtual Appliance NIC properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualApplianceNicProperties { + #[doc = "NIC name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Public IP address."] + #[serde(rename = "publicIpAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "Private IP address."] + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, +} +impl VirtualApplianceNicProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Appliance Site resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualApplianceSite { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the rule group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the virtual appliance site."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Site type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualApplianceSite { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the rule group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualApplianceSiteProperties { + #[doc = "Address Prefix."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "Network Virtual Appliance Sku Properties."] + #[serde(rename = "o365Policy", default, skip_serializing_if = "Option::is_none")] + pub o365_policy: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualApplianceSiteProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Virtual Appliance Sku Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualApplianceSkuProperties { + #[doc = "Virtual Appliance Vendor."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vendor: Option, + #[doc = "Virtual Appliance Scale Unit."] + #[serde(rename = "bundledScaleUnit", default, skip_serializing_if = "Option::is_none")] + pub bundled_scale_unit: Option, + #[doc = "Virtual Appliance Version."] + #[serde(rename = "marketPlaceVersion", default, skip_serializing_if = "Option::is_none")] + pub market_place_version: Option, +} +impl VirtualApplianceSkuProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHub Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualHub { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for VirtualHub."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, +} +impl VirtualHub { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + kind: None, + } + } +} +#[doc = "The effective route configured on the virtual hub or specified resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubEffectiveRoute { + #[doc = "The list of address prefixes."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, + #[doc = "The list of next hops."] + #[serde(rename = "nextHops", default, skip_serializing_if = "Vec::is_empty")] + pub next_hops: Vec, + #[doc = "The type of the next hop."] + #[serde(rename = "nextHopType", default, skip_serializing_if = "Option::is_none")] + pub next_hop_type: Option, + #[doc = "The ASPath of this route."] + #[serde(rename = "asPath", default, skip_serializing_if = "Option::is_none")] + pub as_path: Option, + #[doc = "The origin of this route."] + #[serde(rename = "routeOrigin", default, skip_serializing_if = "Option::is_none")] + pub route_origin: Option, +} +impl VirtualHubEffectiveRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "EffectiveRoutes List."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubEffectiveRouteList { + #[doc = "The list of effective routes configured on the virtual hub or the specified resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl VirtualHubEffectiveRouteList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Hub identifier."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubId { + #[doc = "The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same subscription."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl VirtualHubId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VirtualHub."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualWan", default, skip_serializing_if = "Option::is_none")] + pub virtual_wan: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "vpnGateway", default, skip_serializing_if = "Option::is_none")] + pub vpn_gateway: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "p2SVpnGateway", default, skip_serializing_if = "Option::is_none")] + pub p2_s_vpn_gateway: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "expressRouteGateway", default, skip_serializing_if = "Option::is_none")] + pub express_route_gateway: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "azureFirewall", default, skip_serializing_if = "Option::is_none")] + pub azure_firewall: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "securityPartnerProvider", default, skip_serializing_if = "Option::is_none")] + pub security_partner_provider: Option, + #[doc = "Address-prefix for this VirtualHub."] + #[serde(rename = "addressPrefix", default, skip_serializing_if = "Option::is_none")] + pub address_prefix: Option, + #[doc = "VirtualHub route table."] + #[serde(rename = "routeTable", default, skip_serializing_if = "Option::is_none")] + pub route_table: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Security Provider name."] + #[serde(rename = "securityProviderName", default, skip_serializing_if = "Option::is_none")] + pub security_provider_name: Option, + #[doc = "List of all virtual hub route table v2s associated with this VirtualHub."] + #[serde(rename = "virtualHubRouteTableV2s", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_hub_route_table_v2s: Vec, + #[doc = "The sku of this VirtualHub."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "The current routing state of the VirtualHub."] + #[serde(rename = "routingState", default, skip_serializing_if = "Option::is_none")] + pub routing_state: Option, + #[doc = "List of references to Bgp Connections."] + #[serde(rename = "bgpConnections", default, skip_serializing_if = "Vec::is_empty")] + pub bgp_connections: Vec, + #[doc = "List of references to IpConfigurations."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "VirtualRouter ASN."] + #[serde(rename = "virtualRouterAsn", default, skip_serializing_if = "Option::is_none")] + pub virtual_router_asn: Option, + #[doc = "VirtualRouter IPs."] + #[serde(rename = "virtualRouterIps", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_router_ips: Vec, + #[doc = "Flag to control transit for VirtualRouter hub."] + #[serde(rename = "allowBranchToBranchTraffic", default, skip_serializing_if = "Option::is_none")] + pub allow_branch_to_branch_traffic: Option, + #[doc = "The preferred routing gateway types"] + #[serde(rename = "preferredRoutingGateway", default, skip_serializing_if = "Option::is_none")] + pub preferred_routing_gateway: Option, + #[doc = "The hub routing preference gateway types"] + #[serde(rename = "hubRoutingPreference", default, skip_serializing_if = "Option::is_none")] + pub hub_routing_preference: Option, +} +impl VirtualHubProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHub route."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubRoute { + #[doc = "List of all addressPrefixes."] + #[serde(rename = "addressPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub address_prefixes: Vec, + #[doc = "NextHop ip address."] + #[serde(rename = "nextHopIpAddress", default, skip_serializing_if = "Option::is_none")] + pub next_hop_ip_address: Option, +} +impl VirtualHubRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHub route table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubRouteTable { + #[doc = "List of all routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub routes: Vec, +} +impl VirtualHubRouteTable { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHubRouteTableV2 Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubRouteTableV2 { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VirtualHubRouteTableV2."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualHubRouteTableV2 { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VirtualHubRouteTableV2."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubRouteTableV2Properties { + #[doc = "List of all routes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub routes: Vec, + #[doc = "List of all connections attached to this route table v2."] + #[serde(rename = "attachedConnections", default, skip_serializing_if = "Vec::is_empty")] + pub attached_connections: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualHubRouteTableV2Properties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualHubRouteTableV2 route."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualHubRouteV2 { + #[doc = "The type of destinations."] + #[serde(rename = "destinationType", default, skip_serializing_if = "Option::is_none")] + pub destination_type: Option, + #[doc = "List of all destinations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub destinations: Vec, + #[doc = "The type of next hops."] + #[serde(rename = "nextHopType", default, skip_serializing_if = "Option::is_none")] + pub next_hop_type: Option, + #[doc = "NextHops ip address."] + #[serde(rename = "nextHops", default, skip_serializing_if = "Vec::is_empty")] + pub next_hops: Vec, +} +impl VirtualHubRouteV2 { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Network resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetwork { + #[serde(flatten)] + pub resource: Resource, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "Properties of the virtual network."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetwork { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkBgpCommunities { + #[doc = "The BGP community associated with the virtual network."] + #[serde(rename = "virtualNetworkCommunity")] + pub virtual_network_community: String, + #[doc = "The BGP community associated with the region of the virtual network."] + #[serde(rename = "regionalCommunity", default, skip_serializing_if = "Option::is_none")] + pub regional_community: Option, +} +impl VirtualNetworkBgpCommunities { + pub fn new(virtual_network_community: String) -> Self { + Self { + virtual_network_community, + regional_community: None, + } + } +} +#[doc = "A reference to VirtualNetworkGateway or LocalNetworkGateway resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkConnectionGatewayReference { + #[doc = "The ID of VirtualNetworkGateway or LocalNetworkGateway resource."] + pub id: String, +} +impl VirtualNetworkConnectionGatewayReference { + pub fn new(id: String) -> Self { + Self { id } + } +} +#[doc = "Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkEncryption { + #[doc = "Indicates if encryption is enabled on the virtual network."] + pub enabled: bool, + #[doc = "If the encrypted VNet allows VM that does not support encryption"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enforcement: Option, +} +impl VirtualNetworkEncryption { + pub fn new(enabled: bool) -> Self { + Self { + enabled, + enforcement: None, + } + } +} +pub mod virtual_network_encryption { + use super::*; + #[doc = "If the encrypted VNet allows VM that does not support encryption"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Enforcement { + DropUnencrypted, + AllowUnencrypted, + } +} +#[doc = "A common class for general resource information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "VirtualNetworkGateway properties."] + pub properties: VirtualNetworkGatewayPropertiesFormat, + #[doc = "ExtendedLocation complex type."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetworkGateway { + pub fn new(properties: VirtualNetworkGatewayPropertiesFormat) -> Self { + Self { + resource: Resource::default(), + properties, + extended_location: None, + etag: None, + } + } +} +#[doc = "A common class for general resource information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkGatewayConnection { + #[serde(flatten)] + pub resource: Resource, + #[doc = "VirtualNetworkGatewayConnection properties."] + pub properties: VirtualNetworkGatewayConnectionPropertiesFormat, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetworkGatewayConnection { + pub fn new(properties: VirtualNetworkGatewayConnectionPropertiesFormat) -> Self { + Self { + resource: Resource::default(), + properties, + etag: None, + } + } +} +#[doc = "A common class for general resource information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkGatewayConnectionListEntity { + #[serde(flatten)] + pub resource: Resource, + #[doc = "VirtualNetworkGatewayConnection properties."] + pub properties: VirtualNetworkGatewayConnectionListEntityPropertiesFormat, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetworkGatewayConnectionListEntity { + pub fn new(properties: VirtualNetworkGatewayConnectionListEntityPropertiesFormat) -> Self { + Self { + resource: Resource::default(), + properties, + etag: None, + } + } +} +#[doc = "VirtualNetworkGatewayConnection properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkGatewayConnectionListEntityPropertiesFormat { + #[doc = "The authorizationKey."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "A reference to VirtualNetworkGateway or LocalNetworkGateway resource."] + #[serde(rename = "virtualNetworkGateway1")] + pub virtual_network_gateway1: VirtualNetworkConnectionGatewayReference, + #[doc = "A reference to VirtualNetworkGateway or LocalNetworkGateway resource."] + #[serde(rename = "virtualNetworkGateway2", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_gateway2: Option, + #[doc = "A reference to VirtualNetworkGateway or LocalNetworkGateway resource."] + #[serde(rename = "localNetworkGateway2", default, skip_serializing_if = "Option::is_none")] + pub local_network_gateway2: Option, + #[doc = "Gateway connection type."] + #[serde(rename = "connectionType")] + pub connection_type: VirtualNetworkGatewayConnectionType, + #[doc = "Gateway connection protocol."] + #[serde(rename = "connectionProtocol", default, skip_serializing_if = "Option::is_none")] + pub connection_protocol: Option, + #[doc = "The routing weight."] + #[serde(rename = "routingWeight", default, skip_serializing_if = "Option::is_none")] + pub routing_weight: Option, + #[doc = "Gateway connection type."] + #[serde(rename = "connectionMode", default, skip_serializing_if = "Option::is_none")] + pub connection_mode: Option, + #[doc = "The IPSec shared key."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "Virtual Network Gateway connection status."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Collection of all tunnels' connection health status."] + #[serde(rename = "tunnelConnectionStatus", default, skip_serializing_if = "Vec::is_empty")] + pub tunnel_connection_status: Vec, + #[doc = "The egress bytes transferred in this connection."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "The ingress bytes transferred in this connection."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub peer: Option, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableBgp", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp: Option, + #[doc = "GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection."] + #[serde(rename = "gatewayCustomBgpIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub gateway_custom_bgp_ip_addresses: Vec, + #[doc = "Enable policy-based traffic selectors."] + #[serde(rename = "usePolicyBasedTrafficSelectors", default, skip_serializing_if = "Option::is_none")] + pub use_policy_based_traffic_selectors: Option, + #[doc = "The IPSec Policies to be considered by this connection."] + #[serde(rename = "ipsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub ipsec_policies: Vec, + #[doc = "The Traffic Selector Policies to be considered by this connection."] + #[serde(rename = "trafficSelectorPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub traffic_selector_policies: Vec, + #[doc = "The resource GUID property of the virtual network gateway connection resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Bypass ExpressRoute Gateway for data forwarding."] + #[serde(rename = "expressRouteGatewayBypass", default, skip_serializing_if = "Option::is_none")] + pub express_route_gateway_bypass: Option, +} +impl VirtualNetworkGatewayConnectionListEntityPropertiesFormat { + pub fn new( + virtual_network_gateway1: VirtualNetworkConnectionGatewayReference, + connection_type: VirtualNetworkGatewayConnectionType, + ) -> Self { + Self { + authorization_key: None, + virtual_network_gateway1, + virtual_network_gateway2: None, + local_network_gateway2: None, + connection_type, + connection_protocol: None, + routing_weight: None, + connection_mode: None, + shared_key: None, + connection_status: None, + tunnel_connection_status: Vec::new(), + egress_bytes_transferred: None, + ingress_bytes_transferred: None, + peer: None, + enable_bgp: None, + gateway_custom_bgp_ip_addresses: Vec::new(), + use_policy_based_traffic_selectors: None, + ipsec_policies: Vec::new(), + traffic_selector_policies: Vec::new(), + resource_guid: None, + provisioning_state: None, + express_route_gateway_bypass: None, + } + } +} +#[doc = "Response for the ListVirtualNetworkGatewayConnections API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayConnectionListResult { + #[doc = "A list of VirtualNetworkGatewayConnection resources that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkGatewayConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gateway connection type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum VirtualNetworkGatewayConnectionMode { + Default, + ResponderOnly, + InitiatorOnly, +} +#[doc = "VirtualNetworkGatewayConnection properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkGatewayConnectionPropertiesFormat { + #[doc = "The authorizationKey."] + #[serde(rename = "authorizationKey", default, skip_serializing_if = "Option::is_none")] + pub authorization_key: Option, + #[doc = "A common class for general resource information."] + #[serde(rename = "virtualNetworkGateway1")] + pub virtual_network_gateway1: VirtualNetworkGateway, + #[doc = "A common class for general resource information."] + #[serde(rename = "virtualNetworkGateway2", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_gateway2: Option, + #[doc = "A common class for general resource information."] + #[serde(rename = "localNetworkGateway2", default, skip_serializing_if = "Option::is_none")] + pub local_network_gateway2: Option, + #[doc = "List of ingress NatRules."] + #[serde(rename = "ingressNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub ingress_nat_rules: Vec, + #[doc = "List of egress NatRules."] + #[serde(rename = "egressNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub egress_nat_rules: Vec, + #[doc = "Gateway connection type."] + #[serde(rename = "connectionType")] + pub connection_type: VirtualNetworkGatewayConnectionType, + #[doc = "Gateway connection protocol."] + #[serde(rename = "connectionProtocol", default, skip_serializing_if = "Option::is_none")] + pub connection_protocol: Option, + #[doc = "The routing weight."] + #[serde(rename = "routingWeight", default, skip_serializing_if = "Option::is_none")] + pub routing_weight: Option, + #[doc = "The dead peer detection timeout of this connection in seconds."] + #[serde(rename = "dpdTimeoutSeconds", default, skip_serializing_if = "Option::is_none")] + pub dpd_timeout_seconds: Option, + #[doc = "Gateway connection type."] + #[serde(rename = "connectionMode", default, skip_serializing_if = "Option::is_none")] + pub connection_mode: Option, + #[doc = "The IPSec shared key."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "Virtual Network Gateway connection status."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Collection of all tunnels' connection health status."] + #[serde(rename = "tunnelConnectionStatus", default, skip_serializing_if = "Vec::is_empty")] + pub tunnel_connection_status: Vec, + #[doc = "The egress bytes transferred in this connection."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "The ingress bytes transferred in this connection."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub peer: Option, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableBgp", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp: Option, + #[doc = "GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection."] + #[serde(rename = "gatewayCustomBgpIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub gateway_custom_bgp_ip_addresses: Vec, + #[doc = "Use private local Azure IP for the connection."] + #[serde(rename = "useLocalAzureIpAddress", default, skip_serializing_if = "Option::is_none")] + pub use_local_azure_ip_address: Option, + #[doc = "Enable policy-based traffic selectors."] + #[serde(rename = "usePolicyBasedTrafficSelectors", default, skip_serializing_if = "Option::is_none")] + pub use_policy_based_traffic_selectors: Option, + #[doc = "The IPSec Policies to be considered by this connection."] + #[serde(rename = "ipsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub ipsec_policies: Vec, + #[doc = "The Traffic Selector Policies to be considered by this connection."] + #[serde(rename = "trafficSelectorPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub traffic_selector_policies: Vec, + #[doc = "The resource GUID property of the virtual network gateway connection resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Bypass ExpressRoute Gateway for data forwarding."] + #[serde(rename = "expressRouteGatewayBypass", default, skip_serializing_if = "Option::is_none")] + pub express_route_gateway_bypass: Option, +} +impl VirtualNetworkGatewayConnectionPropertiesFormat { + pub fn new(virtual_network_gateway1: VirtualNetworkGateway, connection_type: VirtualNetworkGatewayConnectionType) -> Self { + Self { + authorization_key: None, + virtual_network_gateway1, + virtual_network_gateway2: None, + local_network_gateway2: None, + ingress_nat_rules: Vec::new(), + egress_nat_rules: Vec::new(), + connection_type, + connection_protocol: None, + routing_weight: None, + dpd_timeout_seconds: None, + connection_mode: None, + shared_key: None, + connection_status: None, + tunnel_connection_status: Vec::new(), + egress_bytes_transferred: None, + ingress_bytes_transferred: None, + peer: None, + enable_bgp: None, + gateway_custom_bgp_ip_addresses: Vec::new(), + use_local_azure_ip_address: None, + use_policy_based_traffic_selectors: None, + ipsec_policies: Vec::new(), + traffic_selector_policies: Vec::new(), + resource_guid: None, + provisioning_state: None, + express_route_gateway_bypass: None, + } + } +} +#[doc = "Virtual Network Gateway connection status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum VirtualNetworkGatewayConnectionStatus { + Unknown, + Connecting, + Connected, + NotConnected, +} +#[doc = "Gateway connection type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum VirtualNetworkGatewayConnectionType { + IPsec, + Vnet2Vnet, + ExpressRoute, + #[serde(rename = "VPNClient")] + VpnClient, +} +#[doc = "IP configuration for virtual network gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayIpConfiguration { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of VirtualNetworkGatewayIPConfiguration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetworkGatewayIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of VirtualNetworkGatewayIPConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayIpConfigurationPropertiesFormat { + #[doc = "IP address allocation method."] + #[serde(rename = "privateIPAllocationMethod", default, skip_serializing_if = "Option::is_none")] + pub private_ip_allocation_method: Option, + #[doc = "Reference to another subresource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "publicIPAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "Private IP Address for this gateway."] + #[serde(rename = "privateIPAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualNetworkGatewayIpConfigurationPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the VirtualNetworkGatewayListConnections API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayListConnectionsResult { + #[doc = "A list of VirtualNetworkGatewayConnection resources that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkGatewayListConnectionsResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListVirtualNetworkGateways API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayListResult { + #[doc = "A list of VirtualNetworkGateway resources that exists in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkGatewayListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualNetworkGatewayNatRule Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayNatRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VirtualNetworkGatewayNatRule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualNetworkGatewayNatRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VirtualNetworkGatewayNatRule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayNatRuleProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The type of NAT rule for VPN NAT."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The Source NAT direction of a VPN NAT."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "The private IP address internal mapping for NAT."] + #[serde(rename = "internalMappings", default, skip_serializing_if = "Vec::is_empty")] + pub internal_mappings: Vec, + #[doc = "The private IP address external mapping for NAT."] + #[serde(rename = "externalMappings", default, skip_serializing_if = "Vec::is_empty")] + pub external_mappings: Vec, + #[doc = "The IP Configuration ID this NAT rule applies to."] + #[serde(rename = "ipConfigurationId", default, skip_serializing_if = "Option::is_none")] + pub ip_configuration_id: Option, +} +impl VirtualNetworkGatewayNatRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_network_gateway_nat_rule_properties { + use super::*; + #[doc = "The type of NAT rule for VPN NAT."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Static, + Dynamic, + } + #[doc = "The Source NAT direction of a VPN NAT."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + EgressSnat, + IngressSnat, + } +} +#[doc = "VirtualNetworkGateway properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewayPropertiesFormat { + #[doc = "IP configurations for virtual network gateway."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "The type of this virtual network gateway."] + #[serde(rename = "gatewayType", default, skip_serializing_if = "Option::is_none")] + pub gateway_type: Option, + #[doc = "The type of this virtual network gateway."] + #[serde(rename = "vpnType", default, skip_serializing_if = "Option::is_none")] + pub vpn_type: Option, + #[doc = "The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN."] + #[serde(rename = "vpnGatewayGeneration", default, skip_serializing_if = "Option::is_none")] + pub vpn_gateway_generation: Option, + #[doc = "Whether BGP is enabled for this virtual network gateway or not."] + #[serde(rename = "enableBgp", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp: Option, + #[doc = "Whether private IP needs to be enabled on this gateway for connections or not."] + #[serde(rename = "enablePrivateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub enable_private_ip_address: Option, + #[doc = "ActiveActive flag."] + #[serde(rename = "activeActive", default, skip_serializing_if = "Option::is_none")] + pub active_active: Option, + #[doc = "disableIPSecReplayProtection flag."] + #[serde(rename = "disableIPSecReplayProtection", default, skip_serializing_if = "Option::is_none")] + pub disable_ip_sec_replay_protection: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "gatewayDefaultSite", default, skip_serializing_if = "Option::is_none")] + pub gateway_default_site: Option, + #[doc = "VirtualNetworkGatewaySku details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "VpnClientConfiguration for P2S client."] + #[serde(rename = "vpnClientConfiguration", default, skip_serializing_if = "Option::is_none")] + pub vpn_client_configuration: Option, + #[doc = "BGP settings details."] + #[serde(rename = "bgpSettings", default, skip_serializing_if = "Option::is_none")] + pub bgp_settings: Option, + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "customRoutes", default, skip_serializing_if = "Option::is_none")] + pub custom_routes: Option, + #[doc = "The resource GUID property of the virtual network gateway resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Whether dns forwarding is enabled or not."] + #[serde(rename = "enableDnsForwarding", default, skip_serializing_if = "Option::is_none")] + pub enable_dns_forwarding: Option, + #[doc = "The IP address allocated by the gateway to which dns requests can be sent."] + #[serde(rename = "inboundDnsForwardingEndpoint", default, skip_serializing_if = "Option::is_none")] + pub inbound_dns_forwarding_endpoint: Option, + #[doc = "Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet."] + #[serde(rename = "vNetExtendedLocationResourceId", default, skip_serializing_if = "Option::is_none")] + pub v_net_extended_location_resource_id: Option, + #[doc = "NatRules for virtual network gateway."] + #[serde(rename = "natRules", default, skip_serializing_if = "Vec::is_empty")] + pub nat_rules: Vec, + #[doc = "EnableBgpRouteTranslationForNat flag."] + #[serde(rename = "enableBgpRouteTranslationForNat", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp_route_translation_for_nat: Option, +} +impl VirtualNetworkGatewayPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_network_gateway_properties_format { + use super::*; + #[doc = "The type of this virtual network gateway."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum GatewayType { + Vpn, + ExpressRoute, + LocalGateway, + } + #[doc = "The type of this virtual network gateway."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VpnType { + PolicyBased, + RouteBased, + } + #[doc = "The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VpnGatewayGeneration { + None, + Generation1, + Generation2, + } +} +#[doc = "VirtualNetworkGatewaySku details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkGatewaySku { + #[doc = "Gateway SKU name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gateway SKU tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The capacity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl VirtualNetworkGatewaySku { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_network_gateway_sku { + use super::*; + #[doc = "Gateway SKU name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Basic, + HighPerformance, + Standard, + UltraPerformance, + VpnGw1, + VpnGw2, + VpnGw3, + VpnGw4, + VpnGw5, + #[serde(rename = "VpnGw1AZ")] + VpnGw1Az, + #[serde(rename = "VpnGw2AZ")] + VpnGw2Az, + #[serde(rename = "VpnGw3AZ")] + VpnGw3Az, + #[serde(rename = "VpnGw4AZ")] + VpnGw4Az, + #[serde(rename = "VpnGw5AZ")] + VpnGw5Az, + #[serde(rename = "ErGw1AZ")] + ErGw1Az, + #[serde(rename = "ErGw2AZ")] + ErGw2Az, + #[serde(rename = "ErGw3AZ")] + ErGw3Az, + } + #[doc = "Gateway SKU tier."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Basic, + HighPerformance, + Standard, + UltraPerformance, + VpnGw1, + VpnGw2, + VpnGw3, + VpnGw4, + VpnGw5, + #[serde(rename = "VpnGw1AZ")] + VpnGw1Az, + #[serde(rename = "VpnGw2AZ")] + VpnGw2Az, + #[serde(rename = "VpnGw3AZ")] + VpnGw3Az, + #[serde(rename = "VpnGw4AZ")] + VpnGw4Az, + #[serde(rename = "VpnGw5AZ")] + VpnGw5Az, + #[serde(rename = "ErGw1AZ")] + ErGw1Az, + #[serde(rename = "ErGw2AZ")] + ErGw2Az, + #[serde(rename = "ErGw3AZ")] + ErGw3Az, + } +} +#[doc = "Response for the ListVirtualNetworks API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkListResult { + #[doc = "A list of VirtualNetwork resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the virtual networks GetUsage API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkListUsageResult { + #[doc = "VirtualNetwork usage stats."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkListUsageResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Peerings in a virtual network resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkPeering { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the virtual network peering."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualNetworkPeering { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkPeeringListResult { + #[doc = "The peerings in a virtual network."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkPeeringListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the virtual network peering."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkPeeringPropertiesFormat { + #[doc = "Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space."] + #[serde(rename = "allowVirtualNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub allow_virtual_network_access: Option, + #[doc = "Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network."] + #[serde(rename = "allowForwardedTraffic", default, skip_serializing_if = "Option::is_none")] + pub allow_forwarded_traffic: Option, + #[doc = "If gateway links can be used in remote virtual networking to link to this virtual network."] + #[serde(rename = "allowGatewayTransit", default, skip_serializing_if = "Option::is_none")] + pub allow_gateway_transit: Option, + #[doc = "If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway."] + #[serde(rename = "useRemoteGateways", default, skip_serializing_if = "Option::is_none")] + pub use_remote_gateways: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "remoteVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub remote_virtual_network: Option, + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "remoteAddressSpace", default, skip_serializing_if = "Option::is_none")] + pub remote_address_space: Option, + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "remoteVirtualNetworkAddressSpace", default, skip_serializing_if = "Option::is_none")] + pub remote_virtual_network_address_space: Option, + #[doc = "Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET."] + #[serde(rename = "remoteBgpCommunities", default, skip_serializing_if = "Option::is_none")] + pub remote_bgp_communities: Option, + #[doc = "Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet."] + #[serde(rename = "remoteVirtualNetworkEncryption", default, skip_serializing_if = "Option::is_none")] + pub remote_virtual_network_encryption: Option, + #[doc = "The status of the virtual network peering."] + #[serde(rename = "peeringState", default, skip_serializing_if = "Option::is_none")] + pub peering_state: Option, + #[doc = "The peering sync status of the virtual network peering."] + #[serde(rename = "peeringSyncLevel", default, skip_serializing_if = "Option::is_none")] + pub peering_sync_level: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "If we need to verify the provisioning state of the remote gateway."] + #[serde(rename = "doNotVerifyRemoteGateways", default, skip_serializing_if = "Option::is_none")] + pub do_not_verify_remote_gateways: Option, + #[doc = "The resourceGuid property of the Virtual Network peering resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, +} +impl VirtualNetworkPeeringPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_network_peering_properties_format { + use super::*; + #[doc = "The status of the virtual network peering."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PeeringState { + Initiated, + Connected, + Disconnected, + } + #[doc = "The peering sync status of the virtual network peering."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PeeringSyncLevel { + FullyInSync, + RemoteNotInSync, + LocalNotInSync, + LocalAndRemoteNotInSync, + } +} +#[doc = "Properties of the virtual network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkPropertiesFormat { + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "addressSpace", default, skip_serializing_if = "Option::is_none")] + pub address_space: Option, + #[doc = "DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for a subnet overrides VNET DHCP options."] + #[serde(rename = "dhcpOptions", default, skip_serializing_if = "Option::is_none")] + pub dhcp_options: Option, + #[doc = "The FlowTimeout value (in minutes) for the Virtual Network"] + #[serde(rename = "flowTimeoutInMinutes", default, skip_serializing_if = "Option::is_none")] + pub flow_timeout_in_minutes: Option, + #[doc = "A list of subnets in a Virtual Network."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "A list of peerings in a Virtual Network."] + #[serde(rename = "virtualNetworkPeerings", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_peerings: Vec, + #[doc = "The resourceGuid property of the Virtual Network resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource."] + #[serde(rename = "enableDdosProtection", default, skip_serializing_if = "Option::is_none")] + pub enable_ddos_protection: Option, + #[doc = "Indicates if VM protection is enabled for all the subnets in the virtual network."] + #[serde(rename = "enableVmProtection", default, skip_serializing_if = "Option::is_none")] + pub enable_vm_protection: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "ddosProtectionPlan", default, skip_serializing_if = "Option::is_none")] + pub ddos_protection_plan: Option, + #[doc = "Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET."] + #[serde(rename = "bgpCommunities", default, skip_serializing_if = "Option::is_none")] + pub bgp_communities: Option, + #[doc = "Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "Array of IpAllocation which reference this VNET."] + #[serde(rename = "ipAllocations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_allocations: Vec, +} +impl VirtualNetworkPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Network Tap resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkTap { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Virtual Network Tap properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualNetworkTap { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListVirtualNetworkTap API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkTapListResult { + #[doc = "A list of VirtualNetworkTaps in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkTapListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Network Tap properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkTapPropertiesFormat { + #[doc = "Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped."] + #[serde(rename = "networkInterfaceTapConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub network_interface_tap_configurations: Vec, + #[doc = "The resource GUID property of the virtual network tap resource."] + #[serde(rename = "resourceGuid", default, skip_serializing_if = "Option::is_none")] + pub resource_guid: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "IPConfiguration in a network interface."] + #[serde( + rename = "destinationNetworkInterfaceIPConfiguration", + default, + skip_serializing_if = "Option::is_none" + )] + pub destination_network_interface_ip_configuration: Option, + #[doc = "Frontend IP address of the load balancer."] + #[serde( + rename = "destinationLoadBalancerFrontEndIPConfiguration", + default, + skip_serializing_if = "Option::is_none" + )] + pub destination_load_balancer_front_end_ip_configuration: Option, + #[doc = "The VXLAN destination port that will receive the tapped traffic."] + #[serde(rename = "destinationPort", default, skip_serializing_if = "Option::is_none")] + pub destination_port: Option, +} +impl VirtualNetworkTapPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Usage details for subnet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkUsage { + #[doc = "Indicates number of IPs used from the Subnet."] + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[doc = "Subnet identifier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Indicates the size of the subnet."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "Usage strings container."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Usage units. Returns 'Count'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, +} +impl VirtualNetworkUsage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Usage strings container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkUsageName { + #[doc = "Localized subnet size and usage string."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, + #[doc = "Subnet size and usage string."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl VirtualNetworkUsageName { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualRouter Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouter { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Virtual Router definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualRouter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListVirtualRouters API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouterListResult { + #[doc = "List of Virtual Routers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualRouterListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Router Peering resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouterPeering { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the rule group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Name of the virtual router peering that is unique within a virtual router."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Peering type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualRouterPeering { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for ListVirtualRouterPeerings API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouterPeeringListResult { + #[doc = "List of VirtualRouterPeerings in a VirtualRouter."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualRouterPeeringListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the rule group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouterPeeringProperties { + #[doc = "Peer ASN."] + #[serde(rename = "peerAsn", default, skip_serializing_if = "Option::is_none")] + pub peer_asn: Option, + #[doc = "Peer IP."] + #[serde(rename = "peerIp", default, skip_serializing_if = "Option::is_none")] + pub peer_ip: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualRouterPeeringProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Router definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualRouterPropertiesFormat { + #[doc = "VirtualRouter ASN."] + #[serde(rename = "virtualRouterAsn", default, skip_serializing_if = "Option::is_none")] + pub virtual_router_asn: Option, + #[doc = "VirtualRouter IPs."] + #[serde(rename = "virtualRouterIps", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_router_ips: Vec, + #[doc = "Reference to another subresource."] + #[serde(rename = "hostedSubnet", default, skip_serializing_if = "Option::is_none")] + pub hosted_subnet: Option, + #[doc = "Reference to another subresource."] + #[serde(rename = "hostedGateway", default, skip_serializing_if = "Option::is_none")] + pub hosted_gateway: Option, + #[doc = "List of references to VirtualRouterPeerings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub peerings: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualRouterPropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VirtualWAN Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualWan { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for VirtualWAN."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VirtualWan { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + } + } +} +#[doc = "Parameters for VirtualWAN."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualWanProperties { + #[doc = "Vpn encryption to be disabled or not."] + #[serde(rename = "disableVpnEncryption", default, skip_serializing_if = "Option::is_none")] + pub disable_vpn_encryption: Option, + #[doc = "List of VirtualHubs in the VirtualWAN."] + #[serde(rename = "virtualHubs", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_hubs: Vec, + #[doc = "List of VpnSites in the VirtualWAN."] + #[serde(rename = "vpnSites", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_sites: Vec, + #[doc = "True if branch to branch traffic is allowed."] + #[serde(rename = "allowBranchToBranchTraffic", default, skip_serializing_if = "Option::is_none")] + pub allow_branch_to_branch_traffic: Option, + #[doc = "True if Vnet to Vnet traffic is allowed."] + #[serde(rename = "allowVnetToVnetTraffic", default, skip_serializing_if = "Option::is_none")] + pub allow_vnet_to_vnet_traffic: Option, + #[doc = "The office traffic category."] + #[serde(rename = "office365LocalBreakoutCategory", default, skip_serializing_if = "Option::is_none")] + pub office365_local_breakout_category: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The type of the VirtualWAN."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualWanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of SecurityProviders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualWanSecurityProvider { + #[doc = "Name of the security provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Url of the security provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The virtual wan security provider type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VirtualWanSecurityProvider { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The virtual wan security provider type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum VirtualWanSecurityProviderType { + External, + Native, +} +#[doc = "Collection of SecurityProviders."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualWanSecurityProviders { + #[doc = "List of VirtualWAN security providers."] + #[serde(rename = "supportedProviders", default, skip_serializing_if = "Vec::is_empty")] + pub supported_providers: Vec, +} +impl VirtualWanSecurityProviders { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Virtual Wan Vpn profile parameters Vpn profile generation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualWanVpnProfileParameters { + #[doc = "VpnServerConfiguration partial resource uri with which VirtualWan is associated to."] + #[serde(rename = "vpnServerConfigurationResourceId", default, skip_serializing_if = "Option::is_none")] + pub vpn_server_configuration_resource_id: Option, + #[doc = "VPN client authentication method."] + #[serde(rename = "authenticationMethod", default, skip_serializing_if = "Option::is_none")] + pub authentication_method: Option, +} +impl VirtualWanVpnProfileParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of routes that control routing from VirtualHub into a virtual network connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VnetRoute { + #[doc = "List of all Static Routes."] + #[serde(rename = "staticRoutes", default, skip_serializing_if = "Vec::is_empty")] + pub static_routes: Vec, + #[doc = "The list of references to HubBgpConnection objects."] + #[serde(rename = "bgpConnections", default, skip_serializing_if = "Vec::is_empty")] + pub bgp_connections: Vec, +} +impl VnetRoute { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnClientConfiguration for P2S client."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientConfiguration { + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "vpnClientAddressPool", default, skip_serializing_if = "Option::is_none")] + pub vpn_client_address_pool: Option, + #[doc = "VpnClientRootCertificate for virtual network gateway."] + #[serde(rename = "vpnClientRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_root_certificates: Vec, + #[doc = "VpnClientRevokedCertificate for Virtual network gateway."] + #[serde(rename = "vpnClientRevokedCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_revoked_certificates: Vec, + #[doc = "VpnClientProtocols for Virtual network gateway."] + #[serde(rename = "vpnClientProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_protocols: Vec, + #[doc = "VPN authentication types for the virtual network gateway.."] + #[serde(rename = "vpnAuthenticationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_authentication_types: Vec, + #[doc = "VpnClientIpsecPolicies for virtual network gateway P2S client."] + #[serde(rename = "vpnClientIpsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_ipsec_policies: Vec, + #[doc = "The radius server address property of the VirtualNetworkGateway resource for vpn client connection."] + #[serde(rename = "radiusServerAddress", default, skip_serializing_if = "Option::is_none")] + pub radius_server_address: Option, + #[doc = "The radius secret property of the VirtualNetworkGateway resource for vpn client connection."] + #[serde(rename = "radiusServerSecret", default, skip_serializing_if = "Option::is_none")] + pub radius_server_secret: Option, + #[doc = "The radiusServers property for multiple radius server configuration."] + #[serde(rename = "radiusServers", default, skip_serializing_if = "Vec::is_empty")] + pub radius_servers: Vec, + #[doc = "The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication."] + #[serde(rename = "aadTenant", default, skip_serializing_if = "Option::is_none")] + pub aad_tenant: Option, + #[doc = "The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication."] + #[serde(rename = "aadAudience", default, skip_serializing_if = "Option::is_none")] + pub aad_audience: Option, + #[doc = "The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication."] + #[serde(rename = "aadIssuer", default, skip_serializing_if = "Option::is_none")] + pub aad_issuer: Option, +} +impl VpnClientConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnClientConnectionHealth properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientConnectionHealth { + #[doc = "Total of the Ingress Bytes Transferred in this P2S Vpn connection."] + #[serde(rename = "totalIngressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_ingress_bytes_transferred: Option, + #[doc = "Total of the Egress Bytes Transferred in this connection."] + #[serde(rename = "totalEgressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_egress_bytes_transferred: Option, + #[doc = "The total of p2s vpn clients connected at this time to this P2SVpnGateway."] + #[serde(rename = "vpnClientConnectionsCount", default, skip_serializing_if = "Option::is_none")] + pub vpn_client_connections_count: Option, + #[doc = "List of allocated ip addresses to the connected p2s vpn clients."] + #[serde(rename = "allocatedIpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub allocated_ip_addresses: Vec, +} +impl VpnClientConnectionHealth { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VPN client connection health detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientConnectionHealthDetail { + #[doc = "The vpn client Id."] + #[serde(rename = "vpnConnectionId", default, skip_serializing_if = "Option::is_none")] + pub vpn_connection_id: Option, + #[doc = "The duration time of a connected vpn client."] + #[serde(rename = "vpnConnectionDuration", default, skip_serializing_if = "Option::is_none")] + pub vpn_connection_duration: Option, + #[doc = "The start time of a connected vpn client."] + #[serde(rename = "vpnConnectionTime", default, skip_serializing_if = "Option::is_none")] + pub vpn_connection_time: Option, + #[doc = "The public Ip of a connected vpn client."] + #[serde(rename = "publicIpAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "The assigned private Ip of a connected vpn client."] + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, + #[doc = "The user name of a connected vpn client."] + #[serde(rename = "vpnUserName", default, skip_serializing_if = "Option::is_none")] + pub vpn_user_name: Option, + #[doc = "The max band width."] + #[serde(rename = "maxBandwidth", default, skip_serializing_if = "Option::is_none")] + pub max_bandwidth: Option, + #[doc = "The egress packets per second."] + #[serde(rename = "egressPacketsTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_packets_transferred: Option, + #[doc = "The egress bytes per second."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "The ingress packets per second."] + #[serde(rename = "ingressPacketsTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_packets_transferred: Option, + #[doc = "The ingress bytes per second."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "The max packets transferred per second."] + #[serde(rename = "maxPacketsPerSecond", default, skip_serializing_if = "Option::is_none")] + pub max_packets_per_second: Option, +} +impl VpnClientConnectionHealthDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of virtual network gateway vpn client connection health."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientConnectionHealthDetailListResult { + #[doc = "List of vpn client connection health."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl VpnClientConnectionHealthDetailListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An IPSec parameters for a virtual network gateway P2S connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VpnClientIPsecParameters { + #[doc = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client."] + #[serde(rename = "saLifeTimeSeconds")] + pub sa_life_time_seconds: i32, + #[doc = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.."] + #[serde(rename = "saDataSizeKilobytes")] + pub sa_data_size_kilobytes: i32, + #[doc = "The IPSec encryption algorithm (IKE phase 1)."] + #[serde(rename = "ipsecEncryption")] + pub ipsec_encryption: IpsecEncryption, + #[doc = "The IPSec integrity algorithm (IKE phase 1)."] + #[serde(rename = "ipsecIntegrity")] + pub ipsec_integrity: IpsecIntegrity, + #[doc = "The IKE encryption algorithm (IKE phase 2)."] + #[serde(rename = "ikeEncryption")] + pub ike_encryption: IkeEncryption, + #[doc = "The IKE integrity algorithm (IKE phase 2)."] + #[serde(rename = "ikeIntegrity")] + pub ike_integrity: IkeIntegrity, + #[doc = "The DH Groups used in IKE Phase 1 for initial SA."] + #[serde(rename = "dhGroup")] + pub dh_group: DhGroup, + #[doc = "The Pfs Groups used in IKE Phase 2 for new child SA."] + #[serde(rename = "pfsGroup")] + pub pfs_group: PfsGroup, +} +impl VpnClientIPsecParameters { + pub fn new( + sa_life_time_seconds: i32, + sa_data_size_kilobytes: i32, + ipsec_encryption: IpsecEncryption, + ipsec_integrity: IpsecIntegrity, + ike_encryption: IkeEncryption, + ike_integrity: IkeIntegrity, + dh_group: DhGroup, + pfs_group: PfsGroup, + ) -> Self { + Self { + sa_life_time_seconds, + sa_data_size_kilobytes, + ipsec_encryption, + ipsec_integrity, + ike_encryption, + ike_integrity, + dh_group, + pfs_group, + } + } +} +#[doc = "Vpn Client Parameters for package generation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientParameters { + #[doc = "VPN client Processor Architecture."] + #[serde(rename = "processorArchitecture", default, skip_serializing_if = "Option::is_none")] + pub processor_architecture: Option, + #[doc = "VPN client authentication method."] + #[serde(rename = "authenticationMethod", default, skip_serializing_if = "Option::is_none")] + pub authentication_method: Option, + #[doc = "The public certificate data for the radius server authentication certificate as a Base-64 encoded string. Required only if external radius authentication has been configured with EAPTLS authentication."] + #[serde(rename = "radiusServerAuthCertificate", default, skip_serializing_if = "Option::is_none")] + pub radius_server_auth_certificate: Option, + #[doc = "A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external radius based authentication with EAPTLS."] + #[serde(rename = "clientRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub client_root_certificates: Vec, +} +impl VpnClientParameters { + pub fn new() -> Self { + Self::default() + } +} +pub mod vpn_client_parameters { + use super::*; + #[doc = "VPN client Processor Architecture."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProcessorArchitecture { + Amd64, + X86, + } +} +#[doc = "VPN client revoked certificate of virtual network gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientRevokedCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of the revoked VPN client certificate of virtual network gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnClientRevokedCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the revoked VPN client certificate of virtual network gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnClientRevokedCertificatePropertiesFormat { + #[doc = "The revoked VPN client certificate thumbprint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VpnClientRevokedCertificatePropertiesFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VPN client root certificate of virtual network gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VpnClientRootCertificate { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Properties of SSL certificates of application gateway."] + pub properties: VpnClientRootCertificatePropertiesFormat, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnClientRootCertificate { + pub fn new(properties: VpnClientRootCertificatePropertiesFormat) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + name: None, + etag: None, + } + } +} +#[doc = "Properties of SSL certificates of application gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VpnClientRootCertificatePropertiesFormat { + #[doc = "The certificate public data."] + #[serde(rename = "publicCertData")] + pub public_cert_data: String, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VpnClientRootCertificatePropertiesFormat { + pub fn new(public_cert_data: String) -> Self { + Self { + public_cert_data, + provisioning_state: None, + } + } +} +#[doc = "VpnConnection Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VpnConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vpn Connection packet capture parameters supplied to start packet capture on gateway connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnConnectionPacketCaptureStartParameters { + #[doc = "Start Packet capture parameters on vpn connection."] + #[serde(rename = "filterData", default, skip_serializing_if = "Option::is_none")] + pub filter_data: Option, + #[doc = "List of site link connection names."] + #[serde(rename = "linkConnectionNames", default, skip_serializing_if = "Vec::is_empty")] + pub link_connection_names: Vec, +} +impl VpnConnectionPacketCaptureStartParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vpn Connection packet capture parameters supplied to stop packet capture on gateway connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnConnectionPacketCaptureStopParameters { + #[doc = "SAS url for packet capture on vpn connection."] + #[serde(rename = "sasUrl", default, skip_serializing_if = "Option::is_none")] + pub sas_url: Option, + #[doc = "List of site link connection names."] + #[serde(rename = "linkConnectionNames", default, skip_serializing_if = "Vec::is_empty")] + pub link_connection_names: Vec, +} +impl VpnConnectionPacketCaptureStopParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnConnectionProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "remoteVpnSite", default, skip_serializing_if = "Option::is_none")] + pub remote_vpn_site: Option, + #[doc = "Routing weight for vpn connection."] + #[serde(rename = "routingWeight", default, skip_serializing_if = "Option::is_none")] + pub routing_weight: Option, + #[doc = "DPD timeout in seconds for vpn connection."] + #[serde(rename = "dpdTimeoutSeconds", default, skip_serializing_if = "Option::is_none")] + pub dpd_timeout_seconds: Option, + #[doc = "The current state of the vpn connection."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Gateway connection protocol."] + #[serde(rename = "vpnConnectionProtocolType", default, skip_serializing_if = "Option::is_none")] + pub vpn_connection_protocol_type: Option, + #[doc = "Ingress bytes transferred."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "Egress bytes transferred."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "Expected bandwidth in MBPS."] + #[serde(rename = "connectionBandwidth", default, skip_serializing_if = "Option::is_none")] + pub connection_bandwidth: Option, + #[doc = "SharedKey for the vpn connection."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableBgp", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp: Option, + #[doc = "Enable policy-based traffic selectors."] + #[serde(rename = "usePolicyBasedTrafficSelectors", default, skip_serializing_if = "Option::is_none")] + pub use_policy_based_traffic_selectors: Option, + #[doc = "The IPSec Policies to be considered by this connection."] + #[serde(rename = "ipsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub ipsec_policies: Vec, + #[doc = "The Traffic Selector Policies to be considered by this connection."] + #[serde(rename = "trafficSelectorPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub traffic_selector_policies: Vec, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableRateLimiting", default, skip_serializing_if = "Option::is_none")] + pub enable_rate_limiting: Option, + #[doc = "Enable internet security."] + #[serde(rename = "enableInternetSecurity", default, skip_serializing_if = "Option::is_none")] + pub enable_internet_security: Option, + #[doc = "Use local azure ip to initiate connection."] + #[serde(rename = "useLocalAzureIpAddress", default, skip_serializing_if = "Option::is_none")] + pub use_local_azure_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "List of all vpn site link connections to the gateway."] + #[serde(rename = "vpnLinkConnections", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_link_connections: Vec, + #[doc = "Routing Configuration indicating the associated and propagated route tables for this connection."] + #[serde(rename = "routingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub routing_configuration: Option, +} +impl VpnConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current state of the vpn connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum VpnConnectionStatus { + Unknown, + Connecting, + Connected, + NotConnected, +} +#[doc = "Vpn device configuration script generation parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnDeviceScriptParameters { + #[doc = "The vendor for the vpn device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vendor: Option, + #[doc = "The device family for the vpn device."] + #[serde(rename = "deviceFamily", default, skip_serializing_if = "Option::is_none")] + pub device_family: Option, + #[doc = "The firmware version for the vpn device."] + #[serde(rename = "firmwareVersion", default, skip_serializing_if = "Option::is_none")] + pub firmware_version: Option, +} +impl VpnDeviceScriptParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnGateway Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VpnGateway { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for VpnGateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnGateway { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + } + } +} +#[doc = "IP Configuration of a VPN Gateway Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayIpConfiguration { + #[doc = "The identifier of the IP configuration for a VPN Gateway."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The public IP address of this IP configuration."] + #[serde(rename = "publicIpAddress", default, skip_serializing_if = "Option::is_none")] + pub public_ip_address: Option, + #[doc = "The private IP address of this IP configuration."] + #[serde(rename = "privateIpAddress", default, skip_serializing_if = "Option::is_none")] + pub private_ip_address: Option, +} +impl VpnGatewayIpConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnGatewayNatRule Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayNatRule { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VpnGatewayNatRule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VpnGatewayNatRule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnGatewayNatRule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayNatRuleProperties { + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The type of NAT rule for VPN NAT."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The Source NAT direction of a VPN NAT."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[doc = "The private IP address internal mapping for NAT."] + #[serde(rename = "internalMappings", default, skip_serializing_if = "Vec::is_empty")] + pub internal_mappings: Vec, + #[doc = "The private IP address external mapping for NAT."] + #[serde(rename = "externalMappings", default, skip_serializing_if = "Vec::is_empty")] + pub external_mappings: Vec, + #[doc = "The IP Configuration ID this NAT rule applies to."] + #[serde(rename = "ipConfigurationId", default, skip_serializing_if = "Option::is_none")] + pub ip_configuration_id: Option, + #[doc = "List of egress VpnSiteLinkConnections."] + #[serde(rename = "egressVpnSiteLinkConnections", default, skip_serializing_if = "Vec::is_empty")] + pub egress_vpn_site_link_connections: Vec, + #[doc = "List of ingress VpnSiteLinkConnections."] + #[serde(rename = "ingressVpnSiteLinkConnections", default, skip_serializing_if = "Vec::is_empty")] + pub ingress_vpn_site_link_connections: Vec, +} +impl VpnGatewayNatRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod vpn_gateway_nat_rule_properties { + use super::*; + #[doc = "The type of NAT rule for VPN NAT."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Static, + Dynamic, + } + #[doc = "The Source NAT direction of a VPN NAT."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + EgressSnat, + IngressSnat, + } +} +#[doc = "Start packet capture parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayPacketCaptureStartParameters { + #[doc = "Start Packet capture parameters on vpn gateway."] + #[serde(rename = "filterData", default, skip_serializing_if = "Option::is_none")] + pub filter_data: Option, +} +impl VpnGatewayPacketCaptureStartParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Stop packet capture parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayPacketCaptureStopParameters { + #[doc = "SAS url for packet capture on vpn gateway."] + #[serde(rename = "sasUrl", default, skip_serializing_if = "Option::is_none")] + pub sas_url: Option, +} +impl VpnGatewayPacketCaptureStopParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnGateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnGatewayProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualHub", default, skip_serializing_if = "Option::is_none")] + pub virtual_hub: Option, + #[doc = "List of all vpn connections to the gateway."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub connections: Vec, + #[doc = "BGP settings details."] + #[serde(rename = "bgpSettings", default, skip_serializing_if = "Option::is_none")] + pub bgp_settings: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The scale unit for this vpn gateway."] + #[serde(rename = "vpnGatewayScaleUnit", default, skip_serializing_if = "Option::is_none")] + pub vpn_gateway_scale_unit: Option, + #[doc = "List of all IPs configured on the gateway."] + #[serde(rename = "ipConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configurations: Vec, + #[doc = "Enable BGP routes translation for NAT on this VpnGateway."] + #[serde(rename = "enableBgpRouteTranslationForNat", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp_route_translation_for_nat: Option, + #[doc = "Enable Routing Preference property for the Public IP Interface of the VpnGateway."] + #[serde(rename = "isRoutingPreferenceInternet", default, skip_serializing_if = "Option::is_none")] + pub is_routing_preference_internet: Option, + #[doc = "List of all the nat Rules associated with the gateway."] + #[serde(rename = "natRules", default, skip_serializing_if = "Vec::is_empty")] + pub nat_rules: Vec, +} +impl VpnGatewayProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BGP settings details for a link."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnLinkBgpSettings { + #[doc = "The BGP speaker's ASN."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub asn: Option, + #[doc = "The BGP peering address and BGP identifier of this BGP speaker."] + #[serde(rename = "bgpPeeringAddress", default, skip_serializing_if = "Option::is_none")] + pub bgp_peering_address: Option, +} +impl VpnLinkBgpSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of properties of a link provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnLinkProviderProperties { + #[doc = "Name of the link provider."] + #[serde(rename = "linkProviderName", default, skip_serializing_if = "Option::is_none")] + pub link_provider_name: Option, + #[doc = "Link speed."] + #[serde(rename = "linkSpeedInMbps", default, skip_serializing_if = "Option::is_none")] + pub link_speed_in_mbps: Option, +} +impl VpnLinkProviderProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vpn NatRule mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnNatRuleMapping { + #[doc = "Address space for Vpn NatRule mapping."] + #[serde(rename = "addressSpace", default, skip_serializing_if = "Option::is_none")] + pub address_space: Option, + #[doc = "Port range for Vpn NatRule mapping."] + #[serde(rename = "portRange", default, skip_serializing_if = "Option::is_none")] + pub port_range: Option, +} +impl VpnNatRuleMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Start packet capture parameters on virtual network gateway."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnPacketCaptureStartParameters { + #[doc = "Start Packet capture parameters."] + #[serde(rename = "filterData", default, skip_serializing_if = "Option::is_none")] + pub filter_data: Option, +} +impl VpnPacketCaptureStartParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Stop packet capture parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnPacketCaptureStopParameters { + #[doc = "SAS url for packet capture on virtual network gateway."] + #[serde(rename = "sasUrl", default, skip_serializing_if = "Option::is_none")] + pub sas_url: Option, +} +impl VpnPacketCaptureStopParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vpn Profile Response for package generation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnProfileResponse { + #[doc = "URL to the VPN profile."] + #[serde(rename = "profileUrl", default, skip_serializing_if = "Option::is_none")] + pub profile_url: Option, +} +impl VpnProfileResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the Radius client root certificate of VpnServerConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigRadiusClientRootCertificate { + #[doc = "The certificate name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Radius client root certificate thumbprint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +impl VpnServerConfigRadiusClientRootCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of Radius Server root certificate of VpnServerConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigRadiusServerRootCertificate { + #[doc = "The certificate name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The certificate public data."] + #[serde(rename = "publicCertData", default, skip_serializing_if = "Option::is_none")] + pub public_cert_data: Option, +} +impl VpnServerConfigRadiusServerRootCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the revoked VPN client certificate of VpnServerConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigVpnClientRevokedCertificate { + #[doc = "The certificate name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The revoked VPN client certificate thumbprint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, +} +impl VpnServerConfigVpnClientRevokedCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of VPN client root certificate of VpnServerConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigVpnClientRootCertificate { + #[doc = "The certificate name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The certificate public data."] + #[serde(rename = "publicCertData", default, skip_serializing_if = "Option::is_none")] + pub public_cert_data: Option, +} +impl VpnServerConfigVpnClientRootCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnServerConfiguration Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfiguration { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for VpnServerConfiguration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnServerConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnServerConfigurationPolicyGroup Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigurationPolicyGroup { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VpnServerConfigurationPolicyGroup."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VpnServerConfigurationPolicyGroup { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnServerConfiguration PolicyGroup member"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigurationPolicyGroupMember { + #[doc = "Name of the VpnServerConfigurationPolicyGroupMember."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Vpn Policy member attribute type."] + #[serde(rename = "attributeType", default, skip_serializing_if = "Option::is_none")] + pub attribute_type: Option, + #[doc = "The value of Attribute used for this VpnServerConfigurationPolicyGroupMember."] + #[serde(rename = "attributeValue", default, skip_serializing_if = "Option::is_none")] + pub attribute_value: Option, +} +impl VpnServerConfigurationPolicyGroupMember { + pub fn new() -> Self { + Self::default() + } +} +pub mod vpn_server_configuration_policy_group_member { + use super::*; + #[doc = "The Vpn Policy member attribute type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AttributeType { + CertificateGroupId, + #[serde(rename = "AADGroupId")] + AadGroupId, + RadiusAzureGroupId, + } +} +#[doc = "Parameters for VpnServerConfigurationPolicyGroup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigurationPolicyGroupProperties { + #[doc = "Shows if this is a Default VpnServerConfigurationPolicyGroup or not."] + #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] + pub is_default: Option, + #[doc = "Priority for VpnServerConfigurationPolicyGroup."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Multiple PolicyMembers for VpnServerConfigurationPolicyGroup."] + #[serde(rename = "policyMembers", default, skip_serializing_if = "Vec::is_empty")] + pub policy_members: Vec, + #[doc = "List of references to P2SConnectionConfigurations."] + #[serde(rename = "p2SConnectionConfigurations", default, skip_serializing_if = "Vec::is_empty")] + pub p2_s_connection_configurations: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VpnServerConfigurationPolicyGroupProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnServerConfiguration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigurationProperties { + #[doc = "The name of the VpnServerConfiguration that is unique within a resource group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "VPN protocols for the VpnServerConfiguration."] + #[serde(rename = "vpnProtocols", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_protocols: Vec, + #[doc = "VPN authentication types for the VpnServerConfiguration."] + #[serde(rename = "vpnAuthenticationTypes", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_authentication_types: Vec, + #[doc = "VPN client root certificate of VpnServerConfiguration."] + #[serde(rename = "vpnClientRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_root_certificates: Vec, + #[doc = "VPN client revoked certificate of VpnServerConfiguration."] + #[serde(rename = "vpnClientRevokedCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_revoked_certificates: Vec, + #[doc = "Radius Server root certificate of VpnServerConfiguration."] + #[serde(rename = "radiusServerRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub radius_server_root_certificates: Vec, + #[doc = "Radius client root certificate of VpnServerConfiguration."] + #[serde(rename = "radiusClientRootCertificates", default, skip_serializing_if = "Vec::is_empty")] + pub radius_client_root_certificates: Vec, + #[doc = "VpnClientIpsecPolicies for VpnServerConfiguration."] + #[serde(rename = "vpnClientIpsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_client_ipsec_policies: Vec, + #[doc = "The radius server address property of the VpnServerConfiguration resource for point to site client connection."] + #[serde(rename = "radiusServerAddress", default, skip_serializing_if = "Option::is_none")] + pub radius_server_address: Option, + #[doc = "The radius secret property of the VpnServerConfiguration resource for point to site client connection."] + #[serde(rename = "radiusServerSecret", default, skip_serializing_if = "Option::is_none")] + pub radius_server_secret: Option, + #[doc = "Multiple Radius Server configuration for VpnServerConfiguration."] + #[serde(rename = "radiusServers", default, skip_serializing_if = "Vec::is_empty")] + pub radius_servers: Vec, + #[doc = "AAD Vpn authentication type related parameters."] + #[serde(rename = "aadAuthenticationParameters", default, skip_serializing_if = "Option::is_none")] + pub aad_authentication_parameters: Option, + #[doc = "The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', and 'Failed'."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "List of references to P2SVpnGateways."] + #[serde(rename = "p2SVpnGateways", default, skip_serializing_if = "Vec::is_empty")] + pub p2_s_vpn_gateways: Vec, + #[doc = "List of all VpnServerConfigurationPolicyGroups."] + #[serde(rename = "configurationPolicyGroups", default, skip_serializing_if = "Vec::is_empty")] + pub configuration_policy_groups: Vec, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnServerConfigurationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnServerConfigurations list associated with VirtualWan Response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnServerConfigurationsResponse { + #[doc = "List of VpnServerConfigurations associated with VirtualWan."] + #[serde(rename = "vpnServerConfigurationResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_server_configuration_resource_ids: Vec, +} +impl VpnServerConfigurationsResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnSite Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VpnSite { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters for VpnSite."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl VpnSite { + pub fn new() -> Self { + Self { + resource: Resource::default(), + properties: None, + etag: None, + } + } +} +#[doc = "VpnSite Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteId { + #[doc = "The resource-uri of the vpn-site for which config is to be fetched."] + #[serde(rename = "vpnSite", default, skip_serializing_if = "Option::is_none")] + pub vpn_site: Option, +} +impl VpnSiteId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnSiteLink Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteLink { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VpnSite."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VpnSiteLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VpnSiteLinkConnection Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteLinkConnection { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Parameters for VpnConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the resource that is unique within a resource group. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VpnSiteLinkConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteLinkConnectionProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "vpnSiteLink", default, skip_serializing_if = "Option::is_none")] + pub vpn_site_link: Option, + #[doc = "Routing weight for vpn connection."] + #[serde(rename = "routingWeight", default, skip_serializing_if = "Option::is_none")] + pub routing_weight: Option, + #[doc = "Vpn link connection mode."] + #[serde(rename = "vpnLinkConnectionMode", default, skip_serializing_if = "Option::is_none")] + pub vpn_link_connection_mode: Option, + #[doc = "The current state of the vpn connection."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Gateway connection protocol."] + #[serde(rename = "vpnConnectionProtocolType", default, skip_serializing_if = "Option::is_none")] + pub vpn_connection_protocol_type: Option, + #[doc = "Ingress bytes transferred."] + #[serde(rename = "ingressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub ingress_bytes_transferred: Option, + #[doc = "Egress bytes transferred."] + #[serde(rename = "egressBytesTransferred", default, skip_serializing_if = "Option::is_none")] + pub egress_bytes_transferred: Option, + #[doc = "Expected bandwidth in MBPS."] + #[serde(rename = "connectionBandwidth", default, skip_serializing_if = "Option::is_none")] + pub connection_bandwidth: Option, + #[doc = "SharedKey for the vpn connection."] + #[serde(rename = "sharedKey", default, skip_serializing_if = "Option::is_none")] + pub shared_key: Option, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableBgp", default, skip_serializing_if = "Option::is_none")] + pub enable_bgp: Option, + #[doc = "vpnGatewayCustomBgpAddresses used by this connection."] + #[serde(rename = "vpnGatewayCustomBgpAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_gateway_custom_bgp_addresses: Vec, + #[doc = "Enable policy-based traffic selectors."] + #[serde(rename = "usePolicyBasedTrafficSelectors", default, skip_serializing_if = "Option::is_none")] + pub use_policy_based_traffic_selectors: Option, + #[doc = "The IPSec Policies to be considered by this connection."] + #[serde(rename = "ipsecPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub ipsec_policies: Vec, + #[doc = "EnableBgp flag."] + #[serde(rename = "enableRateLimiting", default, skip_serializing_if = "Option::is_none")] + pub enable_rate_limiting: Option, + #[doc = "Use local azure ip to initiate connection."] + #[serde(rename = "useLocalAzureIpAddress", default, skip_serializing_if = "Option::is_none")] + pub use_local_azure_ip_address: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "List of ingress NatRules."] + #[serde(rename = "ingressNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub ingress_nat_rules: Vec, + #[doc = "List of egress NatRules."] + #[serde(rename = "egressNatRules", default, skip_serializing_if = "Vec::is_empty")] + pub egress_nat_rules: Vec, +} +impl VpnSiteLinkConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod vpn_site_link_connection_properties { + use super::*; + #[doc = "Vpn link connection mode."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VpnLinkConnectionMode { + Default, + ResponderOnly, + InitiatorOnly, + } +} +#[doc = "Parameters for VpnSite."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteLinkProperties { + #[doc = "List of properties of a link provider."] + #[serde(rename = "linkProperties", default, skip_serializing_if = "Option::is_none")] + pub link_properties: Option, + #[doc = "The ip-address for the vpn-site-link."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "FQDN of vpn-site-link."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "BGP settings details for a link."] + #[serde(rename = "bgpProperties", default, skip_serializing_if = "Option::is_none")] + pub bgp_properties: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VpnSiteLinkProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for VpnSite."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VpnSiteProperties { + #[doc = "Reference to another subresource."] + #[serde(rename = "virtualWan", default, skip_serializing_if = "Option::is_none")] + pub virtual_wan: Option, + #[doc = "List of properties of the device."] + #[serde(rename = "deviceProperties", default, skip_serializing_if = "Option::is_none")] + pub device_properties: Option, + #[doc = "The ip-address for the vpn-site."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The key for vpn-site that can be used for connections."] + #[serde(rename = "siteKey", default, skip_serializing_if = "Option::is_none")] + pub site_key: Option, + #[doc = "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network."] + #[serde(rename = "addressSpace", default, skip_serializing_if = "Option::is_none")] + pub address_space: Option, + #[doc = "BGP settings details."] + #[serde(rename = "bgpProperties", default, skip_serializing_if = "Option::is_none")] + pub bgp_properties: Option, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "IsSecuritySite flag."] + #[serde(rename = "isSecuritySite", default, skip_serializing_if = "Option::is_none")] + pub is_security_site: Option, + #[doc = "List of all vpn site links."] + #[serde(rename = "vpnSiteLinks", default, skip_serializing_if = "Vec::is_empty")] + pub vpn_site_links: Vec, + #[doc = "The Office365 breakout policy."] + #[serde(rename = "o365Policy", default, skip_serializing_if = "Option::is_none")] + pub o365_policy: Option, +} +impl VpnSiteProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines contents of a web application rule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebApplicationFirewallCustomRule { + #[doc = "The name of the resource that is unique within a policy. This name can be used to access the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value."] + pub priority: i64, + #[doc = "The rule type."] + #[serde(rename = "ruleType")] + pub rule_type: web_application_firewall_custom_rule::RuleType, + #[doc = "List of match conditions."] + #[serde(rename = "matchConditions")] + pub match_conditions: Vec, + #[doc = "Type of Actions."] + pub action: web_application_firewall_custom_rule::Action, +} +impl WebApplicationFirewallCustomRule { + pub fn new( + priority: i64, + rule_type: web_application_firewall_custom_rule::RuleType, + match_conditions: Vec, + action: web_application_firewall_custom_rule::Action, + ) -> Self { + Self { + name: None, + etag: None, + priority, + rule_type, + match_conditions, + action, + } + } +} +pub mod web_application_firewall_custom_rule { + use super::*; + #[doc = "The rule type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleType { + MatchRule, + Invalid, + } + #[doc = "Type of Actions."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Allow, + Block, + Log, + } +} +#[doc = "Defines web application firewall policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WebApplicationFirewallPolicy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Defines web application firewall policy properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl WebApplicationFirewallPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list WebApplicationFirewallPolicies. It contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WebApplicationFirewallPolicyListResult { + #[doc = "List of WebApplicationFirewallPolicies within a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of WebApplicationFirewallPolicy objects if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl WebApplicationFirewallPolicyListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines web application firewall policy properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebApplicationFirewallPolicyPropertiesFormat { + #[doc = "Defines contents of a web application firewall global configuration."] + #[serde(rename = "policySettings", default, skip_serializing_if = "Option::is_none")] + pub policy_settings: Option, + #[doc = "The custom rules inside the policy."] + #[serde(rename = "customRules", default, skip_serializing_if = "Vec::is_empty")] + pub custom_rules: Vec, + #[doc = "A collection of references to application gateways."] + #[serde(rename = "applicationGateways", default, skip_serializing_if = "Vec::is_empty")] + pub application_gateways: Vec, + #[doc = "The current provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Resource status of the policy."] + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[doc = "Allow to exclude some variable satisfy the condition for the WAF check."] + #[serde(rename = "managedRules")] + pub managed_rules: ManagedRulesDefinition, + #[doc = "A collection of references to application gateway http listeners."] + #[serde(rename = "httpListeners", default, skip_serializing_if = "Vec::is_empty")] + pub http_listeners: Vec, + #[doc = "A collection of references to application gateway path rules."] + #[serde(rename = "pathBasedRules", default, skip_serializing_if = "Vec::is_empty")] + pub path_based_rules: Vec, +} +impl WebApplicationFirewallPolicyPropertiesFormat { + pub fn new(managed_rules: ManagedRulesDefinition) -> Self { + Self { + policy_settings: None, + custom_rules: Vec::new(), + application_gateways: Vec::new(), + provisioning_state: None, + resource_state: None, + managed_rules, + http_listeners: Vec::new(), + path_based_rules: Vec::new(), + } + } +} +pub mod web_application_firewall_policy_properties_format { + use super::*; + #[doc = "Resource status of the policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceState { + Creating, + Enabling, + Enabled, + Disabling, + Disabled, + Deleting, + } +} diff --git a/services/mgmt/network/src/package_2021_08/operations.rs b/services/mgmt/network/src/package_2021_08/operations.rs new file mode 100644 index 0000000000..440e96ca6c --- /dev/null +++ b/services/mgmt/network/src/package_2021_08/operations.rs @@ -0,0 +1,53809 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn application_gateway_private_endpoint_connections(&self) -> application_gateway_private_endpoint_connections::Client { + application_gateway_private_endpoint_connections::Client(self.clone()) + } + pub fn application_gateway_private_link_resources(&self) -> application_gateway_private_link_resources::Client { + application_gateway_private_link_resources::Client(self.clone()) + } + pub fn application_gateways(&self) -> application_gateways::Client { + application_gateways::Client(self.clone()) + } + pub fn application_security_groups(&self) -> application_security_groups::Client { + application_security_groups::Client(self.clone()) + } + pub fn available_delegations(&self) -> available_delegations::Client { + available_delegations::Client(self.clone()) + } + pub fn available_endpoint_services(&self) -> available_endpoint_services::Client { + available_endpoint_services::Client(self.clone()) + } + pub fn available_private_endpoint_types(&self) -> available_private_endpoint_types::Client { + available_private_endpoint_types::Client(self.clone()) + } + pub fn available_resource_group_delegations(&self) -> available_resource_group_delegations::Client { + available_resource_group_delegations::Client(self.clone()) + } + pub fn available_service_aliases(&self) -> available_service_aliases::Client { + available_service_aliases::Client(self.clone()) + } + pub fn azure_firewall_fqdn_tags(&self) -> azure_firewall_fqdn_tags::Client { + azure_firewall_fqdn_tags::Client(self.clone()) + } + pub fn azure_firewalls(&self) -> azure_firewalls::Client { + azure_firewalls::Client(self.clone()) + } + pub fn bastion_hosts(&self) -> bastion_hosts::Client { + bastion_hosts::Client(self.clone()) + } + pub fn bgp_service_communities(&self) -> bgp_service_communities::Client { + bgp_service_communities::Client(self.clone()) + } + pub fn configuration_policy_groups(&self) -> configuration_policy_groups::Client { + configuration_policy_groups::Client(self.clone()) + } + pub fn connection_monitors(&self) -> connection_monitors::Client { + connection_monitors::Client(self.clone()) + } + pub fn custom_ip_prefixes(&self) -> custom_ip_prefixes::Client { + custom_ip_prefixes::Client(self.clone()) + } + pub fn ddos_custom_policies(&self) -> ddos_custom_policies::Client { + ddos_custom_policies::Client(self.clone()) + } + pub fn ddos_protection_plans(&self) -> ddos_protection_plans::Client { + ddos_protection_plans::Client(self.clone()) + } + pub fn default_security_rules(&self) -> default_security_rules::Client { + default_security_rules::Client(self.clone()) + } + pub fn dscp_configuration(&self) -> dscp_configuration::Client { + dscp_configuration::Client(self.clone()) + } + pub fn express_route_circuit_authorizations(&self) -> express_route_circuit_authorizations::Client { + express_route_circuit_authorizations::Client(self.clone()) + } + pub fn express_route_circuit_connections(&self) -> express_route_circuit_connections::Client { + express_route_circuit_connections::Client(self.clone()) + } + pub fn express_route_circuit_peerings(&self) -> express_route_circuit_peerings::Client { + express_route_circuit_peerings::Client(self.clone()) + } + pub fn express_route_circuits(&self) -> express_route_circuits::Client { + express_route_circuits::Client(self.clone()) + } + pub fn express_route_connections(&self) -> express_route_connections::Client { + express_route_connections::Client(self.clone()) + } + pub fn express_route_cross_connection_peerings(&self) -> express_route_cross_connection_peerings::Client { + express_route_cross_connection_peerings::Client(self.clone()) + } + pub fn express_route_cross_connections(&self) -> express_route_cross_connections::Client { + express_route_cross_connections::Client(self.clone()) + } + pub fn express_route_gateways(&self) -> express_route_gateways::Client { + express_route_gateways::Client(self.clone()) + } + pub fn express_route_links(&self) -> express_route_links::Client { + express_route_links::Client(self.clone()) + } + pub fn express_route_port_authorizations(&self) -> express_route_port_authorizations::Client { + express_route_port_authorizations::Client(self.clone()) + } + pub fn express_route_ports(&self) -> express_route_ports::Client { + express_route_ports::Client(self.clone()) + } + pub fn express_route_ports_locations(&self) -> express_route_ports_locations::Client { + express_route_ports_locations::Client(self.clone()) + } + pub fn express_route_service_providers(&self) -> express_route_service_providers::Client { + express_route_service_providers::Client(self.clone()) + } + pub fn firewall_policies(&self) -> firewall_policies::Client { + firewall_policies::Client(self.clone()) + } + pub fn firewall_policy_idps_signatures(&self) -> firewall_policy_idps_signatures::Client { + firewall_policy_idps_signatures::Client(self.clone()) + } + pub fn firewall_policy_idps_signatures_filter_values(&self) -> firewall_policy_idps_signatures_filter_values::Client { + firewall_policy_idps_signatures_filter_values::Client(self.clone()) + } + pub fn firewall_policy_idps_signatures_overrides(&self) -> firewall_policy_idps_signatures_overrides::Client { + firewall_policy_idps_signatures_overrides::Client(self.clone()) + } + pub fn firewall_policy_rule_collection_groups(&self) -> firewall_policy_rule_collection_groups::Client { + firewall_policy_rule_collection_groups::Client(self.clone()) + } + pub fn flow_logs(&self) -> flow_logs::Client { + flow_logs::Client(self.clone()) + } + pub fn hub_route_tables(&self) -> hub_route_tables::Client { + hub_route_tables::Client(self.clone()) + } + pub fn hub_virtual_network_connections(&self) -> hub_virtual_network_connections::Client { + hub_virtual_network_connections::Client(self.clone()) + } + pub fn inbound_nat_rules(&self) -> inbound_nat_rules::Client { + inbound_nat_rules::Client(self.clone()) + } + pub fn inbound_security_rule(&self) -> inbound_security_rule::Client { + inbound_security_rule::Client(self.clone()) + } + pub fn ip_allocations(&self) -> ip_allocations::Client { + ip_allocations::Client(self.clone()) + } + pub fn ip_groups(&self) -> ip_groups::Client { + ip_groups::Client(self.clone()) + } + pub fn load_balancer_backend_address_pools(&self) -> load_balancer_backend_address_pools::Client { + load_balancer_backend_address_pools::Client(self.clone()) + } + pub fn load_balancer_frontend_ip_configurations(&self) -> load_balancer_frontend_ip_configurations::Client { + load_balancer_frontend_ip_configurations::Client(self.clone()) + } + pub fn load_balancer_load_balancing_rules(&self) -> load_balancer_load_balancing_rules::Client { + load_balancer_load_balancing_rules::Client(self.clone()) + } + pub fn load_balancer_network_interfaces(&self) -> load_balancer_network_interfaces::Client { + load_balancer_network_interfaces::Client(self.clone()) + } + pub fn load_balancer_outbound_rules(&self) -> load_balancer_outbound_rules::Client { + load_balancer_outbound_rules::Client(self.clone()) + } + pub fn load_balancer_probes(&self) -> load_balancer_probes::Client { + load_balancer_probes::Client(self.clone()) + } + pub fn load_balancers(&self) -> load_balancers::Client { + load_balancers::Client(self.clone()) + } + pub fn local_network_gateways(&self) -> local_network_gateways::Client { + local_network_gateways::Client(self.clone()) + } + pub fn nat_gateways(&self) -> nat_gateways::Client { + nat_gateways::Client(self.clone()) + } + pub fn nat_rules(&self) -> nat_rules::Client { + nat_rules::Client(self.clone()) + } + pub fn network_interface_ip_configurations(&self) -> network_interface_ip_configurations::Client { + network_interface_ip_configurations::Client(self.clone()) + } + pub fn network_interface_load_balancers(&self) -> network_interface_load_balancers::Client { + network_interface_load_balancers::Client(self.clone()) + } + pub fn network_interface_tap_configurations(&self) -> network_interface_tap_configurations::Client { + network_interface_tap_configurations::Client(self.clone()) + } + pub fn network_interfaces(&self) -> network_interfaces::Client { + network_interfaces::Client(self.clone()) + } + pub fn network_profiles(&self) -> network_profiles::Client { + network_profiles::Client(self.clone()) + } + pub fn network_security_groups(&self) -> network_security_groups::Client { + network_security_groups::Client(self.clone()) + } + pub fn network_virtual_appliances(&self) -> network_virtual_appliances::Client { + network_virtual_appliances::Client(self.clone()) + } + pub fn network_watchers(&self) -> network_watchers::Client { + network_watchers::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn p2s_vpn_gateways(&self) -> p2s_vpn_gateways::Client { + p2s_vpn_gateways::Client(self.clone()) + } + pub fn packet_captures(&self) -> packet_captures::Client { + packet_captures::Client(self.clone()) + } + pub fn peer_express_route_circuit_connections(&self) -> peer_express_route_circuit_connections::Client { + peer_express_route_circuit_connections::Client(self.clone()) + } + pub fn private_dns_zone_groups(&self) -> private_dns_zone_groups::Client { + private_dns_zone_groups::Client(self.clone()) + } + pub fn private_endpoints(&self) -> private_endpoints::Client { + private_endpoints::Client(self.clone()) + } + pub fn private_link_services(&self) -> private_link_services::Client { + private_link_services::Client(self.clone()) + } + pub fn public_ip_addresses(&self) -> public_ip_addresses::Client { + public_ip_addresses::Client(self.clone()) + } + pub fn public_ip_prefixes(&self) -> public_ip_prefixes::Client { + public_ip_prefixes::Client(self.clone()) + } + pub fn resource_navigation_links(&self) -> resource_navigation_links::Client { + resource_navigation_links::Client(self.clone()) + } + pub fn route_filter_rules(&self) -> route_filter_rules::Client { + route_filter_rules::Client(self.clone()) + } + pub fn route_filters(&self) -> route_filters::Client { + route_filters::Client(self.clone()) + } + pub fn route_tables(&self) -> route_tables::Client { + route_tables::Client(self.clone()) + } + pub fn routes(&self) -> routes::Client { + routes::Client(self.clone()) + } + pub fn routing_intent(&self) -> routing_intent::Client { + routing_intent::Client(self.clone()) + } + pub fn security_partner_providers(&self) -> security_partner_providers::Client { + security_partner_providers::Client(self.clone()) + } + pub fn security_rules(&self) -> security_rules::Client { + security_rules::Client(self.clone()) + } + pub fn service_association_links(&self) -> service_association_links::Client { + service_association_links::Client(self.clone()) + } + pub fn service_endpoint_policies(&self) -> service_endpoint_policies::Client { + service_endpoint_policies::Client(self.clone()) + } + pub fn service_endpoint_policy_definitions(&self) -> service_endpoint_policy_definitions::Client { + service_endpoint_policy_definitions::Client(self.clone()) + } + pub fn service_tag_information(&self) -> service_tag_information::Client { + service_tag_information::Client(self.clone()) + } + pub fn service_tags(&self) -> service_tags::Client { + service_tags::Client(self.clone()) + } + pub fn subnets(&self) -> subnets::Client { + subnets::Client(self.clone()) + } + pub fn usages(&self) -> usages::Client { + usages::Client(self.clone()) + } + pub fn virtual_appliance_sites(&self) -> virtual_appliance_sites::Client { + virtual_appliance_sites::Client(self.clone()) + } + pub fn virtual_appliance_skus(&self) -> virtual_appliance_skus::Client { + virtual_appliance_skus::Client(self.clone()) + } + pub fn virtual_hub_bgp_connection(&self) -> virtual_hub_bgp_connection::Client { + virtual_hub_bgp_connection::Client(self.clone()) + } + pub fn virtual_hub_bgp_connections(&self) -> virtual_hub_bgp_connections::Client { + virtual_hub_bgp_connections::Client(self.clone()) + } + pub fn virtual_hub_ip_configuration(&self) -> virtual_hub_ip_configuration::Client { + virtual_hub_ip_configuration::Client(self.clone()) + } + pub fn virtual_hub_route_table_v2s(&self) -> virtual_hub_route_table_v2s::Client { + virtual_hub_route_table_v2s::Client(self.clone()) + } + pub fn virtual_hubs(&self) -> virtual_hubs::Client { + virtual_hubs::Client(self.clone()) + } + pub fn virtual_network_gateway_connections(&self) -> virtual_network_gateway_connections::Client { + virtual_network_gateway_connections::Client(self.clone()) + } + pub fn virtual_network_gateway_nat_rules(&self) -> virtual_network_gateway_nat_rules::Client { + virtual_network_gateway_nat_rules::Client(self.clone()) + } + pub fn virtual_network_gateways(&self) -> virtual_network_gateways::Client { + virtual_network_gateways::Client(self.clone()) + } + pub fn virtual_network_peerings(&self) -> virtual_network_peerings::Client { + virtual_network_peerings::Client(self.clone()) + } + pub fn virtual_network_taps(&self) -> virtual_network_taps::Client { + virtual_network_taps::Client(self.clone()) + } + pub fn virtual_networks(&self) -> virtual_networks::Client { + virtual_networks::Client(self.clone()) + } + pub fn virtual_router_peerings(&self) -> virtual_router_peerings::Client { + virtual_router_peerings::Client(self.clone()) + } + pub fn virtual_routers(&self) -> virtual_routers::Client { + virtual_routers::Client(self.clone()) + } + pub fn virtual_wans(&self) -> virtual_wans::Client { + virtual_wans::Client(self.clone()) + } + pub fn vpn_connections(&self) -> vpn_connections::Client { + vpn_connections::Client(self.clone()) + } + pub fn vpn_gateways(&self) -> vpn_gateways::Client { + vpn_gateways::Client(self.clone()) + } + pub fn vpn_link_connections(&self) -> vpn_link_connections::Client { + vpn_link_connections::Client(self.clone()) + } + pub fn vpn_server_configurations(&self) -> vpn_server_configurations::Client { + vpn_server_configurations::Client(self.clone()) + } + pub fn vpn_server_configurations_associated_with_virtual_wan(&self) -> vpn_server_configurations_associated_with_virtual_wan::Client { + vpn_server_configurations_associated_with_virtual_wan::Client(self.clone()) + } + pub fn vpn_site_link_connections(&self) -> vpn_site_link_connections::Client { + vpn_site_link_connections::Client(self.clone()) + } + pub fn vpn_site_links(&self) -> vpn_site_links::Client { + vpn_site_links::Client(self.clone()) + } + pub fn vpn_sites(&self) -> vpn_sites::Client { + vpn_sites::Client(self.clone()) + } + pub fn vpn_sites_configuration(&self) -> vpn_sites_configuration::Client { + vpn_sites_configuration::Client(self.clone()) + } + pub fn web_application_firewall_policies(&self) -> web_application_firewall_policies::Client { + web_application_firewall_policies::Client(self.clone()) + } + pub fn web_categories(&self) -> web_categories::Client { + web_categories::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ApplicationGateways_Get(#[from] application_gateways::get::Error), + #[error(transparent)] + ApplicationGateways_CreateOrUpdate(#[from] application_gateways::create_or_update::Error), + #[error(transparent)] + ApplicationGateways_UpdateTags(#[from] application_gateways::update_tags::Error), + #[error(transparent)] + ApplicationGateways_Delete(#[from] application_gateways::delete::Error), + #[error(transparent)] + ApplicationGateways_List(#[from] application_gateways::list::Error), + #[error(transparent)] + ApplicationGateways_ListAll(#[from] application_gateways::list_all::Error), + #[error(transparent)] + ApplicationGateways_Start(#[from] application_gateways::start::Error), + #[error(transparent)] + ApplicationGateways_Stop(#[from] application_gateways::stop::Error), + #[error(transparent)] + ApplicationGateways_BackendHealth(#[from] application_gateways::backend_health::Error), + #[error(transparent)] + ApplicationGateways_BackendHealthOnDemand(#[from] application_gateways::backend_health_on_demand::Error), + #[error(transparent)] + ApplicationGatewayPrivateLinkResources_List(#[from] application_gateway_private_link_resources::list::Error), + #[error(transparent)] + ApplicationGatewayPrivateEndpointConnections_Get(#[from] application_gateway_private_endpoint_connections::get::Error), + #[error(transparent)] + ApplicationGatewayPrivateEndpointConnections_Update(#[from] application_gateway_private_endpoint_connections::update::Error), + #[error(transparent)] + ApplicationGatewayPrivateEndpointConnections_Delete(#[from] application_gateway_private_endpoint_connections::delete::Error), + #[error(transparent)] + ApplicationGatewayPrivateEndpointConnections_List(#[from] application_gateway_private_endpoint_connections::list::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableServerVariables(#[from] application_gateways::list_available_server_variables::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableRequestHeaders(#[from] application_gateways::list_available_request_headers::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableResponseHeaders(#[from] application_gateways::list_available_response_headers::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableWafRuleSets(#[from] application_gateways::list_available_waf_rule_sets::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableSslOptions(#[from] application_gateways::list_available_ssl_options::Error), + #[error(transparent)] + ApplicationGateways_ListAvailableSslPredefinedPolicies(#[from] application_gateways::list_available_ssl_predefined_policies::Error), + #[error(transparent)] + ApplicationGateways_GetSslPredefinedPolicy(#[from] application_gateways::get_ssl_predefined_policy::Error), + #[error(transparent)] + NetworkInterfaces_Get(#[from] network_interfaces::get::Error), + #[error(transparent)] + NetworkInterfaces_CreateOrUpdate(#[from] network_interfaces::create_or_update::Error), + #[error(transparent)] + NetworkInterfaces_UpdateTags(#[from] network_interfaces::update_tags::Error), + #[error(transparent)] + NetworkInterfaces_Delete(#[from] network_interfaces::delete::Error), + #[error(transparent)] + NetworkInterfaces_ListAll(#[from] network_interfaces::list_all::Error), + #[error(transparent)] + NetworkInterfaces_List(#[from] network_interfaces::list::Error), + #[error(transparent)] + NetworkInterfaces_GetEffectiveRouteTable(#[from] network_interfaces::get_effective_route_table::Error), + #[error(transparent)] + NetworkInterfaces_ListEffectiveNetworkSecurityGroups(#[from] network_interfaces::list_effective_network_security_groups::Error), + #[error(transparent)] + NetworkInterfaceIpConfigurations_List(#[from] network_interface_ip_configurations::list::Error), + #[error(transparent)] + NetworkInterfaceIpConfigurations_Get(#[from] network_interface_ip_configurations::get::Error), + #[error(transparent)] + NetworkInterfaceLoadBalancers_List(#[from] network_interface_load_balancers::list::Error), + #[error(transparent)] + NetworkInterfaceTapConfigurations_Get(#[from] network_interface_tap_configurations::get::Error), + #[error(transparent)] + NetworkInterfaceTapConfigurations_CreateOrUpdate(#[from] network_interface_tap_configurations::create_or_update::Error), + #[error(transparent)] + NetworkInterfaceTapConfigurations_Delete(#[from] network_interface_tap_configurations::delete::Error), + #[error(transparent)] + NetworkInterfaceTapConfigurations_List(#[from] network_interface_tap_configurations::list::Error), + #[error(transparent)] + VirtualNetworkTaps_Get(#[from] virtual_network_taps::get::Error), + #[error(transparent)] + VirtualNetworkTaps_CreateOrUpdate(#[from] virtual_network_taps::create_or_update::Error), + #[error(transparent)] + VirtualNetworkTaps_UpdateTags(#[from] virtual_network_taps::update_tags::Error), + #[error(transparent)] + VirtualNetworkTaps_Delete(#[from] virtual_network_taps::delete::Error), + #[error(transparent)] + VirtualNetworkTaps_ListAll(#[from] virtual_network_taps::list_all::Error), + #[error(transparent)] + VirtualNetworkTaps_ListByResourceGroup(#[from] virtual_network_taps::list_by_resource_group::Error), + #[error(transparent)] + LoadBalancers_Get(#[from] load_balancers::get::Error), + #[error(transparent)] + LoadBalancers_CreateOrUpdate(#[from] load_balancers::create_or_update::Error), + #[error(transparent)] + LoadBalancers_UpdateTags(#[from] load_balancers::update_tags::Error), + #[error(transparent)] + LoadBalancers_Delete(#[from] load_balancers::delete::Error), + #[error(transparent)] + LoadBalancers_ListAll(#[from] load_balancers::list_all::Error), + #[error(transparent)] + LoadBalancers_List(#[from] load_balancers::list::Error), + #[error(transparent)] + LoadBalancerBackendAddressPools_List(#[from] load_balancer_backend_address_pools::list::Error), + #[error(transparent)] + LoadBalancerBackendAddressPools_Get(#[from] load_balancer_backend_address_pools::get::Error), + #[error(transparent)] + LoadBalancerBackendAddressPools_CreateOrUpdate(#[from] load_balancer_backend_address_pools::create_or_update::Error), + #[error(transparent)] + LoadBalancerBackendAddressPools_Delete(#[from] load_balancer_backend_address_pools::delete::Error), + #[error(transparent)] + LoadBalancerFrontendIpConfigurations_List(#[from] load_balancer_frontend_ip_configurations::list::Error), + #[error(transparent)] + LoadBalancerFrontendIpConfigurations_Get(#[from] load_balancer_frontend_ip_configurations::get::Error), + #[error(transparent)] + InboundNatRules_List(#[from] inbound_nat_rules::list::Error), + #[error(transparent)] + InboundNatRules_Get(#[from] inbound_nat_rules::get::Error), + #[error(transparent)] + InboundNatRules_CreateOrUpdate(#[from] inbound_nat_rules::create_or_update::Error), + #[error(transparent)] + InboundNatRules_Delete(#[from] inbound_nat_rules::delete::Error), + #[error(transparent)] + LoadBalancerLoadBalancingRules_List(#[from] load_balancer_load_balancing_rules::list::Error), + #[error(transparent)] + LoadBalancerLoadBalancingRules_Get(#[from] load_balancer_load_balancing_rules::get::Error), + #[error(transparent)] + LoadBalancerOutboundRules_List(#[from] load_balancer_outbound_rules::list::Error), + #[error(transparent)] + LoadBalancerOutboundRules_Get(#[from] load_balancer_outbound_rules::get::Error), + #[error(transparent)] + LoadBalancerNetworkInterfaces_List(#[from] load_balancer_network_interfaces::list::Error), + #[error(transparent)] + LoadBalancerProbes_List(#[from] load_balancer_probes::list::Error), + #[error(transparent)] + LoadBalancers_SwapPublicIpAddresses(#[from] load_balancers::swap_public_ip_addresses::Error), + #[error(transparent)] + LoadBalancers_ListInboundNatRulePortMappings(#[from] load_balancers::list_inbound_nat_rule_port_mappings::Error), + #[error(transparent)] + LoadBalancerProbes_Get(#[from] load_balancer_probes::get::Error), + #[error(transparent)] + VirtualNetworks_Get(#[from] virtual_networks::get::Error), + #[error(transparent)] + VirtualNetworks_CreateOrUpdate(#[from] virtual_networks::create_or_update::Error), + #[error(transparent)] + VirtualNetworks_UpdateTags(#[from] virtual_networks::update_tags::Error), + #[error(transparent)] + VirtualNetworks_Delete(#[from] virtual_networks::delete::Error), + #[error(transparent)] + VirtualNetworks_ListAll(#[from] virtual_networks::list_all::Error), + #[error(transparent)] + VirtualNetworks_List(#[from] virtual_networks::list::Error), + #[error(transparent)] + Subnets_Get(#[from] subnets::get::Error), + #[error(transparent)] + Subnets_CreateOrUpdate(#[from] subnets::create_or_update::Error), + #[error(transparent)] + Subnets_Delete(#[from] subnets::delete::Error), + #[error(transparent)] + Subnets_PrepareNetworkPolicies(#[from] subnets::prepare_network_policies::Error), + #[error(transparent)] + Subnets_UnprepareNetworkPolicies(#[from] subnets::unprepare_network_policies::Error), + #[error(transparent)] + ResourceNavigationLinks_List(#[from] resource_navigation_links::list::Error), + #[error(transparent)] + ServiceAssociationLinks_List(#[from] service_association_links::list::Error), + #[error(transparent)] + Subnets_List(#[from] subnets::list::Error), + #[error(transparent)] + VirtualNetworkPeerings_Get(#[from] virtual_network_peerings::get::Error), + #[error(transparent)] + VirtualNetworkPeerings_CreateOrUpdate(#[from] virtual_network_peerings::create_or_update::Error), + #[error(transparent)] + VirtualNetworkPeerings_Delete(#[from] virtual_network_peerings::delete::Error), + #[error(transparent)] + VirtualNetworkPeerings_List(#[from] virtual_network_peerings::list::Error), + #[error(transparent)] + VirtualNetworks_CheckIpAddressAvailability(#[from] virtual_networks::check_ip_address_availability::Error), + #[error(transparent)] + VirtualNetworks_ListUsage(#[from] virtual_networks::list_usage::Error), + #[error(transparent)] + NetworkSecurityGroups_Get(#[from] network_security_groups::get::Error), + #[error(transparent)] + NetworkSecurityGroups_CreateOrUpdate(#[from] network_security_groups::create_or_update::Error), + #[error(transparent)] + NetworkSecurityGroups_UpdateTags(#[from] network_security_groups::update_tags::Error), + #[error(transparent)] + NetworkSecurityGroups_Delete(#[from] network_security_groups::delete::Error), + #[error(transparent)] + NetworkSecurityGroups_ListAll(#[from] network_security_groups::list_all::Error), + #[error(transparent)] + NetworkSecurityGroups_List(#[from] network_security_groups::list::Error), + #[error(transparent)] + SecurityRules_Get(#[from] security_rules::get::Error), + #[error(transparent)] + SecurityRules_CreateOrUpdate(#[from] security_rules::create_or_update::Error), + #[error(transparent)] + SecurityRules_Delete(#[from] security_rules::delete::Error), + #[error(transparent)] + SecurityRules_List(#[from] security_rules::list::Error), + #[error(transparent)] + DefaultSecurityRules_List(#[from] default_security_rules::list::Error), + #[error(transparent)] + DefaultSecurityRules_Get(#[from] default_security_rules::get::Error), + #[error(transparent)] + ApplicationSecurityGroups_Get(#[from] application_security_groups::get::Error), + #[error(transparent)] + ApplicationSecurityGroups_CreateOrUpdate(#[from] application_security_groups::create_or_update::Error), + #[error(transparent)] + ApplicationSecurityGroups_UpdateTags(#[from] application_security_groups::update_tags::Error), + #[error(transparent)] + ApplicationSecurityGroups_Delete(#[from] application_security_groups::delete::Error), + #[error(transparent)] + ApplicationSecurityGroups_ListAll(#[from] application_security_groups::list_all::Error), + #[error(transparent)] + ApplicationSecurityGroups_List(#[from] application_security_groups::list::Error), + #[error(transparent)] + NetworkWatchers_Get(#[from] network_watchers::get::Error), + #[error(transparent)] + NetworkWatchers_CreateOrUpdate(#[from] network_watchers::create_or_update::Error), + #[error(transparent)] + NetworkWatchers_UpdateTags(#[from] network_watchers::update_tags::Error), + #[error(transparent)] + NetworkWatchers_Delete(#[from] network_watchers::delete::Error), + #[error(transparent)] + NetworkWatchers_List(#[from] network_watchers::list::Error), + #[error(transparent)] + NetworkWatchers_ListAll(#[from] network_watchers::list_all::Error), + #[error(transparent)] + NetworkWatchers_GetTopology(#[from] network_watchers::get_topology::Error), + #[error(transparent)] + NetworkWatchers_VerifyIpFlow(#[from] network_watchers::verify_ip_flow::Error), + #[error(transparent)] + NetworkWatchers_GetNextHop(#[from] network_watchers::get_next_hop::Error), + #[error(transparent)] + NetworkWatchers_GetVmSecurityRules(#[from] network_watchers::get_vm_security_rules::Error), + #[error(transparent)] + PacketCaptures_Get(#[from] packet_captures::get::Error), + #[error(transparent)] + PacketCaptures_Create(#[from] packet_captures::create::Error), + #[error(transparent)] + PacketCaptures_Delete(#[from] packet_captures::delete::Error), + #[error(transparent)] + PacketCaptures_Stop(#[from] packet_captures::stop::Error), + #[error(transparent)] + PacketCaptures_GetStatus(#[from] packet_captures::get_status::Error), + #[error(transparent)] + PacketCaptures_List(#[from] packet_captures::list::Error), + #[error(transparent)] + NetworkWatchers_GetTroubleshooting(#[from] network_watchers::get_troubleshooting::Error), + #[error(transparent)] + NetworkWatchers_GetTroubleshootingResult(#[from] network_watchers::get_troubleshooting_result::Error), + #[error(transparent)] + NetworkWatchers_SetFlowLogConfiguration(#[from] network_watchers::set_flow_log_configuration::Error), + #[error(transparent)] + NetworkWatchers_GetFlowLogStatus(#[from] network_watchers::get_flow_log_status::Error), + #[error(transparent)] + NetworkWatchers_CheckConnectivity(#[from] network_watchers::check_connectivity::Error), + #[error(transparent)] + NetworkWatchers_GetAzureReachabilityReport(#[from] network_watchers::get_azure_reachability_report::Error), + #[error(transparent)] + NetworkWatchers_ListAvailableProviders(#[from] network_watchers::list_available_providers::Error), + #[error(transparent)] + NetworkWatchers_GetNetworkConfigurationDiagnostic(#[from] network_watchers::get_network_configuration_diagnostic::Error), + #[error(transparent)] + ConnectionMonitors_Get(#[from] connection_monitors::get::Error), + #[error(transparent)] + ConnectionMonitors_CreateOrUpdate(#[from] connection_monitors::create_or_update::Error), + #[error(transparent)] + ConnectionMonitors_UpdateTags(#[from] connection_monitors::update_tags::Error), + #[error(transparent)] + ConnectionMonitors_Delete(#[from] connection_monitors::delete::Error), + #[error(transparent)] + ConnectionMonitors_Stop(#[from] connection_monitors::stop::Error), + #[error(transparent)] + ConnectionMonitors_Start(#[from] connection_monitors::start::Error), + #[error(transparent)] + ConnectionMonitors_Query(#[from] connection_monitors::query::Error), + #[error(transparent)] + ConnectionMonitors_List(#[from] connection_monitors::list::Error), + #[error(transparent)] + FlowLogs_Get(#[from] flow_logs::get::Error), + #[error(transparent)] + FlowLogs_CreateOrUpdate(#[from] flow_logs::create_or_update::Error), + #[error(transparent)] + FlowLogs_UpdateTags(#[from] flow_logs::update_tags::Error), + #[error(transparent)] + FlowLogs_Delete(#[from] flow_logs::delete::Error), + #[error(transparent)] + FlowLogs_List(#[from] flow_logs::list::Error), + #[error(transparent)] + RouteTables_Get(#[from] route_tables::get::Error), + #[error(transparent)] + RouteTables_CreateOrUpdate(#[from] route_tables::create_or_update::Error), + #[error(transparent)] + RouteTables_UpdateTags(#[from] route_tables::update_tags::Error), + #[error(transparent)] + RouteTables_Delete(#[from] route_tables::delete::Error), + #[error(transparent)] + RouteTables_List(#[from] route_tables::list::Error), + #[error(transparent)] + RouteTables_ListAll(#[from] route_tables::list_all::Error), + #[error(transparent)] + Routes_Get(#[from] routes::get::Error), + #[error(transparent)] + Routes_CreateOrUpdate(#[from] routes::create_or_update::Error), + #[error(transparent)] + Routes_Delete(#[from] routes::delete::Error), + #[error(transparent)] + Routes_List(#[from] routes::list::Error), + #[error(transparent)] + ServiceEndpointPolicies_Get(#[from] service_endpoint_policies::get::Error), + #[error(transparent)] + ServiceEndpointPolicies_CreateOrUpdate(#[from] service_endpoint_policies::create_or_update::Error), + #[error(transparent)] + ServiceEndpointPolicies_UpdateTags(#[from] service_endpoint_policies::update_tags::Error), + #[error(transparent)] + ServiceEndpointPolicies_Delete(#[from] service_endpoint_policies::delete::Error), + #[error(transparent)] + ServiceEndpointPolicies_List(#[from] service_endpoint_policies::list::Error), + #[error(transparent)] + ServiceEndpointPolicies_ListByResourceGroup(#[from] service_endpoint_policies::list_by_resource_group::Error), + #[error(transparent)] + ServiceEndpointPolicyDefinitions_Get(#[from] service_endpoint_policy_definitions::get::Error), + #[error(transparent)] + ServiceEndpointPolicyDefinitions_CreateOrUpdate(#[from] service_endpoint_policy_definitions::create_or_update::Error), + #[error(transparent)] + ServiceEndpointPolicyDefinitions_Delete(#[from] service_endpoint_policy_definitions::delete::Error), + #[error(transparent)] + ServiceEndpointPolicyDefinitions_ListByResourceGroup(#[from] service_endpoint_policy_definitions::list_by_resource_group::Error), + #[error(transparent)] + PrivateEndpoints_Get(#[from] private_endpoints::get::Error), + #[error(transparent)] + PrivateEndpoints_CreateOrUpdate(#[from] private_endpoints::create_or_update::Error), + #[error(transparent)] + PrivateEndpoints_Delete(#[from] private_endpoints::delete::Error), + #[error(transparent)] + PrivateEndpoints_List(#[from] private_endpoints::list::Error), + #[error(transparent)] + PrivateEndpoints_ListBySubscription(#[from] private_endpoints::list_by_subscription::Error), + #[error(transparent)] + AvailablePrivateEndpointTypes_List(#[from] available_private_endpoint_types::list::Error), + #[error(transparent)] + AvailablePrivateEndpointTypes_ListByResourceGroup(#[from] available_private_endpoint_types::list_by_resource_group::Error), + #[error(transparent)] + PrivateDnsZoneGroups_Get(#[from] private_dns_zone_groups::get::Error), + #[error(transparent)] + PrivateDnsZoneGroups_CreateOrUpdate(#[from] private_dns_zone_groups::create_or_update::Error), + #[error(transparent)] + PrivateDnsZoneGroups_Delete(#[from] private_dns_zone_groups::delete::Error), + #[error(transparent)] + PrivateDnsZoneGroups_List(#[from] private_dns_zone_groups::list::Error), + #[error(transparent)] + PrivateLinkServices_Get(#[from] private_link_services::get::Error), + #[error(transparent)] + PrivateLinkServices_CreateOrUpdate(#[from] private_link_services::create_or_update::Error), + #[error(transparent)] + PrivateLinkServices_Delete(#[from] private_link_services::delete::Error), + #[error(transparent)] + PrivateLinkServices_List(#[from] private_link_services::list::Error), + #[error(transparent)] + PrivateLinkServices_ListBySubscription(#[from] private_link_services::list_by_subscription::Error), + #[error(transparent)] + PrivateLinkServices_GetPrivateEndpointConnection(#[from] private_link_services::get_private_endpoint_connection::Error), + #[error(transparent)] + PrivateLinkServices_UpdatePrivateEndpointConnection(#[from] private_link_services::update_private_endpoint_connection::Error), + #[error(transparent)] + PrivateLinkServices_DeletePrivateEndpointConnection(#[from] private_link_services::delete_private_endpoint_connection::Error), + #[error(transparent)] + PrivateLinkServices_ListPrivateEndpointConnections(#[from] private_link_services::list_private_endpoint_connections::Error), + #[error(transparent)] + PrivateLinkServices_CheckPrivateLinkServiceVisibility(#[from] private_link_services::check_private_link_service_visibility::Error), + #[error(transparent)] + PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup( + #[from] private_link_services::check_private_link_service_visibility_by_resource_group::Error, + ), + #[error(transparent)] + PrivateLinkServices_ListAutoApprovedPrivateLinkServices(#[from] private_link_services::list_auto_approved_private_link_services::Error), + #[error(transparent)] + PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup( + #[from] private_link_services::list_auto_approved_private_link_services_by_resource_group::Error, + ), + #[error(transparent)] + NetworkProfiles_Get(#[from] network_profiles::get::Error), + #[error(transparent)] + NetworkProfiles_CreateOrUpdate(#[from] network_profiles::create_or_update::Error), + #[error(transparent)] + NetworkProfiles_UpdateTags(#[from] network_profiles::update_tags::Error), + #[error(transparent)] + NetworkProfiles_Delete(#[from] network_profiles::delete::Error), + #[error(transparent)] + NetworkProfiles_ListAll(#[from] network_profiles::list_all::Error), + #[error(transparent)] + NetworkProfiles_List(#[from] network_profiles::list::Error), + #[error(transparent)] + PublicIpAddresses_Get(#[from] public_ip_addresses::get::Error), + #[error(transparent)] + PublicIpAddresses_CreateOrUpdate(#[from] public_ip_addresses::create_or_update::Error), + #[error(transparent)] + PublicIpAddresses_UpdateTags(#[from] public_ip_addresses::update_tags::Error), + #[error(transparent)] + PublicIpAddresses_Delete(#[from] public_ip_addresses::delete::Error), + #[error(transparent)] + PublicIpAddresses_ListAll(#[from] public_ip_addresses::list_all::Error), + #[error(transparent)] + PublicIpAddresses_List(#[from] public_ip_addresses::list::Error), + #[error(transparent)] + NatGateways_Get(#[from] nat_gateways::get::Error), + #[error(transparent)] + NatGateways_CreateOrUpdate(#[from] nat_gateways::create_or_update::Error), + #[error(transparent)] + NatGateways_UpdateTags(#[from] nat_gateways::update_tags::Error), + #[error(transparent)] + NatGateways_Delete(#[from] nat_gateways::delete::Error), + #[error(transparent)] + NatGateways_ListAll(#[from] nat_gateways::list_all::Error), + #[error(transparent)] + NatGateways_List(#[from] nat_gateways::list::Error), + #[error(transparent)] + AvailableDelegations_List(#[from] available_delegations::list::Error), + #[error(transparent)] + AvailableResourceGroupDelegations_List(#[from] available_resource_group_delegations::list::Error), + #[error(transparent)] + AvailableServiceAliases_List(#[from] available_service_aliases::list::Error), + #[error(transparent)] + AvailableServiceAliases_ListByResourceGroup(#[from] available_service_aliases::list_by_resource_group::Error), + #[error(transparent)] + AzureFirewalls_Get(#[from] azure_firewalls::get::Error), + #[error(transparent)] + AzureFirewalls_CreateOrUpdate(#[from] azure_firewalls::create_or_update::Error), + #[error(transparent)] + AzureFirewalls_UpdateTags(#[from] azure_firewalls::update_tags::Error), + #[error(transparent)] + AzureFirewalls_Delete(#[from] azure_firewalls::delete::Error), + #[error(transparent)] + AzureFirewalls_List(#[from] azure_firewalls::list::Error), + #[error(transparent)] + AzureFirewalls_ListAll(#[from] azure_firewalls::list_all::Error), + #[error(transparent)] + AzureFirewallFqdnTags_ListAll(#[from] azure_firewall_fqdn_tags::list_all::Error), + #[error(transparent)] + WebCategories_Get(#[from] web_categories::get::Error), + #[error(transparent)] + WebCategories_ListBySubscription(#[from] web_categories::list_by_subscription::Error), + #[error(transparent)] + BastionHosts_Get(#[from] bastion_hosts::get::Error), + #[error(transparent)] + BastionHosts_CreateOrUpdate(#[from] bastion_hosts::create_or_update::Error), + #[error(transparent)] + BastionHosts_UpdateTags(#[from] bastion_hosts::update_tags::Error), + #[error(transparent)] + BastionHosts_Delete(#[from] bastion_hosts::delete::Error), + #[error(transparent)] + BastionHosts_List(#[from] bastion_hosts::list::Error), + #[error(transparent)] + BastionHosts_ListByResourceGroup(#[from] bastion_hosts::list_by_resource_group::Error), + #[error(transparent)] + PutBastionShareableLink(#[from] put_bastion_shareable_link::Error), + #[error(transparent)] + DeleteBastionShareableLink(#[from] delete_bastion_shareable_link::Error), + #[error(transparent)] + GetBastionShareableLink(#[from] get_bastion_shareable_link::Error), + #[error(transparent)] + GetActiveSessions(#[from] get_active_sessions::Error), + #[error(transparent)] + DisconnectActiveSessions(#[from] disconnect_active_sessions::Error), + #[error(transparent)] + CheckDnsNameAvailability(#[from] check_dns_name_availability::Error), + #[error(transparent)] + NetworkInterfaces_ListCloudServiceRoleInstanceNetworkInterfaces( + #[from] network_interfaces::list_cloud_service_role_instance_network_interfaces::Error, + ), + #[error(transparent)] + NetworkInterfaces_ListCloudServiceNetworkInterfaces(#[from] network_interfaces::list_cloud_service_network_interfaces::Error), + #[error(transparent)] + NetworkInterfaces_GetCloudServiceNetworkInterface(#[from] network_interfaces::get_cloud_service_network_interface::Error), + #[error(transparent)] + PublicIpAddresses_ListCloudServicePublicIpAddresses(#[from] public_ip_addresses::list_cloud_service_public_ip_addresses::Error), + #[error(transparent)] + PublicIpAddresses_ListCloudServiceRoleInstancePublicIpAddresses( + #[from] public_ip_addresses::list_cloud_service_role_instance_public_ip_addresses::Error, + ), + #[error(transparent)] + PublicIpAddresses_GetCloudServicePublicIpAddress(#[from] public_ip_addresses::get_cloud_service_public_ip_address::Error), + #[error(transparent)] + CustomIpPrefixes_Get(#[from] custom_ip_prefixes::get::Error), + #[error(transparent)] + CustomIpPrefixes_CreateOrUpdate(#[from] custom_ip_prefixes::create_or_update::Error), + #[error(transparent)] + CustomIpPrefixes_UpdateTags(#[from] custom_ip_prefixes::update_tags::Error), + #[error(transparent)] + CustomIpPrefixes_Delete(#[from] custom_ip_prefixes::delete::Error), + #[error(transparent)] + CustomIpPrefixes_ListAll(#[from] custom_ip_prefixes::list_all::Error), + #[error(transparent)] + CustomIpPrefixes_List(#[from] custom_ip_prefixes::list::Error), + #[error(transparent)] + DdosCustomPolicies_Get(#[from] ddos_custom_policies::get::Error), + #[error(transparent)] + DdosCustomPolicies_CreateOrUpdate(#[from] ddos_custom_policies::create_or_update::Error), + #[error(transparent)] + DdosCustomPolicies_UpdateTags(#[from] ddos_custom_policies::update_tags::Error), + #[error(transparent)] + DdosCustomPolicies_Delete(#[from] ddos_custom_policies::delete::Error), + #[error(transparent)] + DdosProtectionPlans_Get(#[from] ddos_protection_plans::get::Error), + #[error(transparent)] + DdosProtectionPlans_CreateOrUpdate(#[from] ddos_protection_plans::create_or_update::Error), + #[error(transparent)] + DdosProtectionPlans_UpdateTags(#[from] ddos_protection_plans::update_tags::Error), + #[error(transparent)] + DdosProtectionPlans_Delete(#[from] ddos_protection_plans::delete::Error), + #[error(transparent)] + DdosProtectionPlans_List(#[from] ddos_protection_plans::list::Error), + #[error(transparent)] + DdosProtectionPlans_ListByResourceGroup(#[from] ddos_protection_plans::list_by_resource_group::Error), + #[error(transparent)] + DscpConfiguration_Get(#[from] dscp_configuration::get::Error), + #[error(transparent)] + DscpConfiguration_CreateOrUpdate(#[from] dscp_configuration::create_or_update::Error), + #[error(transparent)] + DscpConfiguration_Delete(#[from] dscp_configuration::delete::Error), + #[error(transparent)] + DscpConfiguration_List(#[from] dscp_configuration::list::Error), + #[error(transparent)] + DscpConfiguration_ListAll(#[from] dscp_configuration::list_all::Error), + #[error(transparent)] + AvailableEndpointServices_List(#[from] available_endpoint_services::list::Error), + #[error(transparent)] + ExpressRouteCircuitAuthorizations_Get(#[from] express_route_circuit_authorizations::get::Error), + #[error(transparent)] + ExpressRouteCircuitAuthorizations_CreateOrUpdate(#[from] express_route_circuit_authorizations::create_or_update::Error), + #[error(transparent)] + ExpressRouteCircuitAuthorizations_Delete(#[from] express_route_circuit_authorizations::delete::Error), + #[error(transparent)] + ExpressRouteCircuitAuthorizations_List(#[from] express_route_circuit_authorizations::list::Error), + #[error(transparent)] + ExpressRouteCircuitPeerings_Get(#[from] express_route_circuit_peerings::get::Error), + #[error(transparent)] + ExpressRouteCircuitPeerings_CreateOrUpdate(#[from] express_route_circuit_peerings::create_or_update::Error), + #[error(transparent)] + ExpressRouteCircuitPeerings_Delete(#[from] express_route_circuit_peerings::delete::Error), + #[error(transparent)] + ExpressRouteCircuitPeerings_List(#[from] express_route_circuit_peerings::list::Error), + #[error(transparent)] + ExpressRouteCircuitConnections_Get(#[from] express_route_circuit_connections::get::Error), + #[error(transparent)] + ExpressRouteCircuitConnections_CreateOrUpdate(#[from] express_route_circuit_connections::create_or_update::Error), + #[error(transparent)] + ExpressRouteCircuitConnections_Delete(#[from] express_route_circuit_connections::delete::Error), + #[error(transparent)] + ExpressRouteCircuitConnections_List(#[from] express_route_circuit_connections::list::Error), + #[error(transparent)] + PeerExpressRouteCircuitConnections_Get(#[from] peer_express_route_circuit_connections::get::Error), + #[error(transparent)] + PeerExpressRouteCircuitConnections_List(#[from] peer_express_route_circuit_connections::list::Error), + #[error(transparent)] + ExpressRouteCircuits_Get(#[from] express_route_circuits::get::Error), + #[error(transparent)] + ExpressRouteCircuits_CreateOrUpdate(#[from] express_route_circuits::create_or_update::Error), + #[error(transparent)] + ExpressRouteCircuits_UpdateTags(#[from] express_route_circuits::update_tags::Error), + #[error(transparent)] + ExpressRouteCircuits_Delete(#[from] express_route_circuits::delete::Error), + #[error(transparent)] + ExpressRouteCircuits_ListArpTable(#[from] express_route_circuits::list_arp_table::Error), + #[error(transparent)] + ExpressRouteCircuits_ListRoutesTable(#[from] express_route_circuits::list_routes_table::Error), + #[error(transparent)] + ExpressRouteCircuits_ListRoutesTableSummary(#[from] express_route_circuits::list_routes_table_summary::Error), + #[error(transparent)] + ExpressRouteCircuits_GetStats(#[from] express_route_circuits::get_stats::Error), + #[error(transparent)] + ExpressRouteCircuits_GetPeeringStats(#[from] express_route_circuits::get_peering_stats::Error), + #[error(transparent)] + ExpressRouteCircuits_List(#[from] express_route_circuits::list::Error), + #[error(transparent)] + ExpressRouteCircuits_ListAll(#[from] express_route_circuits::list_all::Error), + #[error(transparent)] + ExpressRouteServiceProviders_List(#[from] express_route_service_providers::list::Error), + #[error(transparent)] + VirtualWans_Get(#[from] virtual_wans::get::Error), + #[error(transparent)] + VirtualWans_CreateOrUpdate(#[from] virtual_wans::create_or_update::Error), + #[error(transparent)] + VirtualWans_UpdateTags(#[from] virtual_wans::update_tags::Error), + #[error(transparent)] + VirtualWans_Delete(#[from] virtual_wans::delete::Error), + #[error(transparent)] + VirtualWans_ListByResourceGroup(#[from] virtual_wans::list_by_resource_group::Error), + #[error(transparent)] + VirtualWans_List(#[from] virtual_wans::list::Error), + #[error(transparent)] + VpnSites_Get(#[from] vpn_sites::get::Error), + #[error(transparent)] + VpnSites_CreateOrUpdate(#[from] vpn_sites::create_or_update::Error), + #[error(transparent)] + VpnSites_UpdateTags(#[from] vpn_sites::update_tags::Error), + #[error(transparent)] + VpnSites_Delete(#[from] vpn_sites::delete::Error), + #[error(transparent)] + VpnSites_ListByResourceGroup(#[from] vpn_sites::list_by_resource_group::Error), + #[error(transparent)] + VpnSiteLinks_Get(#[from] vpn_site_links::get::Error), + #[error(transparent)] + VpnSiteLinks_ListByVpnSite(#[from] vpn_site_links::list_by_vpn_site::Error), + #[error(transparent)] + VpnSites_List(#[from] vpn_sites::list::Error), + #[error(transparent)] + VpnSitesConfiguration_Download(#[from] vpn_sites_configuration::download::Error), + #[error(transparent)] + SupportedSecurityProviders(#[from] supported_security_providers::Error), + #[error(transparent)] + VpnServerConfigurations_Get(#[from] vpn_server_configurations::get::Error), + #[error(transparent)] + VpnServerConfigurations_CreateOrUpdate(#[from] vpn_server_configurations::create_or_update::Error), + #[error(transparent)] + VpnServerConfigurations_UpdateTags(#[from] vpn_server_configurations::update_tags::Error), + #[error(transparent)] + VpnServerConfigurations_Delete(#[from] vpn_server_configurations::delete::Error), + #[error(transparent)] + VpnServerConfigurations_ListByResourceGroup(#[from] vpn_server_configurations::list_by_resource_group::Error), + #[error(transparent)] + ConfigurationPolicyGroups_Get(#[from] configuration_policy_groups::get::Error), + #[error(transparent)] + ConfigurationPolicyGroups_CreateOrUpdate(#[from] configuration_policy_groups::create_or_update::Error), + #[error(transparent)] + ConfigurationPolicyGroups_Delete(#[from] configuration_policy_groups::delete::Error), + #[error(transparent)] + ConfigurationPolicyGroups_ListByVpnServerConfiguration(#[from] configuration_policy_groups::list_by_vpn_server_configuration::Error), + #[error(transparent)] + VpnServerConfigurations_List(#[from] vpn_server_configurations::list::Error), + #[error(transparent)] + VirtualHubs_Get(#[from] virtual_hubs::get::Error), + #[error(transparent)] + VirtualHubs_CreateOrUpdate(#[from] virtual_hubs::create_or_update::Error), + #[error(transparent)] + VirtualHubs_UpdateTags(#[from] virtual_hubs::update_tags::Error), + #[error(transparent)] + VirtualHubs_Delete(#[from] virtual_hubs::delete::Error), + #[error(transparent)] + VirtualHubs_ListByResourceGroup(#[from] virtual_hubs::list_by_resource_group::Error), + #[error(transparent)] + VirtualHubs_List(#[from] virtual_hubs::list::Error), + #[error(transparent)] + HubVirtualNetworkConnections_Get(#[from] hub_virtual_network_connections::get::Error), + #[error(transparent)] + HubVirtualNetworkConnections_CreateOrUpdate(#[from] hub_virtual_network_connections::create_or_update::Error), + #[error(transparent)] + HubVirtualNetworkConnections_Delete(#[from] hub_virtual_network_connections::delete::Error), + #[error(transparent)] + HubVirtualNetworkConnections_List(#[from] hub_virtual_network_connections::list::Error), + #[error(transparent)] + VpnGateways_Get(#[from] vpn_gateways::get::Error), + #[error(transparent)] + VpnGateways_CreateOrUpdate(#[from] vpn_gateways::create_or_update::Error), + #[error(transparent)] + VpnGateways_UpdateTags(#[from] vpn_gateways::update_tags::Error), + #[error(transparent)] + VpnGateways_Delete(#[from] vpn_gateways::delete::Error), + #[error(transparent)] + VpnGateways_Reset(#[from] vpn_gateways::reset::Error), + #[error(transparent)] + VpnGateways_StartPacketCapture(#[from] vpn_gateways::start_packet_capture::Error), + #[error(transparent)] + VpnGateways_StopPacketCapture(#[from] vpn_gateways::stop_packet_capture::Error), + #[error(transparent)] + VpnLinkConnections_ResetConnection(#[from] vpn_link_connections::reset_connection::Error), + #[error(transparent)] + VpnGateways_ListByResourceGroup(#[from] vpn_gateways::list_by_resource_group::Error), + #[error(transparent)] + VpnGateways_List(#[from] vpn_gateways::list::Error), + #[error(transparent)] + VpnConnections_Get(#[from] vpn_connections::get::Error), + #[error(transparent)] + VpnConnections_CreateOrUpdate(#[from] vpn_connections::create_or_update::Error), + #[error(transparent)] + VpnConnections_Delete(#[from] vpn_connections::delete::Error), + #[error(transparent)] + VpnSiteLinkConnections_Get(#[from] vpn_site_link_connections::get::Error), + #[error(transparent)] + VpnLinkConnections_GetIkeSas(#[from] vpn_link_connections::get_ike_sas::Error), + #[error(transparent)] + VpnConnections_StartPacketCapture(#[from] vpn_connections::start_packet_capture::Error), + #[error(transparent)] + VpnConnections_StopPacketCapture(#[from] vpn_connections::stop_packet_capture::Error), + #[error(transparent)] + VpnConnections_ListByVpnGateway(#[from] vpn_connections::list_by_vpn_gateway::Error), + #[error(transparent)] + VpnLinkConnections_ListByVpnConnection(#[from] vpn_link_connections::list_by_vpn_connection::Error), + #[error(transparent)] + NatRules_Get(#[from] nat_rules::get::Error), + #[error(transparent)] + NatRules_CreateOrUpdate(#[from] nat_rules::create_or_update::Error), + #[error(transparent)] + NatRules_Delete(#[from] nat_rules::delete::Error), + #[error(transparent)] + NatRules_ListByVpnGateway(#[from] nat_rules::list_by_vpn_gateway::Error), + #[error(transparent)] + P2sVpnGateways_Get(#[from] p2s_vpn_gateways::get::Error), + #[error(transparent)] + P2sVpnGateways_CreateOrUpdate(#[from] p2s_vpn_gateways::create_or_update::Error), + #[error(transparent)] + P2sVpnGateways_UpdateTags(#[from] p2s_vpn_gateways::update_tags::Error), + #[error(transparent)] + P2sVpnGateways_Delete(#[from] p2s_vpn_gateways::delete::Error), + #[error(transparent)] + P2sVpnGateways_ListByResourceGroup(#[from] p2s_vpn_gateways::list_by_resource_group::Error), + #[error(transparent)] + P2sVpnGateways_List(#[from] p2s_vpn_gateways::list::Error), + #[error(transparent)] + P2sVpnGateways_Reset(#[from] p2s_vpn_gateways::reset::Error), + #[error(transparent)] + P2sVpnGateways_GenerateVpnProfile(#[from] p2s_vpn_gateways::generate_vpn_profile::Error), + #[error(transparent)] + P2sVpnGateways_GetP2sVpnConnectionHealth(#[from] p2s_vpn_gateways::get_p2s_vpn_connection_health::Error), + #[error(transparent)] + P2sVpnGateways_GetP2sVpnConnectionHealthDetailed(#[from] p2s_vpn_gateways::get_p2s_vpn_connection_health_detailed::Error), + #[error(transparent)] + VpnServerConfigurationsAssociatedWithVirtualWan_List(#[from] vpn_server_configurations_associated_with_virtual_wan::list::Error), + #[error(transparent)] + Generatevirtualwanvpnserverconfigurationvpnprofile(#[from] generatevirtualwanvpnserverconfigurationvpnprofile::Error), + #[error(transparent)] + VirtualHubRouteTableV2s_Get(#[from] virtual_hub_route_table_v2s::get::Error), + #[error(transparent)] + VirtualHubRouteTableV2s_CreateOrUpdate(#[from] virtual_hub_route_table_v2s::create_or_update::Error), + #[error(transparent)] + VirtualHubRouteTableV2s_Delete(#[from] virtual_hub_route_table_v2s::delete::Error), + #[error(transparent)] + VirtualHubRouteTableV2s_List(#[from] virtual_hub_route_table_v2s::list::Error), + #[error(transparent)] + P2sVpnGateways_DisconnectP2sVpnConnections(#[from] p2s_vpn_gateways::disconnect_p2s_vpn_connections::Error), + #[error(transparent)] + ExpressRouteGateways_ListBySubscription(#[from] express_route_gateways::list_by_subscription::Error), + #[error(transparent)] + ExpressRouteGateways_ListByResourceGroup(#[from] express_route_gateways::list_by_resource_group::Error), + #[error(transparent)] + ExpressRouteGateways_Get(#[from] express_route_gateways::get::Error), + #[error(transparent)] + ExpressRouteGateways_CreateOrUpdate(#[from] express_route_gateways::create_or_update::Error), + #[error(transparent)] + ExpressRouteGateways_UpdateTags(#[from] express_route_gateways::update_tags::Error), + #[error(transparent)] + ExpressRouteGateways_Delete(#[from] express_route_gateways::delete::Error), + #[error(transparent)] + ExpressRouteConnections_Get(#[from] express_route_connections::get::Error), + #[error(transparent)] + ExpressRouteConnections_CreateOrUpdate(#[from] express_route_connections::create_or_update::Error), + #[error(transparent)] + ExpressRouteConnections_Delete(#[from] express_route_connections::delete::Error), + #[error(transparent)] + ExpressRouteConnections_List(#[from] express_route_connections::list::Error), + #[error(transparent)] + VirtualHubBgpConnection_Get(#[from] virtual_hub_bgp_connection::get::Error), + #[error(transparent)] + VirtualHubBgpConnection_CreateOrUpdate(#[from] virtual_hub_bgp_connection::create_or_update::Error), + #[error(transparent)] + VirtualHubBgpConnection_Delete(#[from] virtual_hub_bgp_connection::delete::Error), + #[error(transparent)] + VirtualHubBgpConnections_List(#[from] virtual_hub_bgp_connections::list::Error), + #[error(transparent)] + VirtualHubBgpConnections_ListLearnedRoutes(#[from] virtual_hub_bgp_connections::list_learned_routes::Error), + #[error(transparent)] + VirtualHubBgpConnections_ListAdvertisedRoutes(#[from] virtual_hub_bgp_connections::list_advertised_routes::Error), + #[error(transparent)] + VirtualHubIpConfiguration_Get(#[from] virtual_hub_ip_configuration::get::Error), + #[error(transparent)] + VirtualHubIpConfiguration_CreateOrUpdate(#[from] virtual_hub_ip_configuration::create_or_update::Error), + #[error(transparent)] + VirtualHubIpConfiguration_Delete(#[from] virtual_hub_ip_configuration::delete::Error), + #[error(transparent)] + VirtualHubIpConfiguration_List(#[from] virtual_hub_ip_configuration::list::Error), + #[error(transparent)] + HubRouteTables_Get(#[from] hub_route_tables::get::Error), + #[error(transparent)] + HubRouteTables_CreateOrUpdate(#[from] hub_route_tables::create_or_update::Error), + #[error(transparent)] + HubRouteTables_Delete(#[from] hub_route_tables::delete::Error), + #[error(transparent)] + HubRouteTables_List(#[from] hub_route_tables::list::Error), + #[error(transparent)] + VirtualHubs_GetEffectiveVirtualHubRoutes(#[from] virtual_hubs::get_effective_virtual_hub_routes::Error), + #[error(transparent)] + RoutingIntent_Get(#[from] routing_intent::get::Error), + #[error(transparent)] + RoutingIntent_CreateOrUpdate(#[from] routing_intent::create_or_update::Error), + #[error(transparent)] + RoutingIntent_Delete(#[from] routing_intent::delete::Error), + #[error(transparent)] + RoutingIntent_List(#[from] routing_intent::list::Error), + #[error(transparent)] + VirtualNetworkGateways_Get(#[from] virtual_network_gateways::get::Error), + #[error(transparent)] + VirtualNetworkGateways_CreateOrUpdate(#[from] virtual_network_gateways::create_or_update::Error), + #[error(transparent)] + VirtualNetworkGateways_UpdateTags(#[from] virtual_network_gateways::update_tags::Error), + #[error(transparent)] + VirtualNetworkGateways_Delete(#[from] virtual_network_gateways::delete::Error), + #[error(transparent)] + VirtualNetworkGateways_List(#[from] virtual_network_gateways::list::Error), + #[error(transparent)] + VirtualNetworkGateways_ListConnections(#[from] virtual_network_gateways::list_connections::Error), + #[error(transparent)] + VirtualNetworkGateways_Reset(#[from] virtual_network_gateways::reset::Error), + #[error(transparent)] + VirtualNetworkGateways_ResetVpnClientSharedKey(#[from] virtual_network_gateways::reset_vpn_client_shared_key::Error), + #[error(transparent)] + VirtualNetworkGateways_Generatevpnclientpackage(#[from] virtual_network_gateways::generatevpnclientpackage::Error), + #[error(transparent)] + VirtualNetworkGateways_GenerateVpnProfile(#[from] virtual_network_gateways::generate_vpn_profile::Error), + #[error(transparent)] + VirtualNetworkGateways_GetVpnProfilePackageUrl(#[from] virtual_network_gateways::get_vpn_profile_package_url::Error), + #[error(transparent)] + VirtualNetworkGateways_GetBgpPeerStatus(#[from] virtual_network_gateways::get_bgp_peer_status::Error), + #[error(transparent)] + VirtualNetworkGateways_SupportedVpnDevices(#[from] virtual_network_gateways::supported_vpn_devices::Error), + #[error(transparent)] + VirtualNetworkGateways_GetLearnedRoutes(#[from] virtual_network_gateways::get_learned_routes::Error), + #[error(transparent)] + VirtualNetworkGateways_GetAdvertisedRoutes(#[from] virtual_network_gateways::get_advertised_routes::Error), + #[error(transparent)] + VirtualNetworkGateways_SetVpnclientIpsecParameters(#[from] virtual_network_gateways::set_vpnclient_ipsec_parameters::Error), + #[error(transparent)] + VirtualNetworkGateways_GetVpnclientIpsecParameters(#[from] virtual_network_gateways::get_vpnclient_ipsec_parameters::Error), + #[error(transparent)] + VirtualNetworkGateways_VpnDeviceConfigurationScript(#[from] virtual_network_gateways::vpn_device_configuration_script::Error), + #[error(transparent)] + VirtualNetworkGateways_StartPacketCapture(#[from] virtual_network_gateways::start_packet_capture::Error), + #[error(transparent)] + VirtualNetworkGateways_StopPacketCapture(#[from] virtual_network_gateways::stop_packet_capture::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_Get(#[from] virtual_network_gateway_connections::get::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_CreateOrUpdate(#[from] virtual_network_gateway_connections::create_or_update::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_UpdateTags(#[from] virtual_network_gateway_connections::update_tags::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_Delete(#[from] virtual_network_gateway_connections::delete::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_GetSharedKey(#[from] virtual_network_gateway_connections::get_shared_key::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_SetSharedKey(#[from] virtual_network_gateway_connections::set_shared_key::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_List(#[from] virtual_network_gateway_connections::list::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_ResetSharedKey(#[from] virtual_network_gateway_connections::reset_shared_key::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_StartPacketCapture(#[from] virtual_network_gateway_connections::start_packet_capture::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_StopPacketCapture(#[from] virtual_network_gateway_connections::stop_packet_capture::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_GetIkeSas(#[from] virtual_network_gateway_connections::get_ike_sas::Error), + #[error(transparent)] + VirtualNetworkGatewayConnections_ResetConnection(#[from] virtual_network_gateway_connections::reset_connection::Error), + #[error(transparent)] + LocalNetworkGateways_Get(#[from] local_network_gateways::get::Error), + #[error(transparent)] + LocalNetworkGateways_CreateOrUpdate(#[from] local_network_gateways::create_or_update::Error), + #[error(transparent)] + LocalNetworkGateways_UpdateTags(#[from] local_network_gateways::update_tags::Error), + #[error(transparent)] + LocalNetworkGateways_Delete(#[from] local_network_gateways::delete::Error), + #[error(transparent)] + LocalNetworkGateways_List(#[from] local_network_gateways::list::Error), + #[error(transparent)] + VirtualNetworkGateways_GetVpnclientConnectionHealth(#[from] virtual_network_gateways::get_vpnclient_connection_health::Error), + #[error(transparent)] + VirtualNetworkGateways_DisconnectVirtualNetworkGatewayVpnConnections( + #[from] virtual_network_gateways::disconnect_virtual_network_gateway_vpn_connections::Error, + ), + #[error(transparent)] + VirtualNetworkGatewayNatRules_Get(#[from] virtual_network_gateway_nat_rules::get::Error), + #[error(transparent)] + VirtualNetworkGatewayNatRules_CreateOrUpdate(#[from] virtual_network_gateway_nat_rules::create_or_update::Error), + #[error(transparent)] + VirtualNetworkGatewayNatRules_Delete(#[from] virtual_network_gateway_nat_rules::delete::Error), + #[error(transparent)] + VirtualNetworkGatewayNatRules_ListByVirtualNetworkGateway( + #[from] virtual_network_gateway_nat_rules::list_by_virtual_network_gateway::Error, + ), + #[error(transparent)] + ExpressRouteCrossConnections_List(#[from] express_route_cross_connections::list::Error), + #[error(transparent)] + ExpressRouteCrossConnections_ListByResourceGroup(#[from] express_route_cross_connections::list_by_resource_group::Error), + #[error(transparent)] + ExpressRouteCrossConnections_Get(#[from] express_route_cross_connections::get::Error), + #[error(transparent)] + ExpressRouteCrossConnections_CreateOrUpdate(#[from] express_route_cross_connections::create_or_update::Error), + #[error(transparent)] + ExpressRouteCrossConnections_UpdateTags(#[from] express_route_cross_connections::update_tags::Error), + #[error(transparent)] + ExpressRouteCrossConnectionPeerings_List(#[from] express_route_cross_connection_peerings::list::Error), + #[error(transparent)] + ExpressRouteCrossConnectionPeerings_Get(#[from] express_route_cross_connection_peerings::get::Error), + #[error(transparent)] + ExpressRouteCrossConnectionPeerings_CreateOrUpdate(#[from] express_route_cross_connection_peerings::create_or_update::Error), + #[error(transparent)] + ExpressRouteCrossConnectionPeerings_Delete(#[from] express_route_cross_connection_peerings::delete::Error), + #[error(transparent)] + ExpressRouteCrossConnections_ListArpTable(#[from] express_route_cross_connections::list_arp_table::Error), + #[error(transparent)] + ExpressRouteCrossConnections_ListRoutesTableSummary(#[from] express_route_cross_connections::list_routes_table_summary::Error), + #[error(transparent)] + ExpressRouteCrossConnections_ListRoutesTable(#[from] express_route_cross_connections::list_routes_table::Error), + #[error(transparent)] + ExpressRoutePortsLocations_List(#[from] express_route_ports_locations::list::Error), + #[error(transparent)] + ExpressRoutePortsLocations_Get(#[from] express_route_ports_locations::get::Error), + #[error(transparent)] + ExpressRoutePorts_Get(#[from] express_route_ports::get::Error), + #[error(transparent)] + ExpressRoutePorts_CreateOrUpdate(#[from] express_route_ports::create_or_update::Error), + #[error(transparent)] + ExpressRoutePorts_UpdateTags(#[from] express_route_ports::update_tags::Error), + #[error(transparent)] + ExpressRoutePorts_Delete(#[from] express_route_ports::delete::Error), + #[error(transparent)] + ExpressRoutePorts_ListByResourceGroup(#[from] express_route_ports::list_by_resource_group::Error), + #[error(transparent)] + ExpressRoutePorts_List(#[from] express_route_ports::list::Error), + #[error(transparent)] + ExpressRouteLinks_Get(#[from] express_route_links::get::Error), + #[error(transparent)] + ExpressRouteLinks_List(#[from] express_route_links::list::Error), + #[error(transparent)] + ExpressRoutePorts_GenerateLoa(#[from] express_route_ports::generate_loa::Error), + #[error(transparent)] + ExpressRoutePortAuthorizations_Get(#[from] express_route_port_authorizations::get::Error), + #[error(transparent)] + ExpressRoutePortAuthorizations_CreateOrUpdate(#[from] express_route_port_authorizations::create_or_update::Error), + #[error(transparent)] + ExpressRoutePortAuthorizations_Delete(#[from] express_route_port_authorizations::delete::Error), + #[error(transparent)] + ExpressRoutePortAuthorizations_List(#[from] express_route_port_authorizations::list::Error), + #[error(transparent)] + FirewallPolicies_Get(#[from] firewall_policies::get::Error), + #[error(transparent)] + FirewallPolicies_CreateOrUpdate(#[from] firewall_policies::create_or_update::Error), + #[error(transparent)] + FirewallPolicies_UpdateTags(#[from] firewall_policies::update_tags::Error), + #[error(transparent)] + FirewallPolicies_Delete(#[from] firewall_policies::delete::Error), + #[error(transparent)] + FirewallPolicies_List(#[from] firewall_policies::list::Error), + #[error(transparent)] + FirewallPolicies_ListAll(#[from] firewall_policies::list_all::Error), + #[error(transparent)] + FirewallPolicyRuleCollectionGroups_Get(#[from] firewall_policy_rule_collection_groups::get::Error), + #[error(transparent)] + FirewallPolicyRuleCollectionGroups_CreateOrUpdate(#[from] firewall_policy_rule_collection_groups::create_or_update::Error), + #[error(transparent)] + FirewallPolicyRuleCollectionGroups_Delete(#[from] firewall_policy_rule_collection_groups::delete::Error), + #[error(transparent)] + FirewallPolicyRuleCollectionGroups_List(#[from] firewall_policy_rule_collection_groups::list::Error), + #[error(transparent)] + FirewallPolicyIdpsSignatures_List(#[from] firewall_policy_idps_signatures::list::Error), + #[error(transparent)] + FirewallPolicyIdpsSignaturesOverrides_Get(#[from] firewall_policy_idps_signatures_overrides::get::Error), + #[error(transparent)] + FirewallPolicyIdpsSignaturesOverrides_Put(#[from] firewall_policy_idps_signatures_overrides::put::Error), + #[error(transparent)] + FirewallPolicyIdpsSignaturesOverrides_Patch(#[from] firewall_policy_idps_signatures_overrides::patch::Error), + #[error(transparent)] + FirewallPolicyIdpsSignaturesFilterValues_List(#[from] firewall_policy_idps_signatures_filter_values::list::Error), + #[error(transparent)] + FirewallPolicyIdpsSignaturesOverrides_List(#[from] firewall_policy_idps_signatures_overrides::list::Error), + #[error(transparent)] + IpAllocations_Get(#[from] ip_allocations::get::Error), + #[error(transparent)] + IpAllocations_CreateOrUpdate(#[from] ip_allocations::create_or_update::Error), + #[error(transparent)] + IpAllocations_UpdateTags(#[from] ip_allocations::update_tags::Error), + #[error(transparent)] + IpAllocations_Delete(#[from] ip_allocations::delete::Error), + #[error(transparent)] + IpAllocations_List(#[from] ip_allocations::list::Error), + #[error(transparent)] + IpAllocations_ListByResourceGroup(#[from] ip_allocations::list_by_resource_group::Error), + #[error(transparent)] + IpGroups_Get(#[from] ip_groups::get::Error), + #[error(transparent)] + IpGroups_CreateOrUpdate(#[from] ip_groups::create_or_update::Error), + #[error(transparent)] + IpGroups_UpdateGroups(#[from] ip_groups::update_groups::Error), + #[error(transparent)] + IpGroups_Delete(#[from] ip_groups::delete::Error), + #[error(transparent)] + IpGroups_ListByResourceGroup(#[from] ip_groups::list_by_resource_group::Error), + #[error(transparent)] + IpGroups_List(#[from] ip_groups::list::Error), + #[error(transparent)] + NetworkVirtualAppliances_Get(#[from] network_virtual_appliances::get::Error), + #[error(transparent)] + NetworkVirtualAppliances_CreateOrUpdate(#[from] network_virtual_appliances::create_or_update::Error), + #[error(transparent)] + NetworkVirtualAppliances_UpdateTags(#[from] network_virtual_appliances::update_tags::Error), + #[error(transparent)] + NetworkVirtualAppliances_Delete(#[from] network_virtual_appliances::delete::Error), + #[error(transparent)] + NetworkVirtualAppliances_ListByResourceGroup(#[from] network_virtual_appliances::list_by_resource_group::Error), + #[error(transparent)] + NetworkVirtualAppliances_List(#[from] network_virtual_appliances::list::Error), + #[error(transparent)] + VirtualApplianceSites_Get(#[from] virtual_appliance_sites::get::Error), + #[error(transparent)] + VirtualApplianceSites_CreateOrUpdate(#[from] virtual_appliance_sites::create_or_update::Error), + #[error(transparent)] + VirtualApplianceSites_Delete(#[from] virtual_appliance_sites::delete::Error), + #[error(transparent)] + VirtualApplianceSites_List(#[from] virtual_appliance_sites::list::Error), + #[error(transparent)] + VirtualApplianceSkus_List(#[from] virtual_appliance_skus::list::Error), + #[error(transparent)] + VirtualApplianceSkus_Get(#[from] virtual_appliance_skus::get::Error), + #[error(transparent)] + InboundSecurityRule_CreateOrUpdate(#[from] inbound_security_rule::create_or_update::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + PublicIpPrefixes_Get(#[from] public_ip_prefixes::get::Error), + #[error(transparent)] + PublicIpPrefixes_CreateOrUpdate(#[from] public_ip_prefixes::create_or_update::Error), + #[error(transparent)] + PublicIpPrefixes_UpdateTags(#[from] public_ip_prefixes::update_tags::Error), + #[error(transparent)] + PublicIpPrefixes_Delete(#[from] public_ip_prefixes::delete::Error), + #[error(transparent)] + PublicIpPrefixes_ListAll(#[from] public_ip_prefixes::list_all::Error), + #[error(transparent)] + PublicIpPrefixes_List(#[from] public_ip_prefixes::list::Error), + #[error(transparent)] + RouteFilters_Get(#[from] route_filters::get::Error), + #[error(transparent)] + RouteFilters_CreateOrUpdate(#[from] route_filters::create_or_update::Error), + #[error(transparent)] + RouteFilters_UpdateTags(#[from] route_filters::update_tags::Error), + #[error(transparent)] + RouteFilters_Delete(#[from] route_filters::delete::Error), + #[error(transparent)] + RouteFilters_ListByResourceGroup(#[from] route_filters::list_by_resource_group::Error), + #[error(transparent)] + RouteFilters_List(#[from] route_filters::list::Error), + #[error(transparent)] + RouteFilterRules_Get(#[from] route_filter_rules::get::Error), + #[error(transparent)] + RouteFilterRules_CreateOrUpdate(#[from] route_filter_rules::create_or_update::Error), + #[error(transparent)] + RouteFilterRules_Delete(#[from] route_filter_rules::delete::Error), + #[error(transparent)] + RouteFilterRules_ListByRouteFilter(#[from] route_filter_rules::list_by_route_filter::Error), + #[error(transparent)] + SecurityPartnerProviders_Get(#[from] security_partner_providers::get::Error), + #[error(transparent)] + SecurityPartnerProviders_CreateOrUpdate(#[from] security_partner_providers::create_or_update::Error), + #[error(transparent)] + SecurityPartnerProviders_UpdateTags(#[from] security_partner_providers::update_tags::Error), + #[error(transparent)] + SecurityPartnerProviders_Delete(#[from] security_partner_providers::delete::Error), + #[error(transparent)] + SecurityPartnerProviders_ListByResourceGroup(#[from] security_partner_providers::list_by_resource_group::Error), + #[error(transparent)] + SecurityPartnerProviders_List(#[from] security_partner_providers::list::Error), + #[error(transparent)] + BgpServiceCommunities_List(#[from] bgp_service_communities::list::Error), + #[error(transparent)] + ServiceTags_List(#[from] service_tags::list::Error), + #[error(transparent)] + ServiceTagInformation_List(#[from] service_tag_information::list::Error), + #[error(transparent)] + Usages_List(#[from] usages::list::Error), + #[error(transparent)] + VirtualRouters_Get(#[from] virtual_routers::get::Error), + #[error(transparent)] + VirtualRouters_CreateOrUpdate(#[from] virtual_routers::create_or_update::Error), + #[error(transparent)] + VirtualRouters_Delete(#[from] virtual_routers::delete::Error), + #[error(transparent)] + VirtualRouters_ListByResourceGroup(#[from] virtual_routers::list_by_resource_group::Error), + #[error(transparent)] + VirtualRouters_List(#[from] virtual_routers::list::Error), + #[error(transparent)] + VirtualRouterPeerings_Get(#[from] virtual_router_peerings::get::Error), + #[error(transparent)] + VirtualRouterPeerings_CreateOrUpdate(#[from] virtual_router_peerings::create_or_update::Error), + #[error(transparent)] + VirtualRouterPeerings_Delete(#[from] virtual_router_peerings::delete::Error), + #[error(transparent)] + VirtualRouterPeerings_List(#[from] virtual_router_peerings::list::Error), + #[error(transparent)] + NetworkInterfaces_ListVirtualMachineScaleSetVmNetworkInterfaces( + #[from] network_interfaces::list_virtual_machine_scale_set_vm_network_interfaces::Error, + ), + #[error(transparent)] + NetworkInterfaces_ListVirtualMachineScaleSetNetworkInterfaces( + #[from] network_interfaces::list_virtual_machine_scale_set_network_interfaces::Error, + ), + #[error(transparent)] + NetworkInterfaces_GetVirtualMachineScaleSetNetworkInterface( + #[from] network_interfaces::get_virtual_machine_scale_set_network_interface::Error, + ), + #[error(transparent)] + NetworkInterfaces_ListVirtualMachineScaleSetIpConfigurations( + #[from] network_interfaces::list_virtual_machine_scale_set_ip_configurations::Error, + ), + #[error(transparent)] + NetworkInterfaces_GetVirtualMachineScaleSetIpConfiguration( + #[from] network_interfaces::get_virtual_machine_scale_set_ip_configuration::Error, + ), + #[error(transparent)] + PublicIpAddresses_ListVirtualMachineScaleSetPublicIpAddresses( + #[from] public_ip_addresses::list_virtual_machine_scale_set_public_ip_addresses::Error, + ), + #[error(transparent)] + PublicIpAddresses_ListVirtualMachineScaleSetVmPublicIpAddresses( + #[from] public_ip_addresses::list_virtual_machine_scale_set_vm_public_ip_addresses::Error, + ), + #[error(transparent)] + PublicIpAddresses_GetVirtualMachineScaleSetPublicIpAddress( + #[from] public_ip_addresses::get_virtual_machine_scale_set_public_ip_address::Error, + ), + #[error(transparent)] + WebApplicationFirewallPolicies_List(#[from] web_application_firewall_policies::list::Error), + #[error(transparent)] + WebApplicationFirewallPolicies_ListAll(#[from] web_application_firewall_policies::list_all::Error), + #[error(transparent)] + WebApplicationFirewallPolicies_Get(#[from] web_application_firewall_policies::get::Error), + #[error(transparent)] + WebApplicationFirewallPolicies_CreateOrUpdate(#[from] web_application_firewall_policies::create_or_update::Error), + #[error(transparent)] + WebApplicationFirewallPolicies_Delete(#[from] web_application_firewall_policies::delete::Error), +} +pub mod application_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn stop( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn backend_health( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> backend_health::Builder { + backend_health::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn backend_health_on_demand( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + probe_request: impl Into, + ) -> backend_health_on_demand::Builder { + backend_health_on_demand::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + probe_request: probe_request.into(), + expand: None, + } + } + pub fn list_available_server_variables(&self, subscription_id: impl Into) -> list_available_server_variables::Builder { + list_available_server_variables::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_request_headers(&self, subscription_id: impl Into) -> list_available_request_headers::Builder { + list_available_request_headers::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_response_headers(&self, subscription_id: impl Into) -> list_available_response_headers::Builder { + list_available_response_headers::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_waf_rule_sets(&self, subscription_id: impl Into) -> list_available_waf_rule_sets::Builder { + list_available_waf_rule_sets::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_ssl_options(&self, subscription_id: impl Into) -> list_available_ssl_options::Builder { + list_available_ssl_options::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_ssl_predefined_policies( + &self, + subscription_id: impl Into, + ) -> list_available_ssl_predefined_policies::Builder { + list_available_ssl_predefined_policies::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_ssl_predefined_policy( + &self, + subscription_id: impl Into, + predefined_policy_name: impl Into, + ) -> get_ssl_predefined_policy::Builder { + get_ssl_predefined_policy::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + predefined_policy_name: predefined_policy_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApplicationGateway), + Ok200(models::ApplicationGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) parameters: models::ApplicationGateway, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGateways", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod backend_health { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationGatewayBackendHealth), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/backendhealth", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayBackendHealth = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod backend_health_on_demand { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationGatewayBackendHealthOnDemand), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) probe_request: models::ApplicationGatewayOnDemandProbe, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/getBackendHealthOnDemand", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.probe_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayBackendHealthOnDemand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_server_variables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableServerVariablesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_request_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableRequestHeadersResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_response_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableResponseHeadersResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_waf_rule_sets { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableWafRuleSetsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_ssl_options { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableSslOptions = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_ssl_predefined_policies { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayAvailableSslPredefinedPolicies = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_ssl_predefined_policy { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) predefined_policy_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{}" , self . client . endpoint () , & self . subscription_id , & self . predefined_policy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewaySslPredefinedPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod application_gateway_private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayPrivateLinkResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod application_gateway_private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + connection_name: connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + application_gateway_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_gateway_name: application_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . application_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayPrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ApplicationGatewayPrivateEndpointConnection), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) parameters: models::ApplicationGatewayPrivateEndpointConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . application_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayPrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . application_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture< + 'static, + std::result::Result, + > { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationGateways/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . application_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationGatewayPrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_interfaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_effective_route_table( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> get_effective_route_table::Builder { + get_effective_route_table::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_effective_network_security_groups( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> list_effective_network_security_groups::Builder { + list_effective_network_security_groups::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_cloud_service_role_instance_network_interfaces( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + role_instance_name: impl Into, + subscription_id: impl Into, + ) -> list_cloud_service_role_instance_network_interfaces::Builder { + list_cloud_service_role_instance_network_interfaces::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + role_instance_name: role_instance_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_cloud_service_network_interfaces( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> list_cloud_service_network_interfaces::Builder { + list_cloud_service_network_interfaces::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_cloud_service_network_interface( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + role_instance_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> get_cloud_service_network_interface::Builder { + get_cloud_service_network_interface::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + role_instance_name: role_instance_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_virtual_machine_scale_set_vm_network_interfaces( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + subscription_id: impl Into, + ) -> list_virtual_machine_scale_set_vm_network_interfaces::Builder { + list_virtual_machine_scale_set_vm_network_interfaces::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_virtual_machine_scale_set_network_interfaces( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> list_virtual_machine_scale_set_network_interfaces::Builder { + list_virtual_machine_scale_set_network_interfaces::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_virtual_machine_scale_set_network_interface( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> get_virtual_machine_scale_set_network_interface::Builder { + get_virtual_machine_scale_set_network_interface::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_virtual_machine_scale_set_ip_configurations( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> list_virtual_machine_scale_set_ip_configurations::Builder { + list_virtual_machine_scale_set_ip_configurations::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn get_virtual_machine_scale_set_ip_configuration( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get_virtual_machine_scale_set_ip_configuration::Builder { + get_virtual_machine_scale_set_ip_configuration::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::NetworkInterface), + Ok200(models::NetworkInterface), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) parameters: models::NetworkInterface, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkInterfaces", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_effective_route_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::EffectiveRouteListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/effectiveRouteTable", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EffectiveRouteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_effective_network_security_groups { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::EffectiveNetworkSecurityGroupListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/effectiveNetworkSecurityGroups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_interface_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EffectiveNetworkSecurityGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cloud_service_role_instance_network_interfaces { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) role_instance_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cloud_service_name , & self . role_instance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cloud_service_network_interfaces { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/networkInterfaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_cloud_service_network_interface { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) role_instance_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cloud_service_name , & self . role_instance_name , & self . network_interface_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_virtual_machine_scale_set_vm_network_interfaces { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_virtual_machine_scale_set_network_interfaces { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.Compute/virtualMachineScaleSets/{}/networkInterfaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_virtual_machine_scale_set_network_interface { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index , & self . network_interface_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterface = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_virtual_machine_scale_set_ip_configurations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipConfigurations" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index , & self . network_interface_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceIpConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_virtual_machine_scale_set_ip_configuration { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipConfigurations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index , & self . network_interface_name , & self . ip_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_interface_ip_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/ipConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceIpConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/ipConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name, + &self.ip_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_interface_load_balancers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/loadBalancers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceLoadBalancerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_interface_tap_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + tap_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + tap_configuration_name: tap_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + tap_configuration_name: impl Into, + tap_configuration_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + tap_configuration_name: tap_configuration_name.into(), + tap_configuration_parameters: tap_configuration_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + tap_configuration_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + tap_configuration_name: tap_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_interface_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_interface_name: network_interface_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) tap_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/tapConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name, + &self.tap_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceTapConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkInterfaceTapConfiguration), + Created201(models::NetworkInterfaceTapConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) tap_configuration_name: String, + pub(crate) tap_configuration_parameters: models::NetworkInterfaceTapConfiguration, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/tapConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name, + &self.tap_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.tap_configuration_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceTapConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceTapConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) tap_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/tapConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name, + &self.tap_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_interface_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/tapConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_interface_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceTapConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_network_taps { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + tap_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + tap_name: tap_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + tap_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + tap_name: tap_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + tap_name: impl Into, + tap_parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + tap_name: tap_name.into(), + tap_parameters: tap_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + tap_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + tap_name: tap_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) tap_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.tap_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTap = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetworkTap), + Created201(models::VirtualNetworkTap), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) tap_name: String, + pub(crate) parameters: models::VirtualNetworkTap, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.tap_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTap = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTap = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) tap_name: String, + pub(crate) tap_parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.tap_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.tap_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTap = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) tap_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.tap_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/virtualNetworkTaps", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTapListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkTapListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn swap_public_ip_addresses( + &self, + location: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> swap_public_ip_addresses::Builder { + swap_public_ip_addresses::Builder { + client: self.0.clone(), + location: location.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_inbound_nat_rule_port_mappings( + &self, + group_name: impl Into, + load_balancer_name: impl Into, + backend_pool_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> list_inbound_nat_rule_port_mappings::Builder { + list_inbound_nat_rule_port_mappings::Builder { + client: self.0.clone(), + group_name: group_name.into(), + load_balancer_name: load_balancer_name.into(), + backend_pool_name: backend_pool_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LoadBalancer), + Ok200(models::LoadBalancer), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) parameters: models::LoadBalancer, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/loadBalancers", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod swap_public_ip_addresses { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) parameters: models::LoadBalancerVipSwapRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/setLoadBalancerFrontendPublicIpAddresses", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_inbound_nat_rule_port_mappings { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BackendAddressInboundNatRulePortMappings), + Accepted202(models::BackendAddressInboundNatRulePortMappings), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) backend_pool_name: String, + pub(crate) parameters: models::QueryInboundNatRulePortMappingRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools/{}/queryInboundNatRulePortMapping" , self . client . endpoint () , & self . subscription_id , & self . group_name , & self . load_balancer_name , & self . backend_pool_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendAddressInboundNatRulePortMappings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendAddressInboundNatRulePortMappings = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_backend_address_pools { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + backend_address_pool_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + backend_address_pool_name: backend_address_pool_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + backend_address_pool_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + backend_address_pool_name: backend_address_pool_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + backend_address_pool_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + backend_address_pool_name: backend_address_pool_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerBackendAddressPoolListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) backend_address_pool_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.backend_address_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendAddressPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BackendAddressPool), + Ok200(models::BackendAddressPool), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) backend_address_pool_name: String, + pub(crate) parameters: models::BackendAddressPool, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.backend_address_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendAddressPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackendAddressPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) backend_address_pool_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.backend_address_pool_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_frontend_ip_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + frontend_ip_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + frontend_ip_configuration_name: frontend_ip_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerFrontendIpConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) frontend_ip_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.frontend_ip_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FrontendIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod inbound_nat_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + inbound_nat_rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + inbound_nat_rule_name: inbound_nat_rule_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + inbound_nat_rule_name: impl Into, + inbound_nat_rule_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + inbound_nat_rule_name: inbound_nat_rule_name.into(), + inbound_nat_rule_parameters: inbound_nat_rule_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + inbound_nat_rule_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + inbound_nat_rule_name: inbound_nat_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/inboundNatRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundNatRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) inbound_nat_rule_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/inboundNatRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.inbound_nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::InboundNatRule), + Ok200(models::InboundNatRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) inbound_nat_rule_name: String, + pub(crate) inbound_nat_rule_parameters: models::InboundNatRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/inboundNatRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.inbound_nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.inbound_nat_rule_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) inbound_nat_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/inboundNatRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.inbound_nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_load_balancing_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + load_balancing_rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + load_balancing_rule_name: load_balancing_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/loadBalancingRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerLoadBalancingRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) load_balancing_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/loadBalancingRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.load_balancing_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancingRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_outbound_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + outbound_rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + outbound_rule_name: outbound_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/outboundRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerOutboundRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) outbound_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/outboundRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.outbound_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OutboundRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_network_interfaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/networkInterfaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkInterfaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod load_balancer_probes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + load_balancer_name: impl Into, + probe_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + load_balancer_name: load_balancer_name.into(), + probe_name: probe_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/probes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LoadBalancerProbeListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) load_balancer_name: String, + pub(crate) probe_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/probes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.load_balancer_name, + &self.probe_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Probe = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_networks { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_ip_address_availability( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + ip_address: impl Into, + subscription_id: impl Into, + ) -> check_ip_address_availability::Builder { + check_ip_address_availability::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + ip_address: ip_address.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_usage( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subscription_id: impl Into, + ) -> list_usage::Builder { + list_usage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetwork), + Created201(models::VirtualNetwork), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) parameters: models::VirtualNetwork, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/virtualNetworks", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_ip_address_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) ip_address: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/CheckIPAddressAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let ip_address = &self.ip_address; + url.query_pairs_mut().append_pair("ipAddress", ip_address); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAddressAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_usage { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkListUsageResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod subnets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + subnet_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + subnet_parameters: subnet_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn prepare_network_policies( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + prepare_network_policies_request_parameters: impl Into, + subscription_id: impl Into, + ) -> prepare_network_policies::Builder { + prepare_network_policies::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + prepare_network_policies_request_parameters: prepare_network_policies_request_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn unprepare_network_policies( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + unprepare_network_policies_request_parameters: impl Into, + subscription_id: impl Into, + ) -> unprepare_network_policies::Builder { + unprepare_network_policies::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + unprepare_network_policies_request_parameters: unprepare_network_policies_request_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.subnet_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Subnet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Subnet), + Created201(models::Subnet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) subnet_parameters: models::Subnet, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.subnet_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.subnet_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Subnet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Subnet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.subnet_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod prepare_network_policies { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) prepare_network_policies_request_parameters: models::PrepareNetworkPoliciesRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}/PrepareNetworkPolicies" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_name , & self . subnet_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.prepare_network_policies_request_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unprepare_network_policies { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) unprepare_network_policies_request_parameters: models::UnprepareNetworkPoliciesRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}/UnprepareNetworkPolicies" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_name , & self . subnet_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.unprepare_network_policies_request_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SubnetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_navigation_links { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}/ResourceNavigationLinks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_name , & self . subnet_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceNavigationLinksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_association_links { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subnet_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subnet_name: subnet_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subnet_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}/ServiceAssociationLinks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_name , & self . subnet_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceAssociationLinksListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_network_peerings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + virtual_network_peering_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + virtual_network_peering_name: virtual_network_peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + virtual_network_peering_name: impl Into, + virtual_network_peering_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + virtual_network_peering_name: virtual_network_peering_name.into(), + virtual_network_peering_parameters: virtual_network_peering_parameters.into(), + subscription_id: subscription_id.into(), + sync_remote_address_space: None, + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + virtual_network_peering_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + virtual_network_peering_name: virtual_network_peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + virtual_network_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) virtual_network_peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/virtualNetworkPeerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.virtual_network_peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetworkPeering), + Created201(models::VirtualNetworkPeering), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) virtual_network_peering_name: String, + pub(crate) virtual_network_peering_parameters: models::VirtualNetworkPeering, + pub(crate) subscription_id: String, + pub(crate) sync_remote_address_space: Option, + } + impl Builder { + pub fn sync_remote_address_space(mut self, sync_remote_address_space: impl Into) -> Self { + self.sync_remote_address_space = Some(sync_remote_address_space.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/virtualNetworkPeerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.virtual_network_peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.virtual_network_peering_parameters).map_err(Error::Serialize)?; + if let Some(sync_remote_address_space) = &self.sync_remote_address_space { + url.query_pairs_mut() + .append_pair("syncRemoteAddressSpace", sync_remote_address_space); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) virtual_network_peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/virtualNetworkPeerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name, + &self.virtual_network_peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/virtualNetworkPeerings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkPeeringListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_security_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::NetworkSecurityGroup), + Ok200(models::NetworkSecurityGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) parameters: models::NetworkSecurityGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkSecurityGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkSecurityGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod security_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + security_rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + security_rule_name: security_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + security_rule_name: impl Into, + security_rule_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + security_rule_name: security_rule_name.into(), + security_rule_parameters: security_rule_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + security_rule_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + security_rule_name: security_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) security_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/securityRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name, + &self.security_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SecurityRule), + Created201(models::SecurityRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) security_rule_name: String, + pub(crate) security_rule_parameters: models::SecurityRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/securityRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name, + &self.security_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.security_rule_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) security_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/securityRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name, + &self.security_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/securityRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod default_security_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + network_security_group_name: impl Into, + default_security_rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_security_group_name: network_security_group_name.into(), + default_security_rule_name: default_security_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/defaultSecurityRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_security_group_name: String, + pub(crate) default_security_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}/defaultSecurityRules/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_security_group_name , & self . default_security_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod application_security_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + application_security_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_security_group_name: application_security_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + application_security_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_security_group_name: application_security_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + application_security_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_security_group_name: application_security_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + application_security_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + application_security_group_name: application_security_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_security_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ApplicationSecurityGroup), + Ok200(models::ApplicationSecurityGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_security_group_name: String, + pub(crate) parameters: models::ApplicationSecurityGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_security_group_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) application_security_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.application_security_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/applicationSecurityGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplicationSecurityGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_watchers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_topology( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_topology::Builder { + get_topology::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn verify_ip_flow( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> verify_ip_flow::Builder { + verify_ip_flow::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_next_hop( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_next_hop::Builder { + get_next_hop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_vm_security_rules( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_vm_security_rules::Builder { + get_vm_security_rules::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_troubleshooting( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_troubleshooting::Builder { + get_troubleshooting::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_troubleshooting_result( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_troubleshooting_result::Builder { + get_troubleshooting_result::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn set_flow_log_configuration( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> set_flow_log_configuration::Builder { + set_flow_log_configuration::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_flow_log_status( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_flow_log_status::Builder { + get_flow_log_status::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_connectivity( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> check_connectivity::Builder { + check_connectivity::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_azure_reachability_report( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_azure_reachability_report::Builder { + get_azure_reachability_report::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_available_providers( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> list_available_providers::Builder { + list_available_providers::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_network_configuration_diagnostic( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> get_network_configuration_diagnostic::Builder { + get_network_configuration_diagnostic::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcher = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkWatcher), + Created201(models::NetworkWatcher), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::NetworkWatcher, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcher = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcher = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcher = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcherListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkWatchers", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkWatcherListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_topology { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::TopologyParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/topology", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Topology = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod verify_ip_flow { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VerificationIpFlowResult), + Accepted202(models::VerificationIpFlowResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::VerificationIpFlowParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/ipFlowVerify", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VerificationIpFlowResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VerificationIpFlowResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_next_hop { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NextHopResult), + Accepted202(models::NextHopResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::NextHopParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/nextHop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NextHopResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NextHopResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_vm_security_rules { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SecurityGroupViewResult), + Accepted202(models::SecurityGroupViewResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::SecurityGroupViewParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/securityGroupView", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityGroupViewResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityGroupViewResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_troubleshooting { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TroubleshootingResult), + Accepted202(models::TroubleshootingResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::TroubleshootingParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/troubleshoot", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TroubleshootingResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TroubleshootingResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_troubleshooting_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TroubleshootingResult), + Accepted202(models::TroubleshootingResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::QueryTroubleshootingParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/queryTroubleshootResult", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TroubleshootingResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TroubleshootingResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_flow_log_configuration { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::FlowLogInformation), + Accepted202(models::FlowLogInformation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::FlowLogInformation, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/configureFlowLog", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLogInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLogInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_flow_log_status { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::FlowLogInformation), + Accepted202(models::FlowLogInformation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::FlowLogStatusParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/queryFlowLogStatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLogInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLogInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_connectivity { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConnectivityInformation), + Accepted202(models::ConnectivityInformation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::ConnectivityParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectivityCheck", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectivityInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectivityInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_azure_reachability_report { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AzureReachabilityReport), + Accepted202(models::AzureReachabilityReport), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::AzureReachabilityReportParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/azureReachabilityReport", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureReachabilityReport = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureReachabilityReport = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_providers { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AvailableProvidersList), + Accepted202(models::AvailableProvidersList), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::AvailableProvidersListParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/availableProvidersList", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableProvidersList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableProvidersList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_network_configuration_diagnostic { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkConfigurationDiagnosticResponse), + Accepted202(models::NetworkConfigurationDiagnosticResponse), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) parameters: models::NetworkConfigurationDiagnosticParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/networkConfigurationDiagnostic" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_watcher_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkConfigurationDiagnosticResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkConfigurationDiagnosticResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod packet_captures { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + packet_capture_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + packet_capture_name: packet_capture_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + packet_capture_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + packet_capture_name: packet_capture_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + packet_capture_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + packet_capture_name: packet_capture_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn stop( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + packet_capture_name: impl Into, + subscription_id: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + packet_capture_name: packet_capture_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_status( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + packet_capture_name: impl Into, + subscription_id: impl Into, + ) -> get_status::Builder { + get_status::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + packet_capture_name: packet_capture_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) packet_capture_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.packet_capture_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PacketCaptureResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) packet_capture_name: String, + pub(crate) parameters: models::PacketCapture, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.packet_capture_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PacketCaptureResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) packet_capture_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.packet_capture_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) packet_capture_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.packet_capture_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_status { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PacketCaptureQueryStatusResult), + Accepted202(models::PacketCaptureQueryStatusResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) packet_capture_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures/{}/queryStatus" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_watcher_name , & self . packet_capture_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PacketCaptureQueryStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PacketCaptureQueryStatusResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/packetCaptures", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PacketCaptureListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod connection_monitors { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + migrate: None, + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn stop( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + subscription_id: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + subscription_id: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn query( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + connection_monitor_name: impl Into, + subscription_id: impl Into, + ) -> query::Builder { + query::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + connection_monitor_name: connection_monitor_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConnectionMonitorResult), + Created201(models::ConnectionMonitorResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) parameters: models::ConnectionMonitor, + pub(crate) subscription_id: String, + pub(crate) migrate: Option, + } + impl Builder { + pub fn migrate(mut self, migrate: impl Into) -> Self { + self.migrate = Some(migrate.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + if let Some(migrate) = &self.migrate { + url.query_pairs_mut().append_pair("migrate", migrate); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConnectionMonitorQueryResult), + Accepted202(models::ConnectionMonitorQueryResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) connection_monitor_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors/{}/query", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.connection_monitor_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorQueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorQueryResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/connectionMonitors", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionMonitorListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod flow_logs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + flow_log_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + flow_log_name: flow_log_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + flow_log_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + flow_log_name: flow_log_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + flow_log_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + flow_log_name: flow_log_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + flow_log_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + flow_log_name: flow_log_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_watcher_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_watcher_name: network_watcher_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) flow_log_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/flowLogs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.flow_log_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLog = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::FlowLog), + Ok200(models::FlowLog), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) flow_log_name: String, + pub(crate) parameters: models::FlowLog, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/flowLogs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.flow_log_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLog = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLog = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) flow_log_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/flowLogs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.flow_log_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLog = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) flow_log_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/flowLogs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name, + &self.flow_log_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_watcher_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkWatchers/{}/flowLogs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_watcher_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FlowLogListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod route_tables { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RouteTable), + Created201(models::RouteTable), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) parameters: models::RouteTable, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/routeTables", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod routes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + route_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + route_name: route_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + route_name: impl Into, + route_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + route_name: route_name.into(), + route_parameters: route_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + route_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + route_name: route_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + route_table_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_table_name: route_table_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) route_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Route), + Created201(models::Route), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) route_name: String, + pub(crate) route_parameters: models::Route, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Route = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) route_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}/routes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name, + &self.route_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_table_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}/routes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_endpoint_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_endpoint_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ServiceEndpointPolicy), + Ok200(models::ServiceEndpointPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) parameters: models::ServiceEndpointPolicy, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_endpoint_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_endpoint_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_endpoint_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ServiceEndpointPolicies", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_endpoint_policy_definitions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + service_endpoint_policy_definition_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + service_endpoint_policy_definition_name: impl Into, + service_endpoint_policy_definitions: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(), + service_endpoint_policy_definitions: service_endpoint_policy_definitions.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + service_endpoint_policy_definition_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + service_endpoint_policy_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_endpoint_policy_name: service_endpoint_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) service_endpoint_policy_definition_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_endpoint_policy_name , & self . service_endpoint_policy_definition_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ServiceEndpointPolicyDefinition), + Created201(models::ServiceEndpointPolicyDefinition), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) service_endpoint_policy_definition_name: String, + pub(crate) service_endpoint_policy_definitions: models::ServiceEndpointPolicyDefinition, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_endpoint_policy_name , & self . service_endpoint_policy_definition_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.service_endpoint_policy_definitions).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyDefinition = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) service_endpoint_policy_definition_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_endpoint_policy_name , & self . service_endpoint_policy_definition_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_endpoint_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_endpoint_policy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceEndpointPolicyDefinitionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoints { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpoint), + Created201(models::PrivateEndpoint), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) parameters: models::PrivateEndpoint, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/privateEndpoints", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_private_endpoint_types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + location: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + location: location.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/availablePrivateEndpointTypes", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailablePrivateEndpointTypesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/locations/{}/availablePrivateEndpointTypes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailablePrivateEndpointTypesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_dns_zone_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + private_dns_zone_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + private_dns_zone_group_name: private_dns_zone_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + private_dns_zone_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + private_dns_zone_group_name: private_dns_zone_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + private_endpoint_name: impl Into, + private_dns_zone_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + private_endpoint_name: private_endpoint_name.into(), + private_dns_zone_group_name: private_dns_zone_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + private_endpoint_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + private_endpoint_name: private_endpoint_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) private_dns_zone_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}/privateDnsZoneGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name, + &self.private_dns_zone_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateDnsZoneGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateDnsZoneGroup), + Created201(models::PrivateDnsZoneGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) private_dns_zone_group_name: String, + pub(crate) parameters: models::PrivateDnsZoneGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}/privateDnsZoneGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name, + &self.private_dns_zone_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateDnsZoneGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateDnsZoneGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) private_endpoint_name: String, + pub(crate) private_dns_zone_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}/privateDnsZoneGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name, + &self.private_dns_zone_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) private_endpoint_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateEndpoints/{}/privateDnsZoneGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.private_endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateDnsZoneGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + service_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_private_endpoint_connection( + &self, + resource_group_name: impl Into, + service_name: impl Into, + pe_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_private_endpoint_connection::Builder { + get_private_endpoint_connection::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + pe_connection_name: pe_connection_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn update_private_endpoint_connection( + &self, + resource_group_name: impl Into, + service_name: impl Into, + pe_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_private_endpoint_connection::Builder { + update_private_endpoint_connection::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + pe_connection_name: pe_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete_private_endpoint_connection( + &self, + resource_group_name: impl Into, + service_name: impl Into, + pe_connection_name: impl Into, + subscription_id: impl Into, + ) -> delete_private_endpoint_connection::Builder { + delete_private_endpoint_connection::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + pe_connection_name: pe_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_private_endpoint_connections( + &self, + resource_group_name: impl Into, + service_name: impl Into, + subscription_id: impl Into, + ) -> list_private_endpoint_connections::Builder { + list_private_endpoint_connections::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + service_name: service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_private_link_service_visibility( + &self, + location: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> check_private_link_service_visibility::Builder { + check_private_link_service_visibility::Builder { + client: self.0.clone(), + location: location.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_private_link_service_visibility_by_resource_group( + &self, + location: impl Into, + resource_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> check_private_link_service_visibility_by_resource_group::Builder { + check_private_link_service_visibility_by_resource_group::Builder { + client: self.0.clone(), + location: location.into(), + resource_group_name: resource_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_auto_approved_private_link_services( + &self, + location: impl Into, + subscription_id: impl Into, + ) -> list_auto_approved_private_link_services::Builder { + list_auto_approved_private_link_services::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_auto_approved_private_link_services_by_resource_group( + &self, + location: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_auto_approved_private_link_services_by_resource_group::Builder { + list_auto_approved_private_link_services_by_resource_group::Builder { + client: self.0.clone(), + location: location.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateLinkService), + Created201(models::PrivateLinkService), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) parameters: models::PrivateLinkService, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkService = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/privateLinkServices", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkServiceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_private_endpoint_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) pe_connection_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . pe_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_private_endpoint_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) pe_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . pe_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_private_endpoint_connection { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) pe_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name , & self . pe_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_private_endpoint_connections { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/privateLinkServices/{}/privateEndpointConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . service_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_private_link_service_visibility { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateLinkServiceVisibility), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) parameters: models::CheckPrivateLinkServiceVisibilityRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/checkPrivateLinkServiceVisibility", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkServiceVisibility = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_private_link_service_visibility_by_resource_group { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateLinkServiceVisibility), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) resource_group_name: String, + pub(crate) parameters: models::CheckPrivateLinkServiceVisibilityRequest, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/locations/{}/checkPrivateLinkServiceVisibility", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkServiceVisibility = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_auto_approved_private_link_services { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/autoApprovedPrivateLinkServices", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AutoApprovedPrivateLinkServicesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_auto_approved_private_link_services_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/locations/{}/autoApprovedPrivateLinkServices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AutoApprovedPrivateLinkServicesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_profiles { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_profile_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_profile_name: network_profile_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_profile_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_profile_name: network_profile_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + network_profile_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_profile_name: network_profile_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_profile_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_profile_name: network_profile_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_profile_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::NetworkProfile), + Ok200(models::NetworkProfile), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_profile_name: String, + pub(crate) parameters: models::NetworkProfile, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_profile_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_profile_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkProfiles", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkProfiles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod public_ip_addresses { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + public_ip_address_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_address_name: public_ip_address_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + public_ip_address_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_address_name: public_ip_address_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + public_ip_address_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_address_name: public_ip_address_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + public_ip_address_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_address_name: public_ip_address_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_cloud_service_public_ip_addresses( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + subscription_id: impl Into, + ) -> list_cloud_service_public_ip_addresses::Builder { + list_cloud_service_public_ip_addresses::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_cloud_service_role_instance_public_ip_addresses( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + role_instance_name: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + subscription_id: impl Into, + ) -> list_cloud_service_role_instance_public_ip_addresses::Builder { + list_cloud_service_role_instance_public_ip_addresses::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + role_instance_name: role_instance_name.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_cloud_service_public_ip_address( + &self, + resource_group_name: impl Into, + cloud_service_name: impl Into, + role_instance_name: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + public_ip_address_name: impl Into, + subscription_id: impl Into, + ) -> get_cloud_service_public_ip_address::Builder { + get_cloud_service_public_ip_address::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cloud_service_name: cloud_service_name.into(), + role_instance_name: role_instance_name.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + public_ip_address_name: public_ip_address_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_virtual_machine_scale_set_public_ip_addresses( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + subscription_id: impl Into, + ) -> list_virtual_machine_scale_set_public_ip_addresses::Builder { + list_virtual_machine_scale_set_public_ip_addresses::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_virtual_machine_scale_set_vm_public_ip_addresses( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + subscription_id: impl Into, + ) -> list_virtual_machine_scale_set_vm_public_ip_addresses::Builder { + list_virtual_machine_scale_set_vm_public_ip_addresses::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_virtual_machine_scale_set_public_ip_address( + &self, + resource_group_name: impl Into, + virtual_machine_scale_set_name: impl Into, + virtualmachine_index: impl Into, + network_interface_name: impl Into, + ip_configuration_name: impl Into, + public_ip_address_name: impl Into, + subscription_id: impl Into, + ) -> get_virtual_machine_scale_set_public_ip_address::Builder { + get_virtual_machine_scale_set_public_ip_address::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(), + virtualmachine_index: virtualmachine_index.into(), + network_interface_name: network_interface_name.into(), + ip_configuration_name: ip_configuration_name.into(), + public_ip_address_name: public_ip_address_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_address_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PublicIpAddress), + Ok200(models::PublicIpAddress), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) parameters: models::PublicIpAddress, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_address_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_address_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_address_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/publicIPAddresses", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cloud_service_public_ip_addresses { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/publicipaddresses", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_service_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_cloud_service_role_instance_public_ip_addresses { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) role_instance_name: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cloud_service_name , & self . role_instance_name , & self . network_interface_name , & self . ip_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_cloud_service_public_ip_address { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cloud_service_name: String, + pub(crate) role_instance_name: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cloud_service_name , & self . role_instance_name , & self . network_interface_name , & self . ip_configuration_name , & self . public_ip_address_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_virtual_machine_scale_set_public_ip_addresses { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/publicipaddresses", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_scale_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_virtual_machine_scale_set_vm_public_ip_addresses { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index , & self . network_interface_name , & self . ip_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddressListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_virtual_machine_scale_set_public_ip_address { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_scale_set_name: String, + pub(crate) virtualmachine_index: String, + pub(crate) network_interface_name: String, + pub(crate) ip_configuration_name: String, + pub(crate) public_ip_address_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_scale_set_name , & self . virtualmachine_index , & self . network_interface_name , & self . ip_configuration_name , & self . public_ip_address_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-10-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpAddress = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod nat_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + nat_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + nat_gateway_name: nat_gateway_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + nat_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + nat_gateway_name: nat_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + nat_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + nat_gateway_name: nat_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + nat_gateway_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + nat_gateway_name: nat_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) nat_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/natGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.nat_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::NatGateway), + Ok200(models::NatGateway), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) nat_gateway_name: String, + pub(crate) parameters: models::NatGateway, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/natGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.nat_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) nat_gateway_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/natGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.nat_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) nat_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/natGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.nat_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/natGateways", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/natGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NatGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_delegations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/availableDelegations", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableDelegationsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_resource_group_delegations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + location: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/locations/{}/availableDelegations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableDelegationsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_service_aliases { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + location: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/availableServiceAliases", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableServiceAliasesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/locations/{}/availableServiceAliases", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableServiceAliasesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod azure_firewalls { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + azure_firewall_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + azure_firewall_name: azure_firewall_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + azure_firewall_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + azure_firewall_name: azure_firewall_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + azure_firewall_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + azure_firewall_name: azure_firewall_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + azure_firewall_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + azure_firewall_name: azure_firewall_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) azure_firewall_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/azureFirewalls/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.azure_firewall_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewall = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::AzureFirewall), + Ok200(models::AzureFirewall), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) azure_firewall_name: String, + pub(crate) parameters: models::AzureFirewall, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/azureFirewalls/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.azure_firewall_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewall = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewall = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::AzureFirewall), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) azure_firewall_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/azureFirewalls/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.azure_firewall_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewall = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) azure_firewall_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/azureFirewalls/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.azure_firewall_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/azureFirewalls", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewallListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/azureFirewalls", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewallListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod azure_firewall_fqdn_tags { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/azureFirewallFqdnTags", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureFirewallFqdnTagListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod web_categories { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, name: impl Into, subscription_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + name: name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/azureWebCategories/{}", + self.client.endpoint(), + &self.subscription_id, + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureWebCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/azureWebCategories", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureWebCategoryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod bastion_hosts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + bastion_host_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::BastionHost), + Ok200(models::BastionHost), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) parameters: models::BastionHost, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BastionHost), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHost = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/bastionHosts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHostListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionHostListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn put_bastion_shareable_link( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + bsl_request: impl Into, + ) -> put_bastion_shareable_link::Builder { + put_bastion_shareable_link::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + bsl_request: bsl_request.into(), + } + } + pub fn delete_bastion_shareable_link( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + bsl_request: impl Into, + ) -> delete_bastion_shareable_link::Builder { + delete_bastion_shareable_link::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + bsl_request: bsl_request.into(), + } + } + pub fn get_bastion_shareable_link( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + bsl_request: impl Into, + ) -> get_bastion_shareable_link::Builder { + get_bastion_shareable_link::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + bsl_request: bsl_request.into(), + } + } + pub fn get_active_sessions( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + ) -> get_active_sessions::Builder { + get_active_sessions::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn disconnect_active_sessions( + &self, + resource_group_name: impl Into, + bastion_host_name: impl Into, + subscription_id: impl Into, + session_ids: impl Into, + ) -> disconnect_active_sessions::Builder { + disconnect_active_sessions::Builder { + client: self.clone(), + resource_group_name: resource_group_name.into(), + bastion_host_name: bastion_host_name.into(), + subscription_id: subscription_id.into(), + session_ids: session_ids.into(), + } + } + pub fn check_dns_name_availability( + &self, + location: impl Into, + domain_name_label: impl Into, + subscription_id: impl Into, + ) -> check_dns_name_availability::Builder { + check_dns_name_availability::Builder { + client: self.clone(), + location: location.into(), + domain_name_label: domain_name_label.into(), + subscription_id: subscription_id.into(), + } + } + pub fn supported_security_providers( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + ) -> supported_security_providers::Builder { + supported_security_providers::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + } + } + pub fn generatevirtualwanvpnserverconfigurationvpnprofile( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + vpn_client_params: impl Into, + ) -> generatevirtualwanvpnserverconfigurationvpnprofile::Builder { + generatevirtualwanvpnserverconfigurationvpnprofile::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + vpn_client_params: vpn_client_params.into(), + } + } +} +pub mod put_bastion_shareable_link { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BastionShareableLinkListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + pub(crate) bsl_request: models::BastionShareableLinkListRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}/createShareableLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.bsl_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionShareableLinkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod delete_bastion_shareable_link { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + pub(crate) bsl_request: models::BastionShareableLinkListRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}/deleteShareableLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.bsl_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod get_bastion_shareable_link { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + pub(crate) bsl_request: models::BastionShareableLinkListRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}/getShareableLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.bsl_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionShareableLinkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod get_active_sessions { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BastionActiveSessionListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}/getActiveSessions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionActiveSessionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod disconnect_active_sessions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) resource_group_name: String, + pub(crate) bastion_host_name: String, + pub(crate) subscription_id: String, + pub(crate) session_ids: models::SessionIds, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/bastionHosts/{}/disconnectActiveSessions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.bastion_host_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.session_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BastionSessionDeleteResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod check_dns_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) location: String, + pub(crate) domain_name_label: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/CheckDnsNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let domain_name_label = &self.domain_name_label; + url.query_pairs_mut().append_pair("domainNameLabel", domain_name_label); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DnsNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod supported_security_providers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}/supportedSecurityProviders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualWanSecurityProviders = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod generatevirtualwanvpnserverconfigurationvpnprofile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnProfileResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + pub(crate) vpn_client_params: models::VirtualWanVpnProfileParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}/GenerateVpnProfile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_client_params).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnProfileResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod custom_ip_prefixes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + custom_ip_prefix_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + custom_ip_prefix_name: custom_ip_prefix_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + custom_ip_prefix_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + custom_ip_prefix_name: custom_ip_prefix_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + custom_ip_prefix_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + custom_ip_prefix_name: custom_ip_prefix_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + custom_ip_prefix_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + custom_ip_prefix_name: custom_ip_prefix_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) custom_ip_prefix_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/customIpPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.custom_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::CustomIpPrefix), + Ok200(models::CustomIpPrefix), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) custom_ip_prefix_name: String, + pub(crate) parameters: models::CustomIpPrefix, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/customIpPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.custom_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) custom_ip_prefix_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/customIpPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.custom_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) custom_ip_prefix_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/customIpPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.custom_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/customIpPrefixes", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefixListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/customIpPrefixes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CustomIpPrefixListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod ddos_custom_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + ddos_custom_policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_custom_policy_name: ddos_custom_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + ddos_custom_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_custom_policy_name: ddos_custom_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + ddos_custom_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_custom_policy_name: ddos_custom_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + ddos_custom_policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_custom_policy_name: ddos_custom_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_custom_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosCustomPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_custom_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosCustomPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DdosCustomPolicy), + Ok200(models::DdosCustomPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_custom_policy_name: String, + pub(crate) parameters: models::DdosCustomPolicy, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosCustomPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_custom_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosCustomPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosCustomPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_custom_policy_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosCustomPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_custom_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosCustomPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_custom_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosCustomPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_custom_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod ddos_protection_plans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + ddos_protection_plan_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_protection_plan_name: ddos_protection_plan_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + ddos_protection_plan_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_protection_plan_name: ddos_protection_plan_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + ddos_protection_plan_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_protection_plan_name: ddos_protection_plan_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + ddos_protection_plan_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ddos_protection_plan_name: ddos_protection_plan_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_protection_plan_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosProtectionPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_protection_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DdosProtectionPlan), + Ok200(models::DdosProtectionPlan), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_protection_plan_name: String, + pub(crate) parameters: models::DdosProtectionPlan, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosProtectionPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_protection_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_protection_plan_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosProtectionPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_protection_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ddos_protection_plan_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosProtectionPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ddos_protection_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ddosProtectionPlans", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlanListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ddosProtectionPlans", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DdosProtectionPlanListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod dscp_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + dscp_configuration_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + dscp_configuration_name: dscp_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + dscp_configuration_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + dscp_configuration_name: dscp_configuration_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + dscp_configuration_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + dscp_configuration_name: dscp_configuration_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) dscp_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/dscpConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.dscp_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DscpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::DscpConfiguration), + Ok200(models::DscpConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) dscp_configuration_name: String, + pub(crate) parameters: models::DscpConfiguration, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/dscpConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.dscp_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DscpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DscpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) dscp_configuration_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/dscpConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.dscp_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/dscpConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DscpConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/dscpConfigurations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DscpConfigurationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_endpoint_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/virtualNetworkAvailableEndpointServices", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointServicesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_circuit_authorizations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + authorization_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + authorization_name: authorization_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + authorization_name: impl Into, + authorization_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + authorization_name: authorization_name.into(), + authorization_parameters: authorization_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + authorization_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + authorization_name: authorization_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) authorization_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ExpressRouteCircuitAuthorization), + Ok200(models::ExpressRouteCircuitAuthorization), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) authorization_name: String, + pub(crate) authorization_parameters: models::ExpressRouteCircuitAuthorization, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.authorization_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) authorization_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/authorizations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_circuit_peerings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + peering_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + peering_parameters: peering_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitPeering), + Created201(models::ExpressRouteCircuitPeering), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) peering_parameters: models::ExpressRouteCircuitPeering, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.peering_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitPeeringListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_circuit_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + connection_name: impl Into, + express_route_circuit_connection_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + connection_name: connection_name.into(), + express_route_circuit_connection_parameters: express_route_circuit_connection_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitConnection), + Created201(models::ExpressRouteCircuitConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) connection_name: String, + pub(crate) express_route_circuit_connection_parameters: models::ExpressRouteCircuitConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.express_route_circuit_connection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/connections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod peer_express_route_circuit_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/peerConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PeerExpressRouteCircuitConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/peerConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PeerExpressRouteCircuitConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_circuits { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_arp_table( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_arp_table::Builder { + list_arp_table::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_routes_table( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_routes_table::Builder { + list_routes_table::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_routes_table_summary( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_routes_table_summary::Builder { + list_routes_table_summary::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_stats( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + subscription_id: impl Into, + ) -> get_stats::Builder { + get_stats::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_peering_stats( + &self, + resource_group_name: impl Into, + circuit_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> get_peering_stats::Builder { + get_peering_stats::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + circuit_name: circuit_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuit = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ExpressRouteCircuit), + Ok200(models::ExpressRouteCircuit), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) parameters: models::ExpressRouteCircuit, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuit = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuit = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuit = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_arp_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitsArpTableListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/arpTables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitsArpTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_routes_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitsRoutesTableListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/routeTables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitsRoutesTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_routes_table_summary { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitsRoutesTableSummaryListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/routeTablesSummary/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . circuit_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitsRoutesTableSummaryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_stats { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/stats", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitStats = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_peering_stats { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) circuit_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits/{}/peerings/{}/stats", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.circuit_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitStats = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCircuits", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/expressRouteCircuits", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_service_providers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/expressRouteServiceProviders", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteServiceProviderListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_wans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + wan_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + wan_parameters: wan_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + wan_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + wan_parameters: wan_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualWan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualWan), + Created201(models::VirtualWan), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + pub(crate) wan_parameters: models::VirtualWan, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.wan_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualWan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualWan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + pub(crate) wan_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.wan_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualWan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualWaNsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/virtualWans", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualWaNsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_sites { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + vpn_site_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + vpn_site_parameters: vpn_site_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + vpn_site_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + vpn_site_parameters: vpn_site_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnSite), + Created201(models::VpnSite), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + pub(crate) vpn_site_parameters: models::VpnSite, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_site_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + pub(crate) vpn_site_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_site_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnSitesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/vpnSites", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnSitesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_site_links { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + vpn_site_link_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + vpn_site_link_name: vpn_site_link_name.into(), + } + } + pub fn list_by_vpn_site( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_site_name: impl Into, + ) -> list_by_vpn_site::Builder { + list_by_vpn_site::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_site_name: vpn_site_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + pub(crate) vpn_site_link_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}/vpnSiteLinks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name, + &self.vpn_site_link_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSiteLink = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vpn_site { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_site_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnSites/{}/vpnSiteLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_site_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnSiteLinksResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_sites_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn download( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + request: impl Into, + ) -> download::Builder { + download::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + request: request.into(), + } + } + } + pub mod download { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + pub(crate) request: models::GetVpnSitesConfigurationRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}/vpnConfiguration", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_server_configurations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + vpn_server_configuration_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + vpn_server_configuration_parameters: vpn_server_configuration_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + vpn_server_configuration_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + vpn_server_configuration_parameters: vpn_server_configuration_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_server_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnServerConfiguration), + Created201(models::VpnServerConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + pub(crate) vpn_server_configuration_parameters: models::VpnServerConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_server_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_server_configuration_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + pub(crate) vpn_server_configuration_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_server_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_server_configuration_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vpn_server_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnServerConfigurationsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/vpnServerConfigurations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnServerConfigurationsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod configuration_policy_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + configuration_policy_group_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + configuration_policy_group_name: configuration_policy_group_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + configuration_policy_group_name: impl Into, + vpn_server_configuration_policy_group_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + configuration_policy_group_name: configuration_policy_group_name.into(), + vpn_server_configuration_policy_group_parameters: vpn_server_configuration_policy_group_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + configuration_policy_group_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + configuration_policy_group_name: configuration_policy_group_name.into(), + } + } + pub fn list_by_vpn_server_configuration( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vpn_server_configuration_name: impl Into, + ) -> list_by_vpn_server_configuration::Builder { + list_by_vpn_server_configuration::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vpn_server_configuration_name: vpn_server_configuration_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + pub(crate) configuration_policy_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}/configurationPolicyGroups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vpn_server_configuration_name , & self . configuration_policy_group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfigurationPolicyGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnServerConfigurationPolicyGroup), + Created201(models::VpnServerConfigurationPolicyGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + pub(crate) configuration_policy_group_name: String, + pub(crate) vpn_server_configuration_policy_group_parameters: models::VpnServerConfigurationPolicyGroup, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}/configurationPolicyGroups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vpn_server_configuration_name , & self . configuration_policy_group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_server_configuration_policy_group_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfigurationPolicyGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfigurationPolicyGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + pub(crate) configuration_policy_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}/configurationPolicyGroups/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vpn_server_configuration_name , & self . configuration_policy_group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vpn_server_configuration { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vpn_server_configuration_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnServerConfigurations/{}/configurationPolicyGroups" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vpn_server_configuration_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnServerConfigurationPolicyGroupsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_hubs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + virtual_hub_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + virtual_hub_parameters: virtual_hub_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + virtual_hub_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + virtual_hub_parameters: virtual_hub_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get_effective_virtual_hub_routes( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> get_effective_virtual_hub_routes::Builder { + get_effective_virtual_hub_routes::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + effective_routes_parameters: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHub = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualHub), + Created201(models::VirtualHub), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) virtual_hub_parameters: models::VirtualHub, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.virtual_hub_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHub = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHub = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) virtual_hub_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.virtual_hub_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHub = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualHubsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/virtualHubs", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualHubsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_effective_virtual_hub_routes { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) effective_routes_parameters: Option, + } + impl Builder { + pub fn effective_routes_parameters( + mut self, + effective_routes_parameters: impl Into, + ) -> Self { + self.effective_routes_parameters = Some(effective_routes_parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/effectiveRoutes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(effective_routes_parameters) = &self.effective_routes_parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(effective_routes_parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod hub_virtual_network_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + hub_virtual_network_connection_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + hub_virtual_network_connection_parameters: hub_virtual_network_connection_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubVirtualNetworkConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::HubVirtualNetworkConnection), + Created201(models::HubVirtualNetworkConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + pub(crate) hub_virtual_network_connection_parameters: models::HubVirtualNetworkConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.hub_virtual_network_connection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubVirtualNetworkConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubVirtualNetworkConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubVirtualNetworkConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListHubVirtualNetworkConnectionsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + vpn_gateway_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + vpn_gateway_parameters: vpn_gateway_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + vpn_gateway_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + vpn_gateway_parameters: vpn_gateway_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn reset( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + subscription_id: impl Into, + ) -> reset::Builder { + reset::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start_packet_capture( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + subscription_id: impl Into, + ) -> start_packet_capture::Builder { + start_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn stop_packet_capture( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + subscription_id: impl Into, + ) -> stop_packet_capture::Builder { + stop_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnGateway), + Created201(models::VpnGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) vpn_gateway_parameters: models::VpnGateway, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::VpnGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) vpn_gateway_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnGateway), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/reset", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(String), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/startpacketcapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(String), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/stoppacketcapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnGatewaysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/vpnGateways", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnGatewaysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_link_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn reset_connection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + link_connection_name: impl Into, + ) -> reset_connection::Builder { + reset_connection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + link_connection_name: link_connection_name.into(), + } + } + pub fn get_ike_sas( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + link_connection_name: impl Into, + ) -> get_ike_sas::Builder { + get_ike_sas::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + link_connection_name: link_connection_name.into(), + } + } + pub fn list_by_vpn_connection( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + ) -> list_by_vpn_connection::Builder { + list_by_vpn_connection::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + } + } + } + pub mod reset_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}/resetconnection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . connection_name , & self . link_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_ike_sas { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}/getikesas" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . connection_name , & self . link_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vpn_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnSiteLinkConnectionsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + vpn_connection_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + vpn_connection_parameters: vpn_connection_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + } + } + pub fn start_packet_capture( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + vpn_connection_name: impl Into, + subscription_id: impl Into, + ) -> start_packet_capture::Builder { + start_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + vpn_connection_name: vpn_connection_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn stop_packet_capture( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + vpn_connection_name: impl Into, + subscription_id: impl Into, + ) -> stop_packet_capture::Builder { + stop_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + vpn_connection_name: vpn_connection_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn list_by_vpn_gateway( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> list_by_vpn_gateway::Builder { + list_by_vpn_gateway::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnConnection), + Created201(models::VpnConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + pub(crate) vpn_connection_parameters: models::VpnConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpn_connection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) vpn_connection_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/startpacketcapture" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . vpn_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) vpn_connection_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/stoppacketcapture" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . vpn_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vpn_gateway { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnConnectionsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_site_link_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + connection_name: impl Into, + link_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + connection_name: connection_name.into(), + link_connection_name: link_connection_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) connection_name: String, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name , & self . connection_name , & self . link_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnSiteLinkConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod nat_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + nat_rule_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + nat_rule_name: impl Into, + nat_rule_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + nat_rule_parameters: nat_rule_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + nat_rule_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + } + } + pub fn list_by_vpn_gateway( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> list_by_vpn_gateway::Builder { + list_by_vpn_gateway::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) nat_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnGatewayNatRule), + Created201(models::VpnGatewayNatRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) nat_rule_name: String, + pub(crate) nat_rule_parameters: models::VpnGatewayNatRule, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.nat_rule_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) nat_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vpn_gateway { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/vpnGateways/{}/natRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVpnGatewayNatRulesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod p2s_vpn_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + p2_s_vpn_gateway_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + p2_s_vpn_gateway_parameters: p2_s_vpn_gateway_parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + p2_s_vpn_gateway_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + p2_s_vpn_gateway_parameters: p2_s_vpn_gateway_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn reset( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + subscription_id: impl Into, + ) -> reset::Builder { + reset::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_vpn_profile( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_vpn_profile::Builder { + generate_vpn_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_p2s_vpn_connection_health( + &self, + resource_group_name: impl Into, + gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_p2s_vpn_connection_health::Builder { + get_p2s_vpn_connection_health::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_p2s_vpn_connection_health_detailed( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + gateway_name: impl Into, + request: impl Into, + ) -> get_p2s_vpn_connection_health_detailed::Builder { + get_p2s_vpn_connection_health_detailed::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + gateway_name: gateway_name.into(), + request: request.into(), + } + } + pub fn disconnect_p2s_vpn_connections( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + p2s_vpn_gateway_name: impl Into, + request: impl Into, + ) -> disconnect_p2s_vpn_connections::Builder { + disconnect_p2s_vpn_connections::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + p2s_vpn_gateway_name: p2s_vpn_gateway_name.into(), + request: request.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::P2sVpnGateway), + Created201(models::P2sVpnGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) p2_s_vpn_gateway_parameters: models::P2sVpnGateway, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.p2_s_vpn_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::P2sVpnGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) p2_s_vpn_gateway_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.p2_s_vpn_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListP2sVpnGatewaysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/p2svpnGateways", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListP2sVpnGatewaysResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::P2sVpnGateway), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}/reset", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_vpn_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnProfileResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) parameters: models::P2sVpnProfileParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}/generatevpnprofile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnProfileResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_p2s_vpn_connection_health { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::P2sVpnGateway), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}/getP2sVpnConnectionHealth", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_p2s_vpn_connection_health_detailed { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::P2sVpnConnectionHealth), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) gateway_name: String, + pub(crate) request: models::P2sVpnConnectionHealthRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}/getP2sVpnConnectionHealthDetailed" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::P2sVpnConnectionHealth = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod disconnect_p2s_vpn_connections { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) p2s_vpn_gateway_name: String, + pub(crate) request: models::P2sVpnConnectionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/p2svpnGateways/{}/disconnectP2sVpnConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.p2s_vpn_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vpn_server_configurations_associated_with_virtual_wan { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_wan_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_wan_name: virtual_wan_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnServerConfigurationsResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_wan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualWans/{}/vpnServerConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_wan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnServerConfigurationsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_hub_route_table_v2s { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + virtual_hub_route_table_v2_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + virtual_hub_route_table_v2_parameters: virtual_hub_route_table_v2_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHubRouteTableV2 = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualHubRouteTableV2), + Created201(models::VirtualHubRouteTableV2), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + pub(crate) virtual_hub_route_table_v2_parameters: models::VirtualHubRouteTableV2, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.virtual_hub_route_table_v2_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHubRouteTableV2 = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualHubRouteTableV2 = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routeTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routeTables", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualHubRouteTableV2sResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + put_express_route_gateway_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + put_express_route_gateway_parameters: put_express_route_gateway_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + express_route_gateway_parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + express_route_gateway_parameters: express_route_gateway_parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/expressRouteGateways", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGatewayList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGatewayList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteGateway), + Created201(models::ExpressRouteGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) put_express_route_gateway_parameters: models::ExpressRouteGateway, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.put_express_route_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::ExpressRouteGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) express_route_gateway_parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.express_route_gateway_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + connection_name: impl Into, + put_express_route_connection_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + connection_name: connection_name.into(), + put_express_route_connection_parameters: put_express_route_connection_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + express_route_gateway_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_gateway_name: express_route_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}/expressRouteConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . express_route_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteConnection), + Created201(models::ExpressRouteConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) put_express_route_connection_parameters: models::ExpressRouteConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}/expressRouteConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . express_route_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.put_express_route_connection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}/expressRouteConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . express_route_gateway_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteGateways/{}/expressRouteConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteConnectionList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_hub_bgp_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + connection_name: connection_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BgpConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BgpConnection), + Created201(models::BgpConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + pub(crate) parameters: models::BgpConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BgpConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BgpConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_hub_bgp_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + pub fn list_learned_routes( + &self, + resource_group_name: impl Into, + hub_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> list_learned_routes::Builder { + list_learned_routes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + hub_name: hub_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_advertised_routes( + &self, + resource_group_name: impl Into, + hub_name: impl Into, + connection_name: impl Into, + subscription_id: impl Into, + ) -> list_advertised_routes::Builder { + list_advertised_routes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + hub_name: hub_name.into(), + connection_name: connection_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualHubBgpConnectionResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_learned_routes { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PeerRouteList), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) hub_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections/{}/learnedRoutes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.hub_name, + &self.connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PeerRouteList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_advertised_routes { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PeerRouteList), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) hub_name: String, + pub(crate) connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/bgpConnections/{}/advertisedRoutes" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . hub_name , & self . connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PeerRouteList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_hub_ip_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ip_config_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + ip_config_name: ip_config_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ip_config_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + ip_config_name: ip_config_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ip_config_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + ip_config_name: ip_config_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) ip_config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/ipConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.ip_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::HubIpConfiguration), + Created201(models::HubIpConfiguration), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) ip_config_name: String, + pub(crate) parameters: models::HubIpConfiguration, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/ipConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.ip_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubIpConfiguration = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) ip_config_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/ipConfigurations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.ip_config_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/ipConfigurations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualHubIpConfigurationResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod hub_route_tables { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + route_table_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + route_table_parameters: route_table_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + route_table_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + route_table_name: route_table_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubRouteTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubRouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::HubRouteTable), + Created201(models::HubRouteTable), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + pub(crate) route_table_parameters: models::HubRouteTable, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubRouteTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route_table_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubRouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HubRouteTable = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) route_table_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubRouteTables/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.route_table_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/hubRouteTables", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListHubRouteTablesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod routing_intent { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + routing_intent_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + routing_intent_name: routing_intent_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + routing_intent_name: impl Into, + routing_intent_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + routing_intent_name: routing_intent_name.into(), + routing_intent_parameters: routing_intent_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + routing_intent_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + routing_intent_name: routing_intent_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_hub_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_hub_name: virtual_hub_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) routing_intent_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routingIntent/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.routing_intent_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoutingIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RoutingIntent), + Created201(models::RoutingIntent), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) routing_intent_name: String, + pub(crate) routing_intent_parameters: models::RoutingIntent, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routingIntent/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.routing_intent_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.routing_intent_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoutingIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoutingIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + pub(crate) routing_intent_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routingIntent/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name, + &self.routing_intent_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_hub_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualHubs/{}/routingIntent", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_hub_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListRoutingIntentResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_network_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_connections( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> list_connections::Builder { + list_connections::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reset( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> reset::Builder { + reset::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + gateway_vip: None, + } + } + pub fn reset_vpn_client_shared_key( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> reset_vpn_client_shared_key::Builder { + reset_vpn_client_shared_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generatevpnclientpackage( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generatevpnclientpackage::Builder { + generatevpnclientpackage::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_vpn_profile( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> generate_vpn_profile::Builder { + generate_vpn_profile::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_vpn_profile_package_url( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_vpn_profile_package_url::Builder { + get_vpn_profile_package_url::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_bgp_peer_status( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_bgp_peer_status::Builder { + get_bgp_peer_status::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + peer: None, + } + } + pub fn supported_vpn_devices( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> supported_vpn_devices::Builder { + supported_vpn_devices::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_learned_routes( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_learned_routes::Builder { + get_learned_routes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_advertised_routes( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + peer: impl Into, + subscription_id: impl Into, + ) -> get_advertised_routes::Builder { + get_advertised_routes::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + peer: peer.into(), + subscription_id: subscription_id.into(), + } + } + pub fn set_vpnclient_ipsec_parameters( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + vpnclient_ipsec_params: impl Into, + subscription_id: impl Into, + ) -> set_vpnclient_ipsec_parameters::Builder { + set_vpnclient_ipsec_parameters::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + vpnclient_ipsec_params: vpnclient_ipsec_params.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_vpnclient_ipsec_parameters( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_vpnclient_ipsec_parameters::Builder { + get_vpnclient_ipsec_parameters::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn vpn_device_configuration_script( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> vpn_device_configuration_script::Builder { + vpn_device_configuration_script::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start_packet_capture( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> start_packet_capture::Builder { + start_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn stop_packet_capture( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> stop_packet_capture::Builder { + stop_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_vpnclient_connection_health( + &self, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get_vpnclient_connection_health::Builder { + get_vpnclient_connection_health::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn disconnect_virtual_network_gateway_vpn_connections( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + request: impl Into, + ) -> disconnect_virtual_network_gateway_vpn_connections::Builder { + disconnect_virtual_network_gateway_vpn_connections::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + request: request.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetworkGateway), + Created201(models::VirtualNetworkGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) parameters: models::VirtualNetworkGateway, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::VirtualNetworkGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_connections { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/connections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayListConnectionsResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::VirtualNetworkGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) gateway_vip: Option, + } + impl Builder { + pub fn gateway_vip(mut self, gateway_vip: impl Into) -> Self { + self.gateway_vip = Some(gateway_vip.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/reset", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(gateway_vip) = &self.gateway_vip { + url.query_pairs_mut().append_pair("gatewayVip", gateway_vip); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_vpn_client_shared_key { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/resetvpnclientsharedkey" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generatevpnclientpackage { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(String), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) parameters: models::VpnClientParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/generatevpnclientpackage" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_vpn_profile { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(String), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) parameters: models::VpnClientParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/generatevpnprofile", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_vpn_profile_package_url { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(String), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getvpnprofilepackageurl" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_bgp_peer_status { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::BgpPeerStatusListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) peer: Option, + } + impl Builder { + pub fn peer(mut self, peer: impl Into) -> Self { + self.peer = Some(peer.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getBgpPeerStatus", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(peer) = &self.peer { + url.query_pairs_mut().append_pair("peer", peer); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BgpPeerStatusListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod supported_vpn_devices { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/supportedvpndevices", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_learned_routes { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::GatewayRouteListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getLearnedRoutes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_advertised_routes { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::GatewayRouteListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) peer: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getAdvertisedRoutes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let peer = &self.peer; + url.query_pairs_mut().append_pair("peer", peer); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GatewayRouteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_vpnclient_ipsec_parameters { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::VpnClientIPsecParameters), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) vpnclient_ipsec_params: models::VpnClientIPsecParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/setvpnclientipsecparameters" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vpnclient_ipsec_params).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnClientIPsecParameters = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_vpnclient_ipsec_parameters { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getvpnclientipsecparameters" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnClientIPsecParameters = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod vpn_device_configuration_script { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::VpnDeviceScriptParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/vpndeviceconfigurationscript", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/startPacketCapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) parameters: models::VpnPacketCaptureStopParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/stopPacketCapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_vpnclient_connection_health { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VpnClientConnectionHealthDetailListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/getVpnClientConnectionHealth" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VpnClientConnectionHealthDetailListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod disconnect_virtual_network_gateway_vpn_connections { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) request: models::P2sVpnConnectionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/disconnectVirtualNetworkGatewayVpnConnections" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_network_gateway_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_network_gateway_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_shared_key( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_shared_key::Builder { + get_shared_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn set_shared_key( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> set_shared_key::Builder { + set_shared_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reset_shared_key( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> reset_shared_key::Builder { + reset_shared_key::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn start_packet_capture( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> start_packet_capture::Builder { + start_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + pub fn stop_packet_capture( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> stop_packet_capture::Builder { + stop_packet_capture::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_ike_sas( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> get_ike_sas::Builder { + get_ike_sas::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn reset_connection( + &self, + resource_group_name: impl Into, + virtual_network_gateway_connection_name: impl Into, + subscription_id: impl Into, + ) -> reset_connection::Builder { + reset_connection::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetworkGatewayConnection), + Created201(models::VirtualNetworkGatewayConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::VirtualNetworkGatewayConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::VirtualNetworkGatewayConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_shared_key { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/sharedkey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionSharedKey = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_shared_key { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ConnectionSharedKey), + Ok200(models::ConnectionSharedKey), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::ConnectionSharedKey, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/sharedkey", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionSharedKey = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionSharedKey = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_shared_key { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ConnectionResetSharedKey), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::ConnectionResetSharedKey, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/sharedkey/reset", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ConnectionResetSharedKey = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/startPacketCapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_packet_capture { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) parameters: models::VpnPacketCaptureStopParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/stopPacketCapture", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_ike_sas { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(String), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/getikesas", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: String = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod reset_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/connections/{}/resetconnection", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod local_network_gateways { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + local_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + local_network_gateway_name: local_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + local_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + local_network_gateway_name: local_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + local_network_gateway_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + local_network_gateway_name: local_network_gateway_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + local_network_gateway_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + local_network_gateway_name: local_network_gateway_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) local_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/localNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.local_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocalNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::LocalNetworkGateway), + Ok200(models::LocalNetworkGateway), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) local_network_gateway_name: String, + pub(crate) parameters: models::LocalNetworkGateway, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/localNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.local_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocalNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocalNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) local_network_gateway_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/localNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.local_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocalNetworkGateway = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) local_network_gateway_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/localNetworkGateways/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.local_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/localNetworkGateways", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LocalNetworkGatewayListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_network_gateway_nat_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + nat_rule_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + nat_rule_name: impl Into, + nat_rule_parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + nat_rule_parameters: nat_rule_parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + nat_rule_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + nat_rule_name: nat_rule_name.into(), + } + } + pub fn list_by_virtual_network_gateway( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_gateway_name: impl Into, + ) -> list_by_virtual_network_gateway::Builder { + list_by_virtual_network_gateway::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_gateway_name: virtual_network_gateway_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) nat_rule_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetworkGatewayNatRule), + Created201(models::VirtualNetworkGatewayNatRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) nat_rule_name: String, + pub(crate) nat_rule_parameters: models::VirtualNetworkGatewayNatRule, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.nat_rule_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkGatewayNatRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + pub(crate) nat_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/natRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name, + &self.nat_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_virtual_network_gateway { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_gateway_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkGateways/{}/natRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_gateway_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ListVirtualNetworkGatewayNatRulesResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_cross_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + cross_connection_parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + cross_connection_parameters: cross_connection_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_arp_table( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_arp_table::Builder { + list_arp_table::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_routes_table_summary( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_routes_table_summary::Builder { + list_routes_table_summary::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_routes_table( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + device_path: impl Into, + subscription_id: impl Into, + ) -> list_routes_table::Builder { + list_routes_table::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + device_path: device_path.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/expressRouteCrossConnections", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) parameters: models::ExpressRouteCrossConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) cross_connection_parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cross_connection_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_arp_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitsArpTableListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}/arpTables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cross_connection_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitsArpTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_routes_table_summary { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCrossConnectionsRoutesTableSummaryListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}/routeTablesSummary/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cross_connection_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionsRoutesTableSummaryListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_routes_table { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCircuitsRoutesTableListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) device_path: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}/routeTables/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . cross_connection_name , & self . peering_name , & self . device_path) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCircuitsRoutesTableListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_cross_connection_peerings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + peering_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + peering_parameters: peering_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + cross_connection_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + cross_connection_name: cross_connection_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionPeeringList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRouteCrossConnectionPeering), + Created201(models::ExpressRouteCrossConnectionPeering), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) peering_parameters: models::ExpressRouteCrossConnectionPeering, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.peering_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteCrossConnectionPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) cross_connection_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRouteCrossConnections/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cross_connection_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_ports_locations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get(&self, subscription_id: impl Into, location_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location_name: location_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ExpressRoutePortsLocations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortsLocationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ExpressRoutePortsLocations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortsLocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_ports { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn generate_loa( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + request: impl Into, + ) -> generate_loa::Builder { + generate_loa::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + request: request.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePort = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ExpressRoutePort), + Created201(models::ExpressRoutePort), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) parameters: models::ExpressRoutePort, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePort = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePort = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePort = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ExpressRoutePorts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod generate_loa { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) request: models::GenerateExpressRoutePortsLoaRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRoutePorts/{}/generateLoa", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GenerateExpressRoutePortsLoaResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_links { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + link_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + link_name: link_name.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + express_route_port_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) link_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}/links/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name, + &self.link_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteLink = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ExpressRoutePorts/{}/links", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRouteLinkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod express_route_port_authorizations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + express_route_port_name: impl Into, + authorization_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + authorization_name: authorization_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + express_route_port_name: impl Into, + authorization_name: impl Into, + authorization_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + authorization_name: authorization_name.into(), + authorization_parameters: authorization_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + express_route_port_name: impl Into, + authorization_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + authorization_name: authorization_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + express_route_port_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + express_route_port_name: express_route_port_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) authorization_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRoutePorts/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ExpressRoutePortAuthorization), + Ok200(models::ExpressRoutePortAuthorization), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) authorization_name: String, + pub(crate) authorization_parameters: models::ExpressRoutePortAuthorization, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRoutePorts/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.authorization_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortAuthorization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) authorization_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRoutePorts/{}/authorizations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name, + &self.authorization_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) express_route_port_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/expressRoutePorts/{}/authorizations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.express_route_port_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExpressRoutePortAuthorizationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::FirewallPolicy), + Ok200(models::FirewallPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) parameters: models::FirewallPolicy, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/firewallPolicies", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_policy_rule_collection_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + rule_collection_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + rule_collection_group_name: rule_collection_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + rule_collection_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + rule_collection_group_name: rule_collection_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + rule_collection_group_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + rule_collection_group_name: rule_collection_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) rule_collection_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/ruleCollectionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name, + &self.rule_collection_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyRuleCollectionGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::FirewallPolicyRuleCollectionGroup), + Ok200(models::FirewallPolicyRuleCollectionGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) rule_collection_group_name: String, + pub(crate) parameters: models::FirewallPolicyRuleCollectionGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/ruleCollectionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name, + &self.rule_collection_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyRuleCollectionGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyRuleCollectionGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) rule_collection_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/ruleCollectionGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name, + &self.rule_collection_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/ruleCollectionGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FirewallPolicyRuleCollectionGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_policy_idps_signatures { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::IdpsQueryObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/listIdpsSignatures", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_policy_idps_signatures_overrides { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn put( + &self, + parameters: impl Into, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + parameters: parameters.into(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn patch( + &self, + parameters: impl Into, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + parameters: parameters.into(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/signatureOverrides/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignaturesOverrides = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::SignaturesOverrides, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/signatureOverrides/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignaturesOverrides = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::SignaturesOverrides, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/signatureOverrides/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignaturesOverrides = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/signatureOverrides", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignaturesOverridesList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod firewall_policy_idps_signatures_filter_values { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + parameters: impl Into, + resource_group_name: impl Into, + firewall_policy_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + parameters: parameters.into(), + resource_group_name: resource_group_name.into(), + firewall_policy_name: firewall_policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) parameters: models::SignatureOverridesFilterValuesQuery, + pub(crate) resource_group_name: String, + pub(crate) firewall_policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/firewallPolicies/{}/listIdpsFilterOptions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.firewall_policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SignatureOverridesFilterValuesResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod ip_allocations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + ip_allocation_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_allocation_name: ip_allocation_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + ip_allocation_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_allocation_name: ip_allocation_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + ip_allocation_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_allocation_name: ip_allocation_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + ip_allocation_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_allocation_name: ip_allocation_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_allocation_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/IpAllocations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_allocation_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::IpAllocation), + Created201(models::IpAllocation), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_allocation_name: String, + pub(crate) parameters: models::IpAllocation, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/IpAllocations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_allocation_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_allocation_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/IpAllocations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_allocation_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_allocation_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/IpAllocations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_allocation_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/IpAllocations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/IpAllocations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpAllocationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod ip_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + ip_groups_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_groups_name: ip_groups_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + ip_groups_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_groups_name: ip_groups_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_groups( + &self, + resource_group_name: impl Into, + ip_groups_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_groups::Builder { + update_groups::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_groups_name: ip_groups_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + ip_groups_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + ip_groups_name: ip_groups_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_groups_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ipGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_groups_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::IpGroup), + Created201(models::IpGroup), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_groups_name: String, + pub(crate) parameters: models::IpGroup, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ipGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_groups_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_groups { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_groups_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ipGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_groups_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) ip_groups_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ipGroups/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.ip_groups_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ipGroups", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ipGroups", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IpGroupListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod network_virtual_appliances { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + parameters: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_virtual_appliance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualAppliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkVirtualAppliance), + Created201(models::NetworkVirtualAppliance), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) parameters: models::NetworkVirtualAppliance, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_virtual_appliance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualAppliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualAppliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) parameters: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_virtual_appliance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualAppliance = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.network_virtual_appliance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualApplianceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkVirtualAppliances", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualApplianceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_appliance_sites { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + site_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + site_name: site_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + site_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + site_name: site_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + site_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + site_name: site_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) site_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_virtual_appliance_name , & self . site_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualApplianceSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualApplianceSite), + Created201(models::VirtualApplianceSite), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) site_name: String, + pub(crate) parameters: models::VirtualApplianceSite, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_virtual_appliance_name , & self . site_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualApplianceSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualApplianceSite = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) site_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_virtual_appliance_name , & self . site_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}/virtualApplianceSites" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_virtual_appliance_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualApplianceSiteListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_appliance_skus { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get(&self, subscription_id: impl Into, sku_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + sku_name: sku_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkVirtualApplianceSkus", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualApplianceSkuListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) sku_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/networkVirtualApplianceSkus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.sku_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkVirtualApplianceSku = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod inbound_security_rule { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_or_update( + &self, + resource_group_name: impl Into, + network_virtual_appliance_name: impl Into, + rule_collection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + network_virtual_appliance_name: network_virtual_appliance_name.into(), + rule_collection_name: rule_collection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::InboundSecurityRule), + Created201(models::InboundSecurityRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) network_virtual_appliance_name: String, + pub(crate) rule_collection_name: String, + pub(crate) parameters: models::InboundSecurityRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkVirtualAppliances/{}/inboundSecurityRules/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . network_virtual_appliance_name , & self . rule_collection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundSecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InboundSecurityRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Network/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod public_ip_prefixes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + public_ip_prefix_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_prefix_name: public_ip_prefix_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + public_ip_prefix_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_prefix_name: public_ip_prefix_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + public_ip_prefix_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_prefix_name: public_ip_prefix_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + public_ip_prefix_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + public_ip_prefix_name: public_ip_prefix_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_prefix_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::PublicIpPrefix), + Ok200(models::PublicIpPrefix), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_prefix_name: String, + pub(crate) parameters: models::PublicIpPrefix, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_prefix_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefix = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) public_ip_prefix_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPPrefixes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.public_ip_prefix_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/publicIPPrefixes", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefixListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPPrefixes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PublicIpPrefixListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod route_filters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + route_filter_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + route_filter_parameters: route_filter_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RouteFilter), + Created201(models::RouteFilter), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) route_filter_parameters: models::RouteFilter, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route_filter_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/routeFilters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod route_filter_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + rule_name: impl Into, + route_filter_rule_parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + rule_name: rule_name.into(), + route_filter_rule_parameters: route_filter_rule_parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + rule_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + rule_name: rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_route_filter( + &self, + resource_group_name: impl Into, + route_filter_name: impl Into, + subscription_id: impl Into, + ) -> list_by_route_filter::Builder { + list_by_route_filter::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + route_filter_name: route_filter_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}/routeFilterRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RouteFilterRule), + Created201(models::RouteFilterRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) rule_name: String, + pub(crate) route_filter_rule_parameters: models::RouteFilterRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}/routeFilterRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.route_filter_rule_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}/routeFilterRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name, + &self.rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_route_filter { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) route_filter_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeFilters/{}/routeFilterRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.route_filter_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RouteFilterRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod security_partner_providers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + security_partner_provider_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + security_partner_provider_name: security_partner_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + security_partner_provider_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + security_partner_provider_name: security_partner_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + security_partner_provider_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + security_partner_provider_name: security_partner_provider_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + security_partner_provider_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + security_partner_provider_name: security_partner_provider_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) security_partner_provider_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/securityPartnerProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.security_partner_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::SecurityPartnerProvider), + Ok200(models::SecurityPartnerProvider), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) security_partner_provider_name: String, + pub(crate) parameters: models::SecurityPartnerProvider, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/securityPartnerProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.security_partner_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) security_partner_provider_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/securityPartnerProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.security_partner_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) security_partner_provider_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/securityPartnerProviders/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.security_partner_provider_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/securityPartnerProviders", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProviderListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/securityPartnerProviders", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SecurityPartnerProviderListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod bgp_service_communities { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/bgpServiceCommunities", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BgpServiceCommunityListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_tags { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/serviceTags", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceTagsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod service_tag_information { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + no_address_prefixes: None, + tag_name: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + pub(crate) no_address_prefixes: Option, + pub(crate) tag_name: Option, + } + impl Builder { + pub fn no_address_prefixes(mut self, no_address_prefixes: bool) -> Self { + self.no_address_prefixes = Some(no_address_prefixes); + self + } + pub fn tag_name(mut self, tag_name: impl Into) -> Self { + self.tag_name = Some(tag_name.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/serviceTagDetails", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(no_address_prefixes) = &self.no_address_prefixes { + url.query_pairs_mut() + .append_pair("noAddressPrefixes", &no_address_prefixes.to_string()); + } + if let Some(tag_name) = &self.tag_name { + url.query_pairs_mut().append_pair("tagName", tag_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServiceTagInformationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod usages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, location: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + location: location.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) location: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/locations/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UsagesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_routers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::VirtualRouter), + Ok200(models::VirtualRouter), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) parameters: models::VirtualRouter, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/virtualRouters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_router_peerings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + peering_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + peering_name: peering_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + peering_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + peering_name: peering_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + virtual_router_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + virtual_router_name: virtual_router_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::VirtualRouterPeering), + Ok200(models::VirtualRouterPeering), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) peering_name: String, + pub(crate) parameters: models::VirtualRouterPeering, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterPeering = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) peering_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}/peerings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name, + &self.peering_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) virtual_router_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualRouters/{}/peerings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_router_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualRouterPeeringListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod web_application_firewall_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_all(&self, subscription_id: impl Into) -> list_all::Builder { + list_all::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + policy_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + policy_name: policy_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebApplicationFirewallPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebApplicationFirewallPolicyListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . policy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::WebApplicationFirewallPolicy), + Created201(models::WebApplicationFirewallPolicy), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::WebApplicationFirewallPolicy, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . policy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WebApplicationFirewallPolicy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + Ok200, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) policy_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . policy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-08-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::OK => Ok(Response::Ok200), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/notificationhubs/Cargo.toml b/services/mgmt/notificationhubs/Cargo.toml index 61a6505efe..7a25d2e253 100644 --- a/services/mgmt/notificationhubs/Cargo.toml +++ b/services/mgmt/notificationhubs/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_notificationhubs" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/oep/Cargo.toml b/services/mgmt/oep/Cargo.toml index 0c472e0196..eb6fd32238 100644 --- a/services/mgmt/oep/Cargo.toml +++ b/services/mgmt/oep/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_oep" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/operationalinsights/Cargo.toml b/services/mgmt/operationalinsights/Cargo.toml index fd1f669a95..0d4f09f286 100644 --- a/services/mgmt/operationalinsights/Cargo.toml +++ b/services/mgmt/operationalinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_operationalinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/operationalinsights/src/package_2021_06/models.rs b/services/mgmt/operationalinsights/src/package_2021_06/models.rs index 96185ea8d4..d89d2a16d4 100644 --- a/services/mgmt/operationalinsights/src/package_2021_06/models.rs +++ b/services/mgmt/operationalinsights/src/package_2021_06/models.rs @@ -1343,16 +1343,16 @@ pub struct Workspace { #[doc = "Workspace properties."] #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[doc = "The ETag of the workspace."] - #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] - pub e_tag: Option, + #[doc = "The etag of the workspace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, } impl Workspace { pub fn new(tracked_resource: TrackedResource) -> Self { Self { tracked_resource, properties: None, - e_tag: None, + etag: None, } } } diff --git a/services/mgmt/operationsmanagement/Cargo.toml b/services/mgmt/operationsmanagement/Cargo.toml index bdc58e33f2..c75b478f68 100644 --- a/services/mgmt/operationsmanagement/Cargo.toml +++ b/services/mgmt/operationsmanagement/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_operationsmanagement" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/orbital/Cargo.toml b/services/mgmt/orbital/Cargo.toml index 43fd66311f..28c4a894d2 100644 --- a/services/mgmt/orbital/Cargo.toml +++ b/services/mgmt/orbital/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_orbital" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,11 +24,12 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag"] +features = ["no-default-tag", "package-2021-04-04-preview"] [features] -default = ["package-2021-04-04-preview", "enable_reqwest"] +default = ["package-2022-03-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-03-01" = [] "package-2021-04-04-preview" = [] diff --git a/services/mgmt/orbital/README.md b/services/mgmt/orbital/README.md index 7ac21e44e6..59f5e7a8c6 100644 --- a/services/mgmt/orbital/README.md +++ b/services/mgmt/orbital/README.md @@ -6,8 +6,9 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/orbital/re To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2021-04-04-preview`. +The default tag is `package-2022-03-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-03-01` has 21 operations from 1 API versions: `2022-03-01`. Use crate feature `package-2022-03-01` to enable. The operations will be in the `package_2022_03_01` module. - `package-2021-04-04-preview` has 20 operations from 1 API versions: `2021-04-04-preview`. Use crate feature `package-2021-04-04-preview` to enable. The operations will be in the `package_2021_04_04_preview` module. \ No newline at end of file diff --git a/services/mgmt/orbital/src/lib.rs b/services/mgmt/orbital/src/lib.rs index bf7cc13e14..3f65fa50d9 100644 --- a/services/mgmt/orbital/src/lib.rs +++ b/services/mgmt/orbital/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-03-01")] +pub mod package_2022_03_01; +#[cfg(all(feature = "package-2022-03-01", not(feature = "no-default-tag")))] +pub use package_2022_03_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2021-04-04-preview")] pub mod package_2021_04_04_preview; #[cfg(all(feature = "package-2021-04-04-preview", not(feature = "no-default-tag")))] diff --git a/services/mgmt/orbital/src/package_2022_03_01/mod.rs b/services/mgmt/orbital/src/package_2022_03_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/orbital/src/package_2022_03_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/orbital/src/package_2022_03_01/models.rs b/services/mgmt/orbital/src/package_2022_03_01/models.rs new file mode 100644 index 0000000000..2b224d1e32 --- /dev/null +++ b/services/mgmt/orbital/src/package_2022_03_01/models.rs @@ -0,0 +1,1028 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Authorized groundstation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizedGroundstation { + #[doc = "Groundstation name"] + #[serde(rename = "groundStation", default, skip_serializing_if = "Option::is_none")] + pub ground_station: Option, + #[doc = "Date of authorization expiration"] + #[serde(rename = "expirationDate", default, skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, +} +impl AuthorizedGroundstation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Customer retrieves list of Available Contacts for a spacecraft resource. Later, one of the available contact can be selected to create a contact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableContacts { + #[doc = "The reference to the spacecraft resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub spacecraft: Option, + #[doc = "Name of Azure Ground Station."] + #[serde(rename = "groundStationName", default, skip_serializing_if = "Option::is_none")] + pub ground_station_name: Option, + #[doc = "Properties of Contact resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AvailableContacts { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListAvailableContacts API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableContactsListResult { + #[doc = "A list of available contacts"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailableContactsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "GroundStations available to schedule Contacts"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableGroundStation { + #[doc = "Id of groundStation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the ground station."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Azure region"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The properties bag for this resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AvailableGroundStation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the AvailableGroundStations API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableGroundStationListResult { + #[doc = "A list of ground station resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailableGroundStationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties object for Available groundstation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailableGroundStationProperties { + #[doc = "City of ground station."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[doc = "Ground station provider name."] + #[serde(rename = "providerName", default, skip_serializing_if = "Option::is_none")] + pub provider_name: Option, + #[doc = "Longitude of the ground station in decimal degrees."] + #[serde(rename = "longitudeDegrees", default, skip_serializing_if = "Option::is_none")] + pub longitude_degrees: Option, + #[doc = "Latitude of the ground station in decimal degrees."] + #[serde(rename = "latitudeDegrees", default, skip_serializing_if = "Option::is_none")] + pub latitude_degrees: Option, + #[doc = "Altitude of the ground station"] + #[serde(rename = "altitudeMeters", default, skip_serializing_if = "Option::is_none")] + pub altitude_meters: Option, + #[doc = "Release Status of a ground station"] + #[serde(rename = "releaseMode", default, skip_serializing_if = "Option::is_none")] + pub release_mode: Option, +} +impl AvailableGroundStationProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod available_ground_station_properties { + use super::*; + #[doc = "Release Status of a ground station"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReleaseMode { + Preview, + #[serde(rename = "GA")] + Ga, + } +} +#[doc = "Capability of the Ground Station."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Capability { + EarthObservation, + Communication, +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Customer creates a contact resource for a spacecraft resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Contact { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of the Contact Resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl Contact { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contact Instance Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactInstanceProperties { + #[doc = "Maximum elevation of the antenna during the contact in decimal degrees."] + #[serde(rename = "maximumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub maximum_elevation_degrees: Option, + #[doc = "Time at which antenna transmit will be enabled."] + #[serde(rename = "txStartTime", default, skip_serializing_if = "Option::is_none")] + pub tx_start_time: Option, + #[doc = "Time at which antenna transmit will be disabled."] + #[serde(rename = "txEndTime", default, skip_serializing_if = "Option::is_none")] + pub tx_end_time: Option, + #[doc = "Earliest time to receive a signal."] + #[serde(rename = "rxStartTime", default, skip_serializing_if = "Option::is_none")] + pub rx_start_time: Option, + #[doc = "Time to lost receiving a signal."] + #[serde(rename = "rxEndTime", default, skip_serializing_if = "Option::is_none")] + pub rx_end_time: Option, + #[doc = "Azimuth of the antenna at the start of the contact in decimal degrees."] + #[serde(rename = "startAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_azimuth_degrees: Option, + #[doc = "Azimuth of the antenna at the end of the contact in decimal degrees."] + #[serde(rename = "endAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_azimuth_degrees: Option, + #[doc = "Spacecraft elevation above the horizon at contact start."] + #[serde(rename = "startElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_elevation_degrees: Option, + #[doc = "Spacecraft elevation above the horizon at contact end."] + #[serde(rename = "endElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_elevation_degrees: Option, +} +impl ContactInstanceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for the ListContacts API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactListResult { + #[doc = "A list of contact resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ContactListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters that define the contact resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactParameters { + #[doc = "The reference to the contact profile resource."] + #[serde(rename = "contactProfile")] + pub contact_profile: serde_json::Value, + #[doc = "Name of Azure Ground Station."] + #[serde(rename = "groundStationName")] + pub ground_station_name: String, + #[doc = "Start time of a contact."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "End time of a contact."] + #[serde(rename = "endTime")] + pub end_time: String, +} +impl ContactParameters { + pub fn new(contact_profile: serde_json::Value, ground_station_name: String, start_time: String, end_time: String) -> Self { + Self { + contact_profile, + ground_station_name, + start_time, + end_time, + } + } +} +#[doc = "Customer creates a Contact Profile Resource, which will contain all of the configurations required for scheduling a contact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfile { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties of the contact profile resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl ContactProfile { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + etag: None, + } + } +} +#[doc = "Contact Profile Link"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfileLink { + #[doc = "Link name"] + pub name: String, + #[doc = "polarization. eg (RHCP, LHCP)"] + pub polarization: contact_profile_link::Polarization, + #[doc = "Direction (uplink or downlink)"] + pub direction: contact_profile_link::Direction, + #[doc = "Gain To Noise Temperature in db/K."] + #[serde(rename = "gainOverTemperature", default, skip_serializing_if = "Option::is_none")] + pub gain_over_temperature: Option, + #[doc = "Effective Isotropic Radiated Power (EIRP) in dBW."] + #[serde(rename = "eirpdBW", default, skip_serializing_if = "Option::is_none")] + pub eirpd_bw: Option, + #[doc = "Contact Profile Link Channel"] + pub channels: Vec, +} +impl ContactProfileLink { + pub fn new( + name: String, + polarization: contact_profile_link::Polarization, + direction: contact_profile_link::Direction, + channels: Vec, + ) -> Self { + Self { + name, + polarization, + direction, + gain_over_temperature: None, + eirpd_bw: None, + channels, + } + } +} +pub mod contact_profile_link { + use super::*; + #[doc = "polarization. eg (RHCP, LHCP)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Polarization { + #[serde(rename = "RHCP")] + Rhcp, + #[serde(rename = "LHCP")] + Lhcp, + #[serde(rename = "linearVertical")] + LinearVertical, + #[serde(rename = "linearHorizontal")] + LinearHorizontal, + } + #[doc = "Direction (uplink or downlink)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + #[serde(rename = "uplink")] + Uplink, + #[serde(rename = "downlink")] + Downlink, + } +} +#[doc = "Contact Profile Link Channel"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfileLinkChannel { + #[doc = "Channel name"] + pub name: String, + #[doc = "Center Frequency in MHz"] + #[serde(rename = "centerFrequencyMHz")] + pub center_frequency_m_hz: f64, + #[doc = "Bandwidth in MHz"] + #[serde(rename = "bandwidthMHz")] + pub bandwidth_m_hz: f64, + #[doc = "Customer End point to store/retrieve data during a contact."] + #[serde(rename = "endPoint")] + pub end_point: EndPoint, + #[doc = "Configuration for modulation"] + #[serde(rename = "modulationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub modulation_configuration: Option, + #[doc = "Configuration for demodulation"] + #[serde(rename = "demodulationConfiguration", default, skip_serializing_if = "Option::is_none")] + pub demodulation_configuration: Option, + #[doc = "Configuration for encoding"] + #[serde(rename = "encodingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub encoding_configuration: Option, + #[doc = "Configuration for decoding"] + #[serde(rename = "decodingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub decoding_configuration: Option, +} +impl ContactProfileLinkChannel { + pub fn new(name: String, center_frequency_m_hz: f64, bandwidth_m_hz: f64, end_point: EndPoint) -> Self { + Self { + name, + center_frequency_m_hz, + bandwidth_m_hz, + end_point, + modulation_configuration: None, + demodulation_configuration: None, + encoding_configuration: None, + decoding_configuration: None, + } + } +} +#[doc = "Response for the ListContactProfiles API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactProfileListResult { + #[doc = "A list of contact profile resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ContactProfileListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Contact Profile Resource Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactProfilesProperties { + #[doc = "The current state of the resource's creation, deletion, or modification"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Minimum viable contact duration in ISO 8601 format."] + #[serde(rename = "minimumViableContactDuration", default, skip_serializing_if = "Option::is_none")] + pub minimum_viable_contact_duration: Option, + #[doc = "Minimum viable elevation for the contact in decimal degrees."] + #[serde(rename = "minimumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub minimum_elevation_degrees: Option, + #[doc = "Auto track configuration."] + #[serde(rename = "autoTrackingConfiguration", default, skip_serializing_if = "Option::is_none")] + pub auto_tracking_configuration: Option, + #[doc = "The URI of the Event Hub used for telemetry"] + #[serde(rename = "eventHubUri", default, skip_serializing_if = "Option::is_none")] + pub event_hub_uri: Option, + #[doc = "Network configuration of customer virtual network."] + #[serde(rename = "networkConfiguration")] + pub network_configuration: contact_profiles_properties::NetworkConfiguration, + #[doc = "Links of the Contact Profile"] + pub links: Vec, +} +impl ContactProfilesProperties { + pub fn new(network_configuration: contact_profiles_properties::NetworkConfiguration, links: Vec) -> Self { + Self { + provisioning_state: None, + minimum_viable_contact_duration: None, + minimum_elevation_degrees: None, + auto_tracking_configuration: None, + event_hub_uri: None, + network_configuration, + links, + } + } +} +pub mod contact_profiles_properties { + use super::*; + #[doc = "Auto track configuration."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoTrackingConfiguration { + #[serde(rename = "disabled")] + Disabled, + #[serde(rename = "xBand")] + XBand, + #[serde(rename = "sBand")] + SBand, + } + #[doc = "Network configuration of customer virtual network."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct NetworkConfiguration { + #[doc = "Customer subnet ARM resource identifier."] + #[serde(rename = "subnetId")] + pub subnet_id: String, + } + impl NetworkConfiguration { + pub fn new(subnet_id: String) -> Self { + Self { subnet_id } + } + } +} +#[doc = "Properties of the Contact Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContactsProperties { + #[doc = "The current state of the resource's creation, deletion, or modification"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Status of a contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Reservation start time of a contact."] + #[serde(rename = "reservationStartTime")] + pub reservation_start_time: String, + #[doc = "Reservation end time of a contact."] + #[serde(rename = "reservationEndTime")] + pub reservation_end_time: String, + #[doc = "Receive start time of a contact."] + #[serde(rename = "rxStartTime", default, skip_serializing_if = "Option::is_none")] + pub rx_start_time: Option, + #[doc = "Receive end time of a contact."] + #[serde(rename = "rxEndTime", default, skip_serializing_if = "Option::is_none")] + pub rx_end_time: Option, + #[doc = "Transmit start time of a contact."] + #[serde(rename = "txStartTime", default, skip_serializing_if = "Option::is_none")] + pub tx_start_time: Option, + #[doc = "Transmit end time of a contact."] + #[serde(rename = "txEndTime", default, skip_serializing_if = "Option::is_none")] + pub tx_end_time: Option, + #[doc = "Any error message while scheduling a contact."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Maximum elevation of the antenna during the contact in decimal degrees."] + #[serde(rename = "maximumElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub maximum_elevation_degrees: Option, + #[doc = "Azimuth of the antenna at the start of the contact in decimal degrees."] + #[serde(rename = "startAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_azimuth_degrees: Option, + #[doc = "Azimuth of the antenna at the end of the contact in decimal degrees."] + #[serde(rename = "endAzimuthDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_azimuth_degrees: Option, + #[doc = "Azure Ground Station name."] + #[serde(rename = "groundStationName")] + pub ground_station_name: String, + #[doc = "Spacecraft elevation above the horizon at contact start."] + #[serde(rename = "startElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub start_elevation_degrees: Option, + #[doc = "Spacecraft elevation above the horizon at contact end."] + #[serde(rename = "endElevationDegrees", default, skip_serializing_if = "Option::is_none")] + pub end_elevation_degrees: Option, + #[doc = "The configuration associated with the allocated antenna."] + #[serde(rename = "antennaConfiguration", default, skip_serializing_if = "Option::is_none")] + pub antenna_configuration: Option, + #[doc = "The reference to the contact profile resource."] + #[serde(rename = "contactProfile")] + pub contact_profile: serde_json::Value, +} +impl ContactsProperties { + pub fn new( + reservation_start_time: String, + reservation_end_time: String, + ground_station_name: String, + contact_profile: serde_json::Value, + ) -> Self { + Self { + provisioning_state: None, + status: None, + reservation_start_time, + reservation_end_time, + rx_start_time: None, + rx_end_time: None, + tx_start_time: None, + tx_end_time: None, + error_message: None, + maximum_elevation_degrees: None, + start_azimuth_degrees: None, + end_azimuth_degrees: None, + ground_station_name, + start_elevation_degrees: None, + end_elevation_degrees: None, + antenna_configuration: None, + contact_profile, + } + } +} +pub mod contacts_properties { + use super::*; + #[doc = "Status of a contact."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + #[serde(rename = "scheduled")] + Scheduled, + #[serde(rename = "cancelled")] + Cancelled, + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "providerCancelled")] + ProviderCancelled, + } + #[doc = "The configuration associated with the allocated antenna."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct AntennaConfiguration { + #[doc = "The destination IP a packet can be sent to. This would for example be the TCP endpoint you would send data to."] + #[serde(rename = "destinationIp", default, skip_serializing_if = "Option::is_none")] + pub destination_ip: Option, + #[doc = "List of Source IP"] + #[serde(rename = "sourceIps", default, skip_serializing_if = "Vec::is_empty")] + pub source_ips: Vec, + } + impl AntennaConfiguration { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Customer End point to store/retrieve data during a contact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndPoint { + #[doc = "IP Address."] + #[serde(rename = "ipAddress")] + pub ip_address: String, + #[doc = "Name of an end point."] + #[serde(rename = "endPointName")] + pub end_point_name: String, + #[doc = "TCP port to listen on to receive data."] + pub port: String, + #[doc = "Protocol either UDP or TCP."] + pub protocol: end_point::Protocol, +} +impl EndPoint { + pub fn new(ip_address: String, end_point_name: String, port: String, protocol: end_point::Protocol) -> Self { + Self { + ip_address, + end_point_name, + port, + protocol, + } + } +} +pub mod end_point { + use super::*; + #[doc = "Protocol either UDP or TCP."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Protocol { + #[serde(rename = "TCP")] + Tcp, + #[serde(rename = "UDP")] + Udp, + } +} +pub type Etag = String; +#[doc = "Details of a REST API operation, returned from the Resource Provider Operations API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Localized display information for this particular operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Localized display information for this particular operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The short, localized friendly description of the operation; suitable for tool tips and detailed views."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Result Entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResult { + #[doc = "ID of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The status of operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The operation start time"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The operation end time"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Percentage completed."] + #[serde(rename = "percentComplete", default, skip_serializing_if = "Option::is_none")] + pub percent_complete: Option, + #[doc = "Operation result properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Operation result error properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl OperationResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation result error properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultErrorProperties { + #[doc = "The code of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl OperationResultErrorProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation result properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultProperties {} +impl OperationResultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The current state of the resource's creation, deletion, or modification"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + Creating, + Succeeded, + Failed, + Canceled, + Updating, + Deleting, +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for an API service call that lists the resource IDs of resources associated with another resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceIdListResult { + #[doc = "A list of Azure Resource IDs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceIdListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource Reference"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceReference { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl ResourceReference { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Customer creates a spacecraft resource to schedule a contact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Spacecraft { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "List of Spacecraft Resource Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "A unique read-only string that changes whenever the resource is updated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl Spacecraft { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + etag: None, + } + } +} +#[doc = "Authorized Ground Stations for the link"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpacecraftLink { + #[doc = "Link name"] + pub name: String, + #[doc = "Center Frequency in MHz"] + #[serde(rename = "centerFrequencyMHz")] + pub center_frequency_m_hz: f64, + #[doc = "Bandwidth in MHz"] + #[serde(rename = "bandwidthMHz")] + pub bandwidth_m_hz: f64, + #[doc = "Direction (uplink or downlink)"] + pub direction: spacecraft_link::Direction, + #[doc = "polarization. eg (RHCP, LHCP)"] + pub polarization: spacecraft_link::Polarization, + #[doc = "Authorized Ground Stations"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub authorizations: Vec, +} +impl SpacecraftLink { + pub fn new( + name: String, + center_frequency_m_hz: f64, + bandwidth_m_hz: f64, + direction: spacecraft_link::Direction, + polarization: spacecraft_link::Polarization, + ) -> Self { + Self { + name, + center_frequency_m_hz, + bandwidth_m_hz, + direction, + polarization, + authorizations: Vec::new(), + } + } +} +pub mod spacecraft_link { + use super::*; + #[doc = "Direction (uplink or downlink)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + #[serde(rename = "uplink")] + Uplink, + #[serde(rename = "downlink")] + Downlink, + } + #[doc = "polarization. eg (RHCP, LHCP)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Polarization { + #[serde(rename = "RHCP")] + Rhcp, + #[serde(rename = "LHCP")] + Lhcp, + #[serde(rename = "linearVertical")] + LinearVertical, + #[serde(rename = "linearHorizontal")] + LinearHorizontal, + } +} +#[doc = "Response for the ListSpacecrafts API service call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SpacecraftListResult { + #[doc = "A list of spacecraft resources in a resource group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to get the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SpacecraftListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Spacecraft Resource Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpacecraftsProperties { + #[doc = "The current state of the resource's creation, deletion, or modification"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "NORAD ID of the spacecraft."] + #[serde(rename = "noradId")] + pub norad_id: String, + #[doc = "Title line of Two Line Element (TLE)."] + #[serde(rename = "titleLine", default, skip_serializing_if = "Option::is_none")] + pub title_line: Option, + #[doc = "Line 1 of Two Line Element (TLE)."] + #[serde(rename = "tleLine1", default, skip_serializing_if = "Option::is_none")] + pub tle_line1: Option, + #[doc = "Line 2 of Two Line Element (TLE)."] + #[serde(rename = "tleLine2", default, skip_serializing_if = "Option::is_none")] + pub tle_line2: Option, + #[doc = "Links of the Spacecraft"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub links: Vec, +} +impl SpacecraftsProperties { + pub fn new(norad_id: String) -> Self { + Self { + provisioning_state: None, + norad_id, + title_line: None, + tle_line1: None, + tle_line2: None, + links: Vec::new(), + } + } +} +#[doc = "The status of operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Status { + Succeeded, + Canceled, + Failed, + Running, +} +#[doc = "Tags object for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsObject { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/orbital/src/package_2022_03_01/operations.rs b/services/mgmt/orbital/src/package_2022_03_01/operations.rs new file mode 100644 index 0000000000..506556f627 --- /dev/null +++ b/services/mgmt/orbital/src/package_2022_03_01/operations.rs @@ -0,0 +1,2145 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn available_ground_stations(&self) -> available_ground_stations::Client { + available_ground_stations::Client(self.clone()) + } + pub fn contact_profiles(&self) -> contact_profiles::Client { + contact_profiles::Client(self.clone()) + } + pub fn contacts(&self) -> contacts::Client { + contacts::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn operations_results(&self) -> operations_results::Client { + operations_results::Client(self.clone()) + } + pub fn spacecrafts(&self) -> spacecrafts::Client { + spacecrafts::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Spacecrafts_ListBySubscription(#[from] spacecrafts::list_by_subscription::Error), + #[error(transparent)] + Spacecrafts_List(#[from] spacecrafts::list::Error), + #[error(transparent)] + Spacecrafts_Get(#[from] spacecrafts::get::Error), + #[error(transparent)] + Spacecrafts_CreateOrUpdate(#[from] spacecrafts::create_or_update::Error), + #[error(transparent)] + Spacecrafts_UpdateTags(#[from] spacecrafts::update_tags::Error), + #[error(transparent)] + Spacecrafts_Delete(#[from] spacecrafts::delete::Error), + #[error(transparent)] + Contacts_List(#[from] contacts::list::Error), + #[error(transparent)] + Contacts_Get(#[from] contacts::get::Error), + #[error(transparent)] + Contacts_Create(#[from] contacts::create::Error), + #[error(transparent)] + Contacts_Delete(#[from] contacts::delete::Error), + #[error(transparent)] + Spacecrafts_ListAvailableContacts(#[from] spacecrafts::list_available_contacts::Error), + #[error(transparent)] + ContactProfiles_Get(#[from] contact_profiles::get::Error), + #[error(transparent)] + ContactProfiles_CreateOrUpdate(#[from] contact_profiles::create_or_update::Error), + #[error(transparent)] + ContactProfiles_UpdateTags(#[from] contact_profiles::update_tags::Error), + #[error(transparent)] + ContactProfiles_Delete(#[from] contact_profiles::delete::Error), + #[error(transparent)] + ContactProfiles_ListBySubscription(#[from] contact_profiles::list_by_subscription::Error), + #[error(transparent)] + ContactProfiles_List(#[from] contact_profiles::list::Error), + #[error(transparent)] + AvailableGroundStations_ListByCapability(#[from] available_ground_stations::list_by_capability::Error), + #[error(transparent)] + AvailableGroundStations_Get(#[from] available_ground_stations::get::Error), + #[error(transparent)] + OperationsResults_Get(#[from] operations_results::get::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Orbital/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod spacecrafts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + skiptoken: None, + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skiptoken: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + } + } + pub fn list_available_contacts( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + parameters: impl Into, + ) -> list_available_contacts::Builder { + list_available_contacts::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/spacecrafts", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SpacecraftListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SpacecraftListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Spacecraft), + Created201(models::Spacecraft), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) parameters: models::Spacecraft, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Spacecraft), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Spacecraft = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_available_contacts { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AvailableContactsListResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) parameters: models::ContactParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/listAvailableContacts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableContactsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod contacts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + skiptoken: None, + } + } + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + } + } + pub fn create( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + parameters: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + spacecraft_name: impl Into, + contact_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + spacecraft_name: spacecraft_name.into(), + contact_name: contact_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Contact), + Created201(models::Contact), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + pub(crate) parameters: models::Contact, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Contact = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) spacecraft_name: String, + pub(crate) contact_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/spacecrafts/{}/contacts/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.spacecraft_name, + &self.contact_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod contact_profiles { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + contact_profile_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + contact_profile_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + contact_profile_name: contact_profile_name.into(), + parameters: parameters.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + contact_profile_name: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + contact_profile_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + contact_profile_name: contact_profile_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + skiptoken: None, + } + } + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skiptoken: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ContactProfile), + Created201(models::ContactProfile), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) contact_profile_name: String, + pub(crate) parameters: models::ContactProfile, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ContactProfile), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) parameters: models::TagsObject, + pub(crate) subscription_id: String, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfile = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) contact_profile_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.contact_profile_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/contactProfiles", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skiptoken: Option, + } + impl Builder { + pub fn skiptoken(mut self, skiptoken: impl Into) -> Self { + self.skiptoken = Some(skiptoken.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Orbital/contactProfiles", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + if let Some(skiptoken) = &self.skiptoken { + url.query_pairs_mut().append_pair("$skiptoken", skiptoken); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ContactProfileListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod available_ground_stations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_capability(&self, subscription_id: impl Into, capability: impl Into) -> list_by_capability::Builder { + list_by_capability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + capability: capability.into(), + } + } + pub fn get(&self, subscription_id: impl Into, ground_station_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + ground_station_name: ground_station_name.into(), + } + } + } + pub mod list_by_capability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) capability: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/availableGroundStations", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let capability = &self.capability; + url.query_pairs_mut().append_pair("capability", capability); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableGroundStationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) ground_station_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/availableGroundStations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.ground_station_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailableGroundStation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + location: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Orbital/locations/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.location, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/peering/Cargo.toml b/services/mgmt/peering/Cargo.toml index eff1256d6b..7ccb52a153 100644 --- a/services/mgmt/peering/Cargo.toml +++ b/services/mgmt/peering/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_peering" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/policyinsights/Cargo.toml b/services/mgmt/policyinsights/Cargo.toml index 355da3ee48..9ca440fc1e 100644 --- a/services/mgmt/policyinsights/Cargo.toml +++ b/services/mgmt/policyinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_policyinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/portal/Cargo.toml b/services/mgmt/portal/Cargo.toml index fa1e31c49a..b3c44a8647 100644 --- a/services/mgmt/portal/Cargo.toml +++ b/services/mgmt/portal/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_portal" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/postgresql/Cargo.toml b/services/mgmt/postgresql/Cargo.toml index b6fe0e2000..66cf8c5b3a 100644 --- a/services/mgmt/postgresql/Cargo.toml +++ b/services/mgmt/postgresql/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_postgresql" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/postgresqlhsc/Cargo.toml b/services/mgmt/postgresqlhsc/Cargo.toml index a2f6b5914c..557ee353a2 100644 --- a/services/mgmt/postgresqlhsc/Cargo.toml +++ b/services/mgmt/postgresqlhsc/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_postgresqlhsc" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/powerbidedicated/Cargo.toml b/services/mgmt/powerbidedicated/Cargo.toml index 7946aae485..38e7106df8 100644 --- a/services/mgmt/powerbidedicated/Cargo.toml +++ b/services/mgmt/powerbidedicated/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_powerbidedicated" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/powerbiembedded/Cargo.toml b/services/mgmt/powerbiembedded/Cargo.toml index f1dfa98f41..b05a43dd1e 100644 --- a/services/mgmt/powerbiembedded/Cargo.toml +++ b/services/mgmt/powerbiembedded/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_powerbiembedded" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/powerbiprivatelinks/Cargo.toml b/services/mgmt/powerbiprivatelinks/Cargo.toml index 9f1ca882bd..18e711e7bf 100644 --- a/services/mgmt/powerbiprivatelinks/Cargo.toml +++ b/services/mgmt/powerbiprivatelinks/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_powerbiprivatelinks" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/powerplatform/Cargo.toml b/services/mgmt/powerplatform/Cargo.toml index d30f5145e7..11776afa2b 100644 --- a/services/mgmt/powerplatform/Cargo.toml +++ b/services/mgmt/powerplatform/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_powerplatform" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/privatedns/Cargo.toml b/services/mgmt/privatedns/Cargo.toml index 9ac33784cf..5c0d31f84e 100644 --- a/services/mgmt/privatedns/Cargo.toml +++ b/services/mgmt/privatedns/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_privatedns" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/providerhub/Cargo.toml b/services/mgmt/providerhub/Cargo.toml index d6894fd586..741644ae2c 100644 --- a/services/mgmt/providerhub/Cargo.toml +++ b/services/mgmt/providerhub/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_providerhub" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/purview/Cargo.toml b/services/mgmt/purview/Cargo.toml index 858b075514..a5851aa214 100644 --- a/services/mgmt/purview/Cargo.toml +++ b/services/mgmt/purview/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_purview" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/quantum/Cargo.toml b/services/mgmt/quantum/Cargo.toml index fdfc0551c6..db7b08d960 100644 --- a/services/mgmt/quantum/Cargo.toml +++ b/services/mgmt/quantum/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_quantum" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,11 +24,12 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag"] +features = ["no-default-tag", "package-2019-11-04-preview"] [features] -default = ["package-2019-11-04-preview", "enable_reqwest"] +default = ["package-2022-01-10-preview", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-2019-11-04-preview" = [] +"package-2022-01-10-preview" = [] diff --git a/services/mgmt/quantum/README.md b/services/mgmt/quantum/README.md index a85ceb591b..6f00990681 100644 --- a/services/mgmt/quantum/README.md +++ b/services/mgmt/quantum/README.md @@ -6,8 +6,9 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/quantum/re To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2019-11-04-preview`. +The default tag is `package-2022-01-10-preview`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-2019-11-04-preview` has 9 operations from 1 API versions: `2019-11-04-preview`. Use crate feature `package-2019-11-04-preview` to enable. The operations will be in the `package_2019_11_04_preview` module. \ No newline at end of file +- `package-2019-11-04-preview` has 9 operations from 1 API versions: `2019-11-04-preview`. Use crate feature `package-2019-11-04-preview` to enable. The operations will be in the `package_2019_11_04_preview` module. +- `package-2022-01-10-preview` has 9 operations from 1 API versions: `2022-01-10-preview`. Use crate feature `package-2022-01-10-preview` to enable. The operations will be in the `package_2022_01_10_preview` module. \ No newline at end of file diff --git a/services/mgmt/quantum/src/lib.rs b/services/mgmt/quantum/src/lib.rs index 612bbee583..3148b450e5 100644 --- a/services/mgmt/quantum/src/lib.rs +++ b/services/mgmt/quantum/src/lib.rs @@ -7,3 +7,7 @@ pub mod package_2019_11_04_preview; #[cfg(all(feature = "package-2019-11-04-preview", not(feature = "no-default-tag")))] pub use package_2019_11_04_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-01-10-preview")] +pub mod package_2022_01_10_preview; +#[cfg(all(feature = "package-2022-01-10-preview", not(feature = "no-default-tag")))] +pub use package_2022_01_10_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/quantum/src/package_2022_01_10_preview/mod.rs b/services/mgmt/quantum/src/package_2022_01_10_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/quantum/src/package_2022_01_10_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/quantum/src/package_2022_01_10_preview/models.rs b/services/mgmt/quantum/src/package_2022_01_10_preview/models.rs new file mode 100644 index 0000000000..5499e0607f --- /dev/null +++ b/services/mgmt/quantum/src/package_2022_01_10_preview/models.rs @@ -0,0 +1,622 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Details of check name availability request body."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityParameters { + #[doc = "Name for checking availability."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The resource type of Quantum Workspace."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CheckNameAvailabilityParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of check name availability."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[doc = "Indicator of availability of the Quantum Workspace resource name."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "The reason of unavailability."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[doc = "The detailed info regarding the reason associated with the Namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response of a list Providers operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OfferingsListResult { + #[doc = "Result of a list Providers operation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if Value contains incomplete list of Providers."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OfferingsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Detailed pricing information for an sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PricingDetail { + #[doc = "Unique id for this pricing information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The unit cost of this sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl PricingDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about pricing dimension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PricingDimension { + #[doc = "Unique id of this pricing dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The display name of this pricing dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl PricingDimension { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a Provider. A Provider is an entity that offers Targets to run Azure Quantum Jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Provider { + #[doc = "Unique id of this provider."] + #[serde(rename = "providerId", default, skip_serializing_if = "Option::is_none")] + pub provider_id: Option, + #[doc = "The sku associated with pricing information for this provider."] + #[serde(rename = "providerSku", default, skip_serializing_if = "Option::is_none")] + pub provider_sku: Option, + #[doc = "A Uri identifying the specific instance of this provider."] + #[serde(rename = "instanceUri", default, skip_serializing_if = "Option::is_none")] + pub instance_uri: Option, + #[doc = "The provider's marketplace application display name."] + #[serde(rename = "applicationName", default, skip_serializing_if = "Option::is_none")] + pub application_name: Option, + #[doc = "Provisioning status field"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Id to track resource usage for the provider."] + #[serde(rename = "resourceUsageId", default, skip_serializing_if = "Option::is_none")] + pub resource_usage_id: Option, +} +impl Provider { + pub fn new() -> Self { + Self::default() + } +} +pub mod provider { + use super::*; + #[doc = "Provisioning status field"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Launching, + Updating, + Deleting, + Deleted, + Failed, + } +} +#[doc = "Information about an offering. A provider offering is an entity that offers Targets to run Azure Quantum Jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProviderDescription { + #[doc = "Unique provider's id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Provider's display name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Provider properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProviderDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProviderProperties { + #[doc = "A description about this provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Provider type."] + #[serde(rename = "providerType", default, skip_serializing_if = "Option::is_none")] + pub provider_type: Option, + #[doc = "Company name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub company: Option, + #[doc = "Provider's default endpoint."] + #[serde(rename = "defaultEndpoint", default, skip_serializing_if = "Option::is_none")] + pub default_endpoint: Option, + #[doc = "Azure Active Directory info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub aad: Option, + #[doc = "Provider's Managed-Application info"] + #[serde(rename = "managedApplication", default, skip_serializing_if = "Option::is_none")] + pub managed_application: Option, + #[doc = "The list of targets available from this provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub targets: Vec, + #[doc = "The list of skus available from this provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub skus: Vec, + #[doc = "The list of quota dimensions from the provider."] + #[serde(rename = "quotaDimensions", default, skip_serializing_if = "Vec::is_empty")] + pub quota_dimensions: Vec, + #[doc = "The list of pricing dimensions from the provider."] + #[serde(rename = "pricingDimensions", default, skip_serializing_if = "Vec::is_empty")] + pub pricing_dimensions: Vec, +} +impl ProviderProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod provider_properties { + use super::*; + #[doc = "Azure Active Directory info."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Aad { + #[doc = "Provider's application id."] + #[serde(rename = "applicationId", default, skip_serializing_if = "Option::is_none")] + pub application_id: Option, + #[doc = "Provider's tenant id."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + } + impl Aad { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "Provider's Managed-Application info"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ManagedApplication { + #[doc = "Provider's publisher id."] + #[serde(rename = "publisherId", default, skip_serializing_if = "Option::is_none")] + pub publisher_id: Option, + #[doc = "Provider's offer id."] + #[serde(rename = "offerId", default, skip_serializing_if = "Option::is_none")] + pub offer_id: Option, + } + impl ManagedApplication { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The resource proxy definition object for quantum workspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuantumWorkspace { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties of a Workspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Managed Identity information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl QuantumWorkspace { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + identity: None, + system_data: None, + } + } +} +pub mod quantum_workspace { + use super::*; + #[doc = "Managed Identity information."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Identity { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The identity type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + } + impl Identity { + pub fn new() -> Self { + Self::default() + } + } + pub mod identity { + use super::*; + #[doc = "The identity type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + } + } +} +#[doc = "Information about a specific quota dimension."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QuotaDimension { + #[doc = "Unique id of this dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The scope of this quota dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "The reset period of this quota dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub period: Option, + #[doc = "The max limit of this dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quota: Option, + #[doc = "The display name of this quota dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A description about this quota dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The standard unit of measurement used for this quota dimension."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "The standard unit of measurement used for this quota dimension in plural form."] + #[serde(rename = "unitPlural", default, skip_serializing_if = "Option::is_none")] + pub unit_plural: Option, +} +impl QuotaDimension { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a specific sku."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkuDescription { + #[doc = "Unique sku id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of this sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display name of this sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Description about this sku."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Uri to subscribe to the restricted access sku."] + #[serde(rename = "restrictedAccessUri", default, skip_serializing_if = "Option::is_none")] + pub restricted_access_uri: Option, + #[doc = "Flag to indicate whether the sku should be automatically added during workspace creation."] + #[serde(rename = "autoAdd", default, skip_serializing_if = "Option::is_none")] + pub auto_add: Option, + #[doc = "The list of targets available for this sku."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub targets: Vec, + #[doc = "The list of quota dimensions for this sku."] + #[serde(rename = "quotaDimensions", default, skip_serializing_if = "Vec::is_empty")] + pub quota_dimensions: Vec, + #[doc = "The list of pricing details for the sku."] + #[serde(rename = "pricingDetails", default, skip_serializing_if = "Vec::is_empty")] + pub pricing_details: Vec, +} +impl SkuDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tags object for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TagsObject { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TagsObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about a Target. A target is the component that can process a specific type of Job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetDescription { + #[doc = "Unique target id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of this target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "A description about this target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "List of data formats accepted by this target."] + #[serde(rename = "acceptedDataFormats", default, skip_serializing_if = "Vec::is_empty")] + pub accepted_data_formats: Vec, + #[doc = "List of content encodings accepted by this target."] + #[serde(rename = "acceptedContentEncodings", default, skip_serializing_if = "Vec::is_empty")] + pub accepted_content_encodings: Vec, +} +impl TargetDescription { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "The response of a list Workspaces operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceListResult { + #[doc = "Result of a list Workspaces operation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if Value contains incomplete list of Workspaces."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl WorkspaceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a Workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceResourceProperties { + #[doc = "List of Providers selected for this Workspace"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub providers: Vec, + #[doc = "Whether the current workspace is ready to accept Jobs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usable: Option, + #[doc = "Provisioning status field"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "ARM Resource Id of the storage account associated with this workspace."] + #[serde(rename = "storageAccount", default, skip_serializing_if = "Option::is_none")] + pub storage_account: Option, + #[doc = "The URI of the workspace endpoint."] + #[serde(rename = "endpointUri", default, skip_serializing_if = "Option::is_none")] + pub endpoint_uri: Option, +} +impl WorkspaceResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod workspace_resource_properties { + use super::*; + #[doc = "Whether the current workspace is ready to accept Jobs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Usable { + Yes, + No, + Partial, + } + #[doc = "Provisioning status field"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + ProviderLaunching, + ProviderUpdating, + ProviderDeleting, + ProviderProvisioning, + Failed, + } +} +#[doc = "Operation provided by provider"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Name of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Indicates whether the operation is a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Properties of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Properties of the operation"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "Provider name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operation name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Lists the operations available."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationsList { + #[doc = "Url to follow for getting next page of operations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "Array of operations"] + pub value: Vec, +} +impl OperationsList { + pub fn new(value: Vec) -> Self { + Self { next_link: None, value } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/quantum/src/package_2022_01_10_preview/operations.rs b/services/mgmt/quantum/src/package_2022_01_10_preview/operations.rs new file mode 100644 index 0000000000..400d11d89a --- /dev/null +++ b/services/mgmt/quantum/src/package_2022_01_10_preview/operations.rs @@ -0,0 +1,928 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn offerings(&self) -> offerings::Client { + offerings::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn workspace(&self) -> workspace::Client { + workspace::Client(self.clone()) + } + pub fn workspaces(&self) -> workspaces::Client { + workspaces::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Workspaces_Get(#[from] workspaces::get::Error), + #[error(transparent)] + Workspaces_CreateOrUpdate(#[from] workspaces::create_or_update::Error), + #[error(transparent)] + Workspaces_UpdateTags(#[from] workspaces::update_tags::Error), + #[error(transparent)] + Workspaces_Delete(#[from] workspaces::delete::Error), + #[error(transparent)] + Workspaces_ListBySubscription(#[from] workspaces::list_by_subscription::Error), + #[error(transparent)] + Workspaces_ListByResourceGroup(#[from] workspaces::list_by_resource_group::Error), + #[error(transparent)] + Offerings_List(#[from] offerings::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Workspace_CheckNameAvailability(#[from] workspace::check_name_availability::Error), +} +pub mod workspaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + quantum_workspace: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + quantum_workspace: quantum_workspace.into(), + } + } + pub fn update_tags( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + workspace_tags: impl Into, + ) -> update_tags::Builder { + update_tags::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + workspace_tags: workspace_tags.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + workspace_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + workspace_name: workspace_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Quantum/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuantumWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::QuantumWorkspace), + Ok200(models::QuantumWorkspace), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) quantum_workspace: models::QuantumWorkspace, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Quantum/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.quantum_workspace).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuantumWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuantumWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_tags { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + pub(crate) workspace_tags: models::TagsObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Quantum/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.workspace_tags).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QuantumWorkspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) workspace_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Quantum/workspaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Quantum/workspaces", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkspaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Quantum/workspaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkspaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod offerings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, subscription_id: impl Into, location_name: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location_name: location_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Quantum/locations/{}/offerings", + self.client.endpoint(), + &self.subscription_id, + &self.location_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OfferingsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Quantum/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspace { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn check_name_availability( + &self, + subscription_id: impl Into, + location_name: impl Into, + check_name_availability_parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location_name: location_name.into(), + check_name_availability_parameters: check_name_availability_parameters.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location_name: String, + pub(crate) check_name_availability_parameters: models::CheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Quantum/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.location_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-10-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.check_name_availability_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/quota/Cargo.toml b/services/mgmt/quota/Cargo.toml index e8d2956c75..e96aac1661 100644 --- a/services/mgmt/quota/Cargo.toml +++ b/services/mgmt/quota/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_quota" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/recommendationsservice/Cargo.toml b/services/mgmt/recommendationsservice/Cargo.toml index 8572a3cc20..6b977d7055 100644 --- a/services/mgmt/recommendationsservice/Cargo.toml +++ b/services/mgmt/recommendationsservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_recommendationsservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/recoveryservices/Cargo.toml b/services/mgmt/recoveryservices/Cargo.toml index 7e27c0d580..3cea75b691 100644 --- a/services/mgmt/recoveryservices/Cargo.toml +++ b/services/mgmt/recoveryservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_recoveryservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,15 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-12", "package-preview-2021-11", "package-2021-08", "package-2021-07"] +features = ["no-default-tag", "package-preview-2022-01", "package-2022-01", "package-2021-12", "package-preview-2021-11"] [features] -default = ["package-2022-01", "enable_reqwest"] +default = ["package-2022-02", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-02" = [] +"package-preview-2022-01" = [] "package-2022-01" = [] "package-2021-12" = [] "package-preview-2021-11" = [] diff --git a/services/mgmt/recoveryservices/README.md b/services/mgmt/recoveryservices/README.md index 74460c3978..3471f42098 100644 --- a/services/mgmt/recoveryservices/README.md +++ b/services/mgmt/recoveryservices/README.md @@ -6,10 +6,12 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/recoveryse To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2022-01`. +The default tag is `package-2022-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-02` has 19 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. +- `package-preview-2022-01` has 20 operations from 1 API versions: `2022-01-31-preview`. Use crate feature `package-preview-2022-01` to enable. The operations will be in the `package_preview_2022_01` module. - `package-2022-01` has 19 operations from 1 API versions: `2022-01-01`. Use crate feature `package-2022-01` to enable. The operations will be in the `package_2022_01` module. - `package-2021-12` has 19 operations from 1 API versions: `2021-12-01`. Use crate feature `package-2021-12` to enable. The operations will be in the `package_2021_12` module. - `package-preview-2021-11` has 19 operations from 1 API versions: `2021-11-01-preview`. Use crate feature `package-preview-2021-11` to enable. The operations will be in the `package_preview_2021_11` module. diff --git a/services/mgmt/recoveryservices/src/lib.rs b/services/mgmt/recoveryservices/src/lib.rs index d1ee3e614d..e18f817bc5 100644 --- a/services/mgmt/recoveryservices/src/lib.rs +++ b/services/mgmt/recoveryservices/src/lib.rs @@ -3,6 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-02")] +pub mod package_2022_02; +#[cfg(all(feature = "package-2022-02", not(feature = "no-default-tag")))] +pub use package_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-preview-2022-01")] +pub mod package_preview_2022_01; +#[cfg(all(feature = "package-preview-2022-01", not(feature = "no-default-tag")))] +pub use package_preview_2022_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2022-01")] pub mod package_2022_01; #[cfg(all(feature = "package-2022-01", not(feature = "no-default-tag")))] diff --git a/services/mgmt/recoveryservices/src/package_2022_02/mod.rs b/services/mgmt/recoveryservices/src/package_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/recoveryservices/src/package_2022_02/models.rs b/services/mgmt/recoveryservices/src/package_2022_02/models.rs new file mode 100644 index 0000000000..940acdd2e8 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_2022_02/models.rs @@ -0,0 +1,1188 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Details of the certificate to be uploaded to the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateRequest { + #[doc = "Raw certificate data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CertificateRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource Name availability input parameters - Resource type and resource name"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityParameters { + #[doc = "Describes the Resource type: Microsoft.RecoveryServices/Vaults"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource name for which availability needs to be checked"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl CheckNameAvailabilityParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for check name availability API. Resource provider will set availability as true | false."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Localized display information of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryDisplay { + #[doc = "Name of the provider for display purposes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "ResourceType for which this Operation can be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operations Name itself."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation having details of what operation is about."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ClientDiscoveryDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox log specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForLogSpecification { + #[doc = "Name of the log."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Blobs created in customer storage account per hour"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl ClientDiscoveryForLogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox properties in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForProperties { + #[doc = "Class to represent shoebox service specification in json client discovery."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl ClientDiscoveryForProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox service specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForServiceSpecification { + #[doc = "List of log specifications of this operation."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +impl ClientDiscoveryForServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations List response which contains list of available APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryResponse { + #[doc = "List of available operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next chunk of the response"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ClientDiscoveryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryValueForSingleApi { + #[doc = "Name of the Operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display information of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Class to represent shoebox properties in json client discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientDiscoveryValueForSingleApi { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from Azure Backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The details of the identity used for CMK"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CmkKekIdentity { + #[doc = "Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field"] + #[serde(rename = "useSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub use_system_assigned_identity: Option, + #[doc = "The user assigned identity to be used to grant permissions in case the type of identity used is UserAssigned"] + #[serde(rename = "userAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identity: Option, +} +impl CmkKekIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the Key Vault which hosts CMK"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CmkKeyVaultProperties { + #[doc = "The key uri of the Customer Managed Key"] + #[serde(rename = "keyUri", default, skip_serializing_if = "Option::is_none")] + pub key_uri: Option, +} +impl CmkKeyVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityData { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities."] + #[serde(rename = "type")] + pub type_: identity_data::Type, + #[doc = "The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl IdentityData { + pub fn new(type_: identity_data::Type) -> Self { + Self { + principal_id: None, + tenant_id: None, + type_, + user_assigned_identities: None, + } + } +} +pub mod identity_data { + use super::*; + #[doc = "The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + } +} +#[doc = "Summary of the replication job data for this vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobsSummary { + #[doc = "Count of failed jobs."] + #[serde(rename = "failedJobs", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs: Option, + #[doc = "Count of suspended jobs."] + #[serde(rename = "suspendedJobs", default, skip_serializing_if = "Option::is_none")] + pub suspended_jobs: Option, + #[doc = "Count of in-progress jobs."] + #[serde(rename = "inProgressJobs", default, skip_serializing_if = "Option::is_none")] + pub in_progress_jobs: Option, +} +impl JobsSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Summary of the replication monitoring data for this vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MonitoringSummary { + #[doc = "Count of unhealthy VMs."] + #[serde(rename = "unHealthyVmCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_vm_count: Option, + #[doc = "Count of unhealthy replication providers."] + #[serde(rename = "unHealthyProviderCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_provider_count: Option, + #[doc = "Count of all critical warnings."] + #[serde(rename = "eventsCount", default, skip_serializing_if = "Option::is_none")] + pub events_count: Option, + #[doc = "Count of all deprecated recovery service providers."] + #[serde(rename = "deprecatedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub deprecated_provider_count: Option, + #[doc = "Count of all the supported recovery service providers."] + #[serde(rename = "supportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub supported_provider_count: Option, + #[doc = "Count of all the unsupported recovery service providers."] + #[serde(rename = "unsupportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub unsupported_provider_count: Option, +} +impl MonitoringSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The name of usage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NameInfo { + #[doc = "Value of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Localized value of usage."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +impl NameInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResource { + #[doc = "End time of the operation"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "It should match what is used to GET the operation result"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "It must match the last segment of the \"id\" field, and will typically be a GUID / system generated value"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The status of the operation. (InProgress/Success/Failed/Cancelled)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Start time of the operation"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +impl OperationResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tracked resource with location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchTrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PatchTrackedResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Patch Resource information, as returned by the resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchVault { + #[serde(flatten)] + pub patch_tracked_resource: PatchTrackedResource, + #[doc = "Properties of the vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identifies the unique system identifier for each Azure resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl PatchVault { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "Gets or sets id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Endpoint Connection Response Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[doc = "Gets or sets provisioning state of the private endpoint connection."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "Gets or sets private link service connection state."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_endpoint_connection { + use super::*; + #[doc = "Gets or sets provisioning state of the private endpoint connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, + } +} +#[doc = "Information to be stored in Vault properties as an element of privateEndpointConnections List."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionVaultProperties { + #[doc = "Format of id subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Private Endpoint Connection Response Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the private Endpoint Connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type, which will be of the format, Microsoft.RecoveryServices/vaults/privateEndpointConnections"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The location of the private Endpoint connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl PrivateEndpointConnectionVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information of the private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[doc = "Properties of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Fully qualified identifier of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "e.g. Microsoft.RecoveryServices/vaults/privateLinkResources"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery)"] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "[backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1]"] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class which represent the stamps associated with the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResources { + #[doc = "A collection of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next chunk of the response"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateLinkResources { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gets or sets private link service connection state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "Gets or sets the status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Gets or sets description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Gets or sets actions required."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_link_service_connection_state { + use super::*; + #[doc = "Gets or sets the status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[doc = "Raw certificate data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RawCertificateData { + #[doc = "Specifies the authentication type."] + #[serde(rename = "authType", default, skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + #[doc = "The base64 encoded certificate raw data string"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, +} +impl RawCertificateData { + pub fn new() -> Self { + Self::default() + } +} +pub mod raw_certificate_data { + use super::*; + #[doc = "Specifies the authentication type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthType { + Invalid, + #[serde(rename = "ACS")] + Acs, + #[serde(rename = "AAD")] + Aad, + AccessControlService, + AzureActiveDirectory, + } +} +#[doc = "Replication usages of a vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationUsage { + #[doc = "Summary of the replication monitoring data for this vault."] + #[serde(rename = "monitoringSummary", default, skip_serializing_if = "Option::is_none")] + pub monitoring_summary: Option, + #[doc = "Summary of the replication job data for this vault."] + #[serde(rename = "jobsSummary", default, skip_serializing_if = "Option::is_none")] + pub jobs_summary: Option, + #[doc = "Number of replication protected items for this vault."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "Number of replication recovery plans for this vault."] + #[serde(rename = "recoveryPlanCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_plan_count: Option, + #[doc = "Number of servers registered to this vault."] + #[serde(rename = "registeredServersCount", default, skip_serializing_if = "Option::is_none")] + pub registered_servers_count: Option, + #[doc = "The authentication type of recovery service providers in the vault."] + #[serde(rename = "recoveryServicesProviderAuthType", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_auth_type: Option, +} +impl ReplicationUsage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication usages for vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationUsageList { + #[doc = "The list of replication usages for the given vault."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ReplicationUsageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ARM Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Optional ETag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Certificate details representing the Vault credentials for AAD."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAadDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[doc = "AAD tenant authority."] + #[serde(rename = "aadAuthority")] + pub aad_authority: String, + #[doc = "AAD tenant Id."] + #[serde(rename = "aadTenantId")] + pub aad_tenant_id: String, + #[doc = "AAD service principal clientId."] + #[serde(rename = "servicePrincipalClientId")] + pub service_principal_client_id: String, + #[doc = "AAD service principal ObjectId."] + #[serde(rename = "servicePrincipalObjectId")] + pub service_principal_object_id: String, + #[doc = "Azure Management Endpoint Audience."] + #[serde(rename = "azureManagementEndpointAudience")] + pub azure_management_endpoint_audience: String, + #[doc = "Service Resource Id."] + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, +} +impl ResourceCertificateAndAadDetails { + pub fn new( + resource_certificate_details: ResourceCertificateDetails, + aad_authority: String, + aad_tenant_id: String, + service_principal_client_id: String, + service_principal_object_id: String, + azure_management_endpoint_audience: String, + ) -> Self { + Self { + resource_certificate_details, + aad_authority, + aad_tenant_id, + service_principal_client_id, + service_principal_object_id, + azure_management_endpoint_audience, + service_resource_id: None, + } + } +} +#[doc = "Certificate details representing the Vault credentials for ACS."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAcsDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[doc = "ACS namespace name - tenant for our service."] + #[serde(rename = "globalAcsNamespace")] + pub global_acs_namespace: String, + #[doc = "Acs mgmt host name to connect to."] + #[serde(rename = "globalAcsHostName")] + pub global_acs_host_name: String, + #[doc = "Global ACS namespace RP realm."] + #[serde(rename = "globalAcsRPRealm")] + pub global_acs_rp_realm: String, +} +impl ResourceCertificateAndAcsDetails { + pub fn new( + resource_certificate_details: ResourceCertificateDetails, + global_acs_namespace: String, + global_acs_host_name: String, + global_acs_rp_realm: String, + ) -> Self { + Self { + resource_certificate_details, + global_acs_namespace, + global_acs_host_name, + global_acs_rp_realm, + } + } +} +#[doc = "Certificate details representing the Vault credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateDetails { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "authType")] + pub auth_type: String, + #[doc = "The base64 encoded certificate raw data string."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, + #[doc = "Certificate friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Certificate issuer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issuer: Option, + #[doc = "Resource ID of the vault."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Certificate Subject Name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[doc = "Certificate thumbprint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[doc = "Certificate Validity start Date time."] + #[serde(rename = "validFrom", default, skip_serializing_if = "Option::is_none")] + pub valid_from: Option, + #[doc = "Certificate Validity End Date time."] + #[serde(rename = "validTo", default, skip_serializing_if = "Option::is_none")] + pub valid_to: Option, +} +impl ResourceCertificateDetails { + pub fn new(auth_type: String) -> Self { + Self { + auth_type, + certificate: None, + friendly_name: None, + issuer: None, + resource_id: None, + subject: None, + thumbprint: None, + valid_from: None, + valid_to: None, + } + } +} +#[doc = "Identifies the unique system identifier for each Azure resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[doc = "The Sku name."] + pub name: sku::Name, + #[doc = "The Sku tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The sku family"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[doc = "The sku size"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[doc = "The sku capacity"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl Sku { + pub fn new(name: sku::Name) -> Self { + Self { + name, + tier: None, + family: None, + size: None, + capacity: None, + } + } +} +pub mod sku { + use super::*; + #[doc = "The Sku name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + #[serde(rename = "RS0")] + Rs0, + } +} +#[doc = "Tracked resource with location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource location."] + pub location: String, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + location, + tags: None, + } + } +} +#[doc = "Details for upgrading vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpgradeDetails { + #[doc = "ID of the vault upgrade operation."] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "UTC time at which the upgrade operation has started."] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "UTC time at which the upgrade operation status was last updated."] + #[serde(rename = "lastUpdatedTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time_utc: Option, + #[doc = "UTC time at which the upgrade operation has ended."] + #[serde(rename = "endTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub end_time_utc: Option, + #[doc = "Status of the vault upgrade operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Message to the user containing information about the upgrade operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The way the vault upgrade was triggered."] + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[doc = "Resource ID of the upgraded vault."] + #[serde(rename = "upgradedResourceId", default, skip_serializing_if = "Option::is_none")] + pub upgraded_resource_id: Option, + #[doc = "Resource ID of the vault before the upgrade."] + #[serde(rename = "previousResourceId", default, skip_serializing_if = "Option::is_none")] + pub previous_resource_id: Option, +} +impl UpgradeDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod upgrade_details { + use super::*; + #[doc = "Status of the vault upgrade operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Upgraded, + Failed, + } + #[doc = "The way the vault upgrade was triggered."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerType { + UserTriggered, + ForcedUpgrade, + } +} +#[doc = "A resource identity that is managed by the user of the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserIdentity { + #[doc = "The principal ID of the user-assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client ID of the user-assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource information, as returned by the resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vault { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties of the vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identifies the unique system identifier for each Azure resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Vault { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + identity: None, + properties: None, + sku: None, + system_data: None, + } + } +} +#[doc = "Certificate corresponding to a vault that can be used by clients to register themselves with the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultCertificateResponse { + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Certificate details representing the Vault credentials."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultCertificateResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultExtendedInfo { + #[doc = "Integrity key."] + #[serde(rename = "integrityKey", default, skip_serializing_if = "Option::is_none")] + pub integrity_key: Option, + #[doc = "Encryption key."] + #[serde(rename = "encryptionKey", default, skip_serializing_if = "Option::is_none")] + pub encryption_key: Option, + #[doc = "Encryption key thumbprint."] + #[serde(rename = "encryptionKeyThumbprint", default, skip_serializing_if = "Option::is_none")] + pub encryption_key_thumbprint: Option, + #[doc = "Algorithm for Vault ExtendedInfo"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub algorithm: Option, +} +impl VaultExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultExtendedInfoResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Vault extended information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultExtendedInfoResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response model for a list of Vaults."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VaultList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultProperties { + #[doc = "Provisioning State."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Details for upgrading vault."] + #[serde(rename = "upgradeDetails", default, skip_serializing_if = "Option::is_none")] + pub upgrade_details: Option, + #[doc = "List of private endpoint connection."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Private endpoint state for backup."] + #[serde(rename = "privateEndpointStateForBackup", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_backup: Option, + #[doc = "Private endpoint state for site recovery."] + #[serde(rename = "privateEndpointStateForSiteRecovery", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_site_recovery: Option, + #[doc = "Customer Managed Key details of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "The details of the latest move operation performed on the Azure Resource"] + #[serde(rename = "moveDetails", default, skip_serializing_if = "Option::is_none")] + pub move_details: Option, + #[doc = "The State of the Resource after the move operation"] + #[serde(rename = "moveState", default, skip_serializing_if = "Option::is_none")] + pub move_state: Option, + #[doc = "Backup storage version"] + #[serde(rename = "backupStorageVersion", default, skip_serializing_if = "Option::is_none")] + pub backup_storage_version: Option, +} +impl VaultProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod vault_properties { + use super::*; + #[doc = "Private endpoint state for backup."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForBackup { + None, + Enabled, + } + #[doc = "Private endpoint state for site recovery."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForSiteRecovery { + None, + Enabled, + } + #[doc = "Customer Managed Key details of the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Encryption { + #[doc = "The properties of the Key Vault which hosts CMK"] + #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub key_vault_properties: Option, + #[doc = "The details of the identity used for CMK"] + #[serde(rename = "kekIdentity", default, skip_serializing_if = "Option::is_none")] + pub kek_identity: Option, + #[doc = "Enabling/Disabling the Double Encryption state"] + #[serde(rename = "infrastructureEncryption", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_encryption: Option, + } + impl Encryption { + pub fn new() -> Self { + Self::default() + } + } + pub mod encryption { + use super::*; + #[doc = "Enabling/Disabling the Double Encryption state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InfrastructureEncryption { + Enabled, + Disabled, + } + } + #[doc = "The details of the latest move operation performed on the Azure Resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct MoveDetails { + #[doc = "OperationId of the Resource Move Operation"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "Start Time of the Resource Move Operation"] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "End Time of the Resource Move Operation"] + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[doc = "Source Resource of the Resource Move Operation"] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Target Resource of the Resource Move Operation"] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + } + impl MoveDetails { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The State of the Resource after the move operation"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + PrepareTimedout, + CommitTimedout, + MoveSucceeded, + Failure, + CriticalFailure, + PartialSuccess, + } + #[doc = "Backup storage version"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupStorageVersion { + V1, + V2, + Unassigned, + } +} +#[doc = "Usages of a vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultUsage { + #[doc = "Unit of the usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "Quota period of usage."] + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[doc = "Next reset time of usage."] + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[doc = "Current value of usage."] + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[doc = "Limit of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The name of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl VaultUsage { + pub fn new() -> Self { + Self::default() + } +} +pub mod vault_usage { + use super::*; + #[doc = "Unit of the usage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[doc = "Usage for vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultUsageList { + #[doc = "The list of usages for the given vault."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl VaultUsageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/recoveryservices/src/package_2022_02/operations.rs b/services/mgmt/recoveryservices/src/package_2022_02/operations.rs new file mode 100644 index 0000000000..cc44b97938 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_2022_02/operations.rs @@ -0,0 +1,1903 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn recovery_services(&self) -> recovery_services::Client { + recovery_services::Client(self.clone()) + } + pub fn registered_identities(&self) -> registered_identities::Client { + registered_identities::Client(self.clone()) + } + pub fn replication_usages(&self) -> replication_usages::Client { + replication_usages::Client(self.clone()) + } + pub fn usages(&self) -> usages::Client { + usages::Client(self.clone()) + } + pub fn vault_certificates(&self) -> vault_certificates::Client { + vault_certificates::Client(self.clone()) + } + pub fn vault_extended_info(&self) -> vault_extended_info::Client { + vault_extended_info::Client(self.clone()) + } + pub fn vaults(&self) -> vaults::Client { + vaults::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + VaultCertificates_Create(#[from] vault_certificates::create::Error), + #[error(transparent)] + RegisteredIdentities_Delete(#[from] registered_identities::delete::Error), + #[error(transparent)] + ReplicationUsages_List(#[from] replication_usages::list::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + RecoveryServices_CheckNameAvailability(#[from] recovery_services::check_name_availability::Error), + #[error(transparent)] + Vaults_ListBySubscriptionId(#[from] vaults::list_by_subscription_id::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Vaults_ListByResourceGroup(#[from] vaults::list_by_resource_group::Error), + #[error(transparent)] + Vaults_Get(#[from] vaults::get::Error), + #[error(transparent)] + Vaults_CreateOrUpdate(#[from] vaults::create_or_update::Error), + #[error(transparent)] + Vaults_Update(#[from] vaults::update::Error), + #[error(transparent)] + Vaults_Delete(#[from] vaults::delete::Error), + #[error(transparent)] + VaultExtendedInfo_Get(#[from] vault_extended_info::get::Error), + #[error(transparent)] + VaultExtendedInfo_CreateOrUpdate(#[from] vault_extended_info::create_or_update::Error), + #[error(transparent)] + VaultExtendedInfo_Update(#[from] vault_extended_info::update::Error), + #[error(transparent)] + GetOperationStatus(#[from] get_operation_status::Error), + #[error(transparent)] + GetOperationResult(#[from] get_operation_result::Error), + #[error(transparent)] + Usages_ListByVaults(#[from] usages::list_by_vaults::Error), +} +pub mod vault_certificates { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + certificate_name: impl Into, + certificate_request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + certificate_name: certificate_name.into(), + certificate_request: certificate_request.into(), + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) certificate_name: String, + pub(crate) certificate_request: models::CertificateRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.certificate_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultCertificateResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod registered_identities { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + identity_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + identity_name: identity_name.into(), + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) identity_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/registeredIdentities/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.identity_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_usages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationUsages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the list of private link resources that need to be created for Backup and SiteRecovery"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "Returns a specified private link resource that need to be created for Backup and SiteRecovery"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + private_link_resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + private_link_resource_name: private_link_resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResources = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) private_link_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.private_link_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago"] + pub fn check_name_availability( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + input: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + input: input.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) input: models::CheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vaults { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription_id(&self, subscription_id: impl Into) -> list_by_subscription_id::Builder { + list_by_subscription_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_subscription_id { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Created201(models::Vault), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::Vault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::PatchVault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vault_extended_info { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn get_operation_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + pub fn get_operation_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } +} +pub mod get_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod usages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_vaults( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list_by_vaults::Builder { + list_by_vaults::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_vaults { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservices/src/package_preview_2022_01/mod.rs b/services/mgmt/recoveryservices/src/package_preview_2022_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2022_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/recoveryservices/src/package_preview_2022_01/models.rs b/services/mgmt/recoveryservices/src/package_preview_2022_01/models.rs new file mode 100644 index 0000000000..060a3b9c9a --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2022_01/models.rs @@ -0,0 +1,1291 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Capabilities information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CapabilitiesProperties { + #[serde(rename = "dnsZones", default, skip_serializing_if = "Vec::is_empty")] + pub dns_zones: Vec, +} +impl CapabilitiesProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Capabilities response for Microsoft.RecoveryServices"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapabilitiesResponse { + #[serde(flatten)] + pub resource_capabilities_base: ResourceCapabilitiesBase, + #[doc = "Capabilities properties in response"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CapabilitiesResponse { + pub fn new(resource_capabilities_base: ResourceCapabilitiesBase) -> Self { + Self { + resource_capabilities_base, + properties: None, + } + } +} +#[doc = "Capabilities properties in response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CapabilitiesResponseProperties { + #[serde(rename = "dnsZones", default, skip_serializing_if = "Vec::is_empty")] + pub dns_zones: Vec, +} +impl CapabilitiesResponseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of the certificate to be uploaded to the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CertificateRequest { + #[doc = "Raw certificate data."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CertificateRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource Name availability input parameters - Resource type and resource name"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityParameters { + #[doc = "Describes the Resource type: Microsoft.RecoveryServices/Vaults"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource name for which availability needs to be checked"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl CheckNameAvailabilityParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response for check name availability API. Resource provider will set availability as true | false."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Localized display information of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryDisplay { + #[doc = "Name of the provider for display purposes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "ResourceType for which this Operation can be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operations Name itself."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation having details of what operation is about."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ClientDiscoveryDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox log specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForLogSpecification { + #[doc = "Name of the log."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Blobs created in customer storage account per hour"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl ClientDiscoveryForLogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox properties in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForProperties { + #[doc = "Class to represent shoebox service specification in json client discovery."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl ClientDiscoveryForProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox service specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForServiceSpecification { + #[doc = "List of log specifications of this operation."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +impl ClientDiscoveryForServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations List response which contains list of available APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryResponse { + #[doc = "List of available operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next chunk of the response"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ClientDiscoveryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryValueForSingleApi { + #[doc = "Name of the Operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display information of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Class to represent shoebox properties in json client discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientDiscoveryValueForSingleApi { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from Azure Backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The details of the identity used for CMK"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CmkKekIdentity { + #[doc = "Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field"] + #[serde(rename = "useSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub use_system_assigned_identity: Option, + #[doc = "The user assigned identity to be used to grant permissions in case the type of identity used is UserAssigned"] + #[serde(rename = "userAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identity: Option, +} +impl CmkKekIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the Key Vault which hosts CMK"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CmkKeyVaultProperties { + #[doc = "The key uri of the Customer Managed Key"] + #[serde(rename = "keyUri", default, skip_serializing_if = "Option::is_none")] + pub key_uri: Option, +} +impl CmkKeyVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DNSZone information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DnsZone { + #[doc = "Subresource type for vault, AzureBackup or AzureSiteRecovery"] + #[serde(rename = "subResource", default, skip_serializing_if = "Option::is_none")] + pub sub_resource: Option, +} +impl DnsZone { + pub fn new() -> Self { + Self::default() + } +} +pub mod dns_zone { + use super::*; + #[doc = "Subresource type for vault, AzureBackup or AzureSiteRecovery"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SubResource { + AzureBackup, + AzureSiteRecovery, + } +} +#[doc = "DNSZone information for Microsoft.RecoveryServices"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DnsZoneResponse { + #[serde(flatten)] + pub dns_zone: DnsZone, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl DnsZoneResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity for the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityData { + #[doc = "The principal ID of resource identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of resource."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities."] + #[serde(rename = "type")] + pub type_: identity_data::Type, + #[doc = "The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."] + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +impl IdentityData { + pub fn new(type_: identity_data::Type) -> Self { + Self { + principal_id: None, + tenant_id: None, + type_, + user_assigned_identities: None, + } + } +} +pub mod identity_data { + use super::*; + #[doc = "The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + None, + UserAssigned, + #[serde(rename = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + } +} +#[doc = "Summary of the replication job data for this vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobsSummary { + #[doc = "Count of failed jobs."] + #[serde(rename = "failedJobs", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs: Option, + #[doc = "Count of suspended jobs."] + #[serde(rename = "suspendedJobs", default, skip_serializing_if = "Option::is_none")] + pub suspended_jobs: Option, + #[doc = "Count of in-progress jobs."] + #[serde(rename = "inProgressJobs", default, skip_serializing_if = "Option::is_none")] + pub in_progress_jobs: Option, +} +impl JobsSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Summary of the replication monitoring data for this vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MonitoringSummary { + #[doc = "Count of unhealthy VMs."] + #[serde(rename = "unHealthyVmCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_vm_count: Option, + #[doc = "Count of unhealthy replication providers."] + #[serde(rename = "unHealthyProviderCount", default, skip_serializing_if = "Option::is_none")] + pub un_healthy_provider_count: Option, + #[doc = "Count of all critical warnings."] + #[serde(rename = "eventsCount", default, skip_serializing_if = "Option::is_none")] + pub events_count: Option, + #[doc = "Count of all deprecated recovery service providers."] + #[serde(rename = "deprecatedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub deprecated_provider_count: Option, + #[doc = "Count of all the supported recovery service providers."] + #[serde(rename = "supportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub supported_provider_count: Option, + #[doc = "Count of all the unsupported recovery service providers."] + #[serde(rename = "unsupportedProviderCount", default, skip_serializing_if = "Option::is_none")] + pub unsupported_provider_count: Option, +} +impl MonitoringSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The name of usage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NameInfo { + #[doc = "Value of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Localized value of usage."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +impl NameInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResource { + #[doc = "End time of the operation"] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The resource management error response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "It should match what is used to GET the operation result"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "It must match the last segment of the \"id\" field, and will typically be a GUID / system generated value"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The status of the operation. (InProgress/Success/Failed/Cancelled)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Start time of the operation"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +impl OperationResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tracked resource with location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchTrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl PatchTrackedResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Patch Resource information, as returned by the resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PatchVault { + #[serde(flatten)] + pub patch_tracked_resource: PatchTrackedResource, + #[doc = "Properties of the vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identifies the unique system identifier for each Azure resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl PatchVault { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "Gets or sets id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Endpoint Connection Response Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[doc = "Gets or sets provisioning state of the private endpoint connection."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "Gets or sets private link service connection state."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_endpoint_connection { + use super::*; + #[doc = "Gets or sets provisioning state of the private endpoint connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, + } +} +#[doc = "Information to be stored in Vault properties as an element of privateEndpointConnections List."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionVaultProperties { + #[doc = "Format of id subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Private Endpoint Connection Response Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The name of the private Endpoint Connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type, which will be of the format, Microsoft.RecoveryServices/vaults/privateEndpointConnections"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The location of the private Endpoint connection"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl PrivateEndpointConnectionVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information of the private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[doc = "Properties of the private link resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Fully qualified identifier of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "e.g. Microsoft.RecoveryServices/vaults/privateLinkResources"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery)"] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "[backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1]"] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class which represent the stamps associated with the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResources { + #[doc = "A collection of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next chunk of the response"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateLinkResources { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Gets or sets private link service connection state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "Gets or sets the status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Gets or sets description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Gets or sets actions required."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_link_service_connection_state { + use super::*; + #[doc = "Gets or sets the status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[doc = "Raw certificate data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RawCertificateData { + #[doc = "Specifies the authentication type."] + #[serde(rename = "authType", default, skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + #[doc = "The base64 encoded certificate raw data string"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, +} +impl RawCertificateData { + pub fn new() -> Self { + Self::default() + } +} +pub mod raw_certificate_data { + use super::*; + #[doc = "Specifies the authentication type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthType { + Invalid, + #[serde(rename = "ACS")] + Acs, + #[serde(rename = "AAD")] + Aad, + AccessControlService, + AzureActiveDirectory, + } +} +#[doc = "Replication usages of a vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationUsage { + #[doc = "Summary of the replication monitoring data for this vault."] + #[serde(rename = "monitoringSummary", default, skip_serializing_if = "Option::is_none")] + pub monitoring_summary: Option, + #[doc = "Summary of the replication job data for this vault."] + #[serde(rename = "jobsSummary", default, skip_serializing_if = "Option::is_none")] + pub jobs_summary: Option, + #[doc = "Number of replication protected items for this vault."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "Number of replication recovery plans for this vault."] + #[serde(rename = "recoveryPlanCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_plan_count: Option, + #[doc = "Number of servers registered to this vault."] + #[serde(rename = "registeredServersCount", default, skip_serializing_if = "Option::is_none")] + pub registered_servers_count: Option, + #[doc = "The authentication type of recovery service providers in the vault."] + #[serde(rename = "recoveryServicesProviderAuthType", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_auth_type: Option, +} +impl ReplicationUsage { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication usages for vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationUsageList { + #[doc = "The list of replication usages for the given vault."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ReplicationUsageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ARM Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Optional ETag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input to get capabilities information for Microsoft.RecoveryServices"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCapabilities { + #[serde(flatten)] + pub resource_capabilities_base: ResourceCapabilitiesBase, + #[doc = "Capabilities information"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResourceCapabilities { + pub fn new(resource_capabilities_base: ResourceCapabilitiesBase) -> Self { + Self { + resource_capabilities_base, + properties: None, + } + } +} +#[doc = "Base class for request and response capabilities information for Microsoft.RecoveryServices"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCapabilitiesBase { + #[doc = "Describes the Resource type: Microsoft.RecoveryServices/Vaults"] + #[serde(rename = "type")] + pub type_: String, +} +impl ResourceCapabilitiesBase { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Certificate details representing the Vault credentials for AAD."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAadDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[doc = "AAD tenant authority."] + #[serde(rename = "aadAuthority")] + pub aad_authority: String, + #[doc = "AAD tenant Id."] + #[serde(rename = "aadTenantId")] + pub aad_tenant_id: String, + #[doc = "AAD service principal clientId."] + #[serde(rename = "servicePrincipalClientId")] + pub service_principal_client_id: String, + #[doc = "AAD service principal ObjectId."] + #[serde(rename = "servicePrincipalObjectId")] + pub service_principal_object_id: String, + #[doc = "Azure Management Endpoint Audience."] + #[serde(rename = "azureManagementEndpointAudience")] + pub azure_management_endpoint_audience: String, + #[doc = "Service Resource Id."] + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, +} +impl ResourceCertificateAndAadDetails { + pub fn new( + resource_certificate_details: ResourceCertificateDetails, + aad_authority: String, + aad_tenant_id: String, + service_principal_client_id: String, + service_principal_object_id: String, + azure_management_endpoint_audience: String, + ) -> Self { + Self { + resource_certificate_details, + aad_authority, + aad_tenant_id, + service_principal_client_id, + service_principal_object_id, + azure_management_endpoint_audience, + service_resource_id: None, + } + } +} +#[doc = "Certificate details representing the Vault credentials for ACS."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateAndAcsDetails { + #[serde(flatten)] + pub resource_certificate_details: ResourceCertificateDetails, + #[doc = "ACS namespace name - tenant for our service."] + #[serde(rename = "globalAcsNamespace")] + pub global_acs_namespace: String, + #[doc = "Acs mgmt host name to connect to."] + #[serde(rename = "globalAcsHostName")] + pub global_acs_host_name: String, + #[doc = "Global ACS namespace RP realm."] + #[serde(rename = "globalAcsRPRealm")] + pub global_acs_rp_realm: String, +} +impl ResourceCertificateAndAcsDetails { + pub fn new( + resource_certificate_details: ResourceCertificateDetails, + global_acs_namespace: String, + global_acs_host_name: String, + global_acs_rp_realm: String, + ) -> Self { + Self { + resource_certificate_details, + global_acs_namespace, + global_acs_host_name, + global_acs_rp_realm, + } + } +} +#[doc = "Certificate details representing the Vault credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceCertificateDetails { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "authType")] + pub auth_type: String, + #[doc = "The base64 encoded certificate raw data string."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, + #[doc = "Certificate friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Certificate issuer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issuer: Option, + #[doc = "Resource ID of the vault."] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Certificate Subject Name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subject: Option, + #[doc = "Certificate thumbprint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub thumbprint: Option, + #[doc = "Certificate Validity start Date time."] + #[serde(rename = "validFrom", default, skip_serializing_if = "Option::is_none")] + pub valid_from: Option, + #[doc = "Certificate Validity End Date time."] + #[serde(rename = "validTo", default, skip_serializing_if = "Option::is_none")] + pub valid_to: Option, +} +impl ResourceCertificateDetails { + pub fn new(auth_type: String) -> Self { + Self { + auth_type, + certificate: None, + friendly_name: None, + issuer: None, + resource_id: None, + subject: None, + thumbprint: None, + valid_from: None, + valid_to: None, + } + } +} +#[doc = "Identifies the unique system identifier for each Azure resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[doc = "The Sku name."] + pub name: sku::Name, + #[doc = "The Sku tier."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The sku family"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub family: Option, + #[doc = "The sku size"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, + #[doc = "The sku capacity"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl Sku { + pub fn new(name: sku::Name) -> Self { + Self { + name, + tier: None, + family: None, + size: None, + capacity: None, + } + } +} +pub mod sku { + use super::*; + #[doc = "The Sku name."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + #[serde(rename = "RS0")] + Rs0, + } +} +#[doc = "Tracked resource with location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource location."] + pub location: String, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + location, + tags: None, + } + } +} +#[doc = "Details for upgrading vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpgradeDetails { + #[doc = "ID of the vault upgrade operation."] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "UTC time at which the upgrade operation has started."] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "UTC time at which the upgrade operation status was last updated."] + #[serde(rename = "lastUpdatedTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time_utc: Option, + #[doc = "UTC time at which the upgrade operation has ended."] + #[serde(rename = "endTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub end_time_utc: Option, + #[doc = "Status of the vault upgrade operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Message to the user containing information about the upgrade operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The way the vault upgrade was triggered."] + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[doc = "Resource ID of the upgraded vault."] + #[serde(rename = "upgradedResourceId", default, skip_serializing_if = "Option::is_none")] + pub upgraded_resource_id: Option, + #[doc = "Resource ID of the vault before the upgrade."] + #[serde(rename = "previousResourceId", default, skip_serializing_if = "Option::is_none")] + pub previous_resource_id: Option, +} +impl UpgradeDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod upgrade_details { + use super::*; + #[doc = "Status of the vault upgrade operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Unknown, + InProgress, + Upgraded, + Failed, + } + #[doc = "The way the vault upgrade was triggered."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerType { + UserTriggered, + ForcedUpgrade, + } +} +#[doc = "A resource identity that is managed by the user of the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserIdentity { + #[doc = "The principal ID of the user-assigned identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client ID of the user-assigned identity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, +} +impl UserIdentity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resource information, as returned by the resource provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vault { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Identity for the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[doc = "Properties of the vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Identifies the unique system identifier for each Azure resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl Vault { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + identity: None, + properties: None, + sku: None, + system_data: None, + } + } +} +#[doc = "Certificate corresponding to a vault that can be used by clients to register themselves with the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultCertificateResponse { + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Certificate details representing the Vault credentials."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultCertificateResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultExtendedInfo { + #[doc = "Integrity key."] + #[serde(rename = "integrityKey", default, skip_serializing_if = "Option::is_none")] + pub integrity_key: Option, + #[doc = "Encryption key."] + #[serde(rename = "encryptionKey", default, skip_serializing_if = "Option::is_none")] + pub encryption_key: Option, + #[doc = "Encryption key thumbprint."] + #[serde(rename = "encryptionKeyThumbprint", default, skip_serializing_if = "Option::is_none")] + pub encryption_key_thumbprint: Option, + #[doc = "Algorithm for Vault ExtendedInfo"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub algorithm: Option, +} +impl VaultExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultExtendedInfoResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Vault extended information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultExtendedInfoResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response model for a list of Vaults."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VaultList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultProperties { + #[doc = "Provisioning State."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Details for upgrading vault."] + #[serde(rename = "upgradeDetails", default, skip_serializing_if = "Option::is_none")] + pub upgrade_details: Option, + #[doc = "List of private endpoint connection."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Private endpoint state for backup."] + #[serde(rename = "privateEndpointStateForBackup", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_backup: Option, + #[doc = "Private endpoint state for site recovery."] + #[serde(rename = "privateEndpointStateForSiteRecovery", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint_state_for_site_recovery: Option, + #[doc = "Customer Managed Key details of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "The details of the latest move operation performed on the Azure Resource"] + #[serde(rename = "moveDetails", default, skip_serializing_if = "Option::is_none")] + pub move_details: Option, + #[doc = "The State of the Resource after the move operation"] + #[serde(rename = "moveState", default, skip_serializing_if = "Option::is_none")] + pub move_state: Option, + #[doc = "Backup storage version"] + #[serde(rename = "backupStorageVersion", default, skip_serializing_if = "Option::is_none")] + pub backup_storage_version: Option, +} +impl VaultProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod vault_properties { + use super::*; + #[doc = "Private endpoint state for backup."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForBackup { + None, + Enabled, + } + #[doc = "Private endpoint state for site recovery."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrivateEndpointStateForSiteRecovery { + None, + Enabled, + } + #[doc = "Customer Managed Key details of the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Encryption { + #[doc = "The properties of the Key Vault which hosts CMK"] + #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub key_vault_properties: Option, + #[doc = "The details of the identity used for CMK"] + #[serde(rename = "kekIdentity", default, skip_serializing_if = "Option::is_none")] + pub kek_identity: Option, + #[doc = "Enabling/Disabling the Double Encryption state"] + #[serde(rename = "infrastructureEncryption", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_encryption: Option, + } + impl Encryption { + pub fn new() -> Self { + Self::default() + } + } + pub mod encryption { + use super::*; + #[doc = "Enabling/Disabling the Double Encryption state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InfrastructureEncryption { + Enabled, + Disabled, + } + } + #[doc = "The details of the latest move operation performed on the Azure Resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct MoveDetails { + #[doc = "OperationId of the Resource Move Operation"] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "Start Time of the Resource Move Operation"] + #[serde(rename = "startTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub start_time_utc: Option, + #[doc = "End Time of the Resource Move Operation"] + #[serde(rename = "completionTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub completion_time_utc: Option, + #[doc = "Source Resource of the Resource Move Operation"] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Target Resource of the Resource Move Operation"] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + } + impl MoveDetails { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The State of the Resource after the move operation"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MoveState { + Unknown, + InProgress, + PrepareFailed, + CommitFailed, + PrepareTimedout, + CommitTimedout, + MoveSucceeded, + Failure, + CriticalFailure, + PartialSuccess, + } + #[doc = "Backup storage version"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupStorageVersion { + V1, + V2, + Unassigned, + } +} +#[doc = "Usages of a vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultUsage { + #[doc = "Unit of the usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "Quota period of usage."] + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[doc = "Next reset time of usage."] + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[doc = "Current value of usage."] + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[doc = "Limit of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The name of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl VaultUsage { + pub fn new() -> Self { + Self::default() + } +} +pub mod vault_usage { + use super::*; + #[doc = "Unit of the usage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[doc = "Usage for vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultUsageList { + #[doc = "The list of usages for the given vault."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl VaultUsageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/recoveryservices/src/package_preview_2022_01/operations.rs b/services/mgmt/recoveryservices/src/package_preview_2022_01/operations.rs new file mode 100644 index 0000000000..39cf125382 --- /dev/null +++ b/services/mgmt/recoveryservices/src/package_preview_2022_01/operations.rs @@ -0,0 +1,1996 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn recovery_services(&self) -> recovery_services::Client { + recovery_services::Client(self.clone()) + } + pub fn registered_identities(&self) -> registered_identities::Client { + registered_identities::Client(self.clone()) + } + pub fn replication_usages(&self) -> replication_usages::Client { + replication_usages::Client(self.clone()) + } + pub fn usages(&self) -> usages::Client { + usages::Client(self.clone()) + } + pub fn vault_certificates(&self) -> vault_certificates::Client { + vault_certificates::Client(self.clone()) + } + pub fn vault_extended_info(&self) -> vault_extended_info::Client { + vault_extended_info::Client(self.clone()) + } + pub fn vaults(&self) -> vaults::Client { + vaults::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + VaultCertificates_Create(#[from] vault_certificates::create::Error), + #[error(transparent)] + RegisteredIdentities_Delete(#[from] registered_identities::delete::Error), + #[error(transparent)] + ReplicationUsages_List(#[from] replication_usages::list::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + RecoveryServices_CheckNameAvailability(#[from] recovery_services::check_name_availability::Error), + #[error(transparent)] + RecoveryServices_Capabilities(#[from] recovery_services::capabilities::Error), + #[error(transparent)] + Vaults_ListBySubscriptionId(#[from] vaults::list_by_subscription_id::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Vaults_ListByResourceGroup(#[from] vaults::list_by_resource_group::Error), + #[error(transparent)] + Vaults_Get(#[from] vaults::get::Error), + #[error(transparent)] + Vaults_CreateOrUpdate(#[from] vaults::create_or_update::Error), + #[error(transparent)] + Vaults_Update(#[from] vaults::update::Error), + #[error(transparent)] + Vaults_Delete(#[from] vaults::delete::Error), + #[error(transparent)] + VaultExtendedInfo_Get(#[from] vault_extended_info::get::Error), + #[error(transparent)] + VaultExtendedInfo_CreateOrUpdate(#[from] vault_extended_info::create_or_update::Error), + #[error(transparent)] + VaultExtendedInfo_Update(#[from] vault_extended_info::update::Error), + #[error(transparent)] + GetOperationStatus(#[from] get_operation_status::Error), + #[error(transparent)] + GetOperationResult(#[from] get_operation_result::Error), + #[error(transparent)] + Usages_ListByVaults(#[from] usages::list_by_vaults::Error), +} +pub mod vault_certificates { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + certificate_name: impl Into, + certificate_request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + certificate_name: certificate_name.into(), + certificate_request: certificate_request.into(), + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) certificate_name: String, + pub(crate) certificate_request: models::CertificateRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/certificates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.certificate_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.certificate_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultCertificateResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod registered_identities { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + identity_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + identity_name: identity_name.into(), + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) identity_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/registeredIdentities/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.identity_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_usages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationUsages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the list of private link resources that need to be created for Backup and SiteRecovery"] + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + #[doc = "Returns a specified private link resource that need to be created for Backup and SiteRecovery"] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + private_link_resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + private_link_resource_name: private_link_resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResources = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) private_link_resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.private_link_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_services { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "API to check for resource name availability.\r\nA name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type\r\nor if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago"] + pub fn check_name_availability( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + location: impl Into, + input: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + location: location.into(), + input: input.into(), + } + } + #[doc = "API to get details about capabilities provided by Microsoft.RecoveryServices RP"] + pub fn capabilities( + &self, + subscription_id: impl Into, + location: impl Into, + input: impl Into, + ) -> capabilities::Builder { + capabilities::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + location: location.into(), + input: input.into(), + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) location: String, + pub(crate) input: models::CheckNameAvailabilityParameters, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/locations/{}/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod capabilities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) location: String, + pub(crate) input: models::ResourceCapabilities, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/capabilities", + self.client.endpoint(), + &self.subscription_id, + &self.location + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CapabilitiesResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vaults { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_subscription_id(&self, subscription_id: impl Into) -> list_by_subscription_id::Builder { + list_by_subscription_id::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + vault: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + vault: vault.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_subscription_id { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Created201(models::Vault), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::Vault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) vault: models::PatchVault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.vault).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod vault_extended_info { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + resource_resource_extended_info_details: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + resource_resource_extended_info_details: resource_resource_extended_info_details.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) resource_resource_extended_info_details: models::VaultExtendedInfoResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/extendedInformation/vaultExtendedInfo" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resource_resource_extended_info_details).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultExtendedInfoResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn get_operation_status( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } + pub fn get_operation_result( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + operation_id: impl Into, + ) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + operation_id: operation_id.into(), + } + } +} +pub mod get_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationStatus/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Vault), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/operationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Vault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod usages { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_by_vaults( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vault_name: impl Into, + ) -> list_by_vaults::Builder { + list_by_vaults::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vault_name: vault_name.into(), + } + } + } + pub mod list_by_vaults { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/usages", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-01-31-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicesbackup/Cargo.toml b/services/mgmt/recoveryservicesbackup/Cargo.toml index d700c78563..85ebc20eaf 100644 --- a/services/mgmt/recoveryservicesbackup/Cargo.toml +++ b/services/mgmt/recoveryservicesbackup/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_recoveryservicesbackup" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2022-01", "package-passivestamp-2021-11-15", "package-passivestamp-2018-12-20", "package-2021-10"] +features = ["no-default-tag", "package-2022-02", "package-2022-01", "package-passivestamp-2021-11-15", "package-passivestamp-2018-12-20"] [features] default = ["package-2021-12", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-02" = [] "package-2022-01" = [] "package-2021-12" = [] "package-passivestamp-2021-11-15" = [] diff --git a/services/mgmt/recoveryservicesbackup/README.md b/services/mgmt/recoveryservicesbackup/README.md index 65672cb471..5da9fb9e6e 100644 --- a/services/mgmt/recoveryservicesbackup/README.md +++ b/services/mgmt/recoveryservicesbackup/README.md @@ -10,6 +10,7 @@ The default tag is `package-2021-12`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-02` has 76 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. - `package-2022-01` has 76 operations from 1 API versions: `2022-01-01`. Use crate feature `package-2022-01` to enable. The operations will be in the `package_2022_01` module. - `package-2021-12` has 76 operations from 1 API versions: `2021-12-01`. Use crate feature `package-2021-12` to enable. The operations will be in the `package_2021_12` module. - `package-passivestamp-2021-11-15` has 13 operations from 1 API versions: `2021-11-15`. Use crate feature `package-passivestamp-2021-11-15` to enable. The operations will be in the `package_passivestamp_2021_11_15` module. diff --git a/services/mgmt/recoveryservicesbackup/src/lib.rs b/services/mgmt/recoveryservicesbackup/src/lib.rs index e67e678cf7..fec9a3382e 100644 --- a/services/mgmt/recoveryservicesbackup/src/lib.rs +++ b/services/mgmt/recoveryservicesbackup/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-02")] +pub mod package_2022_02; +#[cfg(all(feature = "package-2022-02", not(feature = "no-default-tag")))] +pub use package_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2022-01")] pub mod package_2022_01; #[cfg(all(feature = "package-2022-01", not(feature = "no-default-tag")))] diff --git a/services/mgmt/recoveryservicesbackup/src/package_2022_02/mod.rs b/services/mgmt/recoveryservicesbackup/src/package_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/recoveryservicesbackup/src/package_2022_02/models.rs b/services/mgmt/recoveryservicesbackup/src/package_2022_02/models.rs new file mode 100644 index 0000000000..81ff6e210b --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2022_02/models.rs @@ -0,0 +1,7544 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Azure backup goal feature specific request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupGoalFeatureSupportRequest { + #[serde(flatten)] + pub feature_support_request: FeatureSupportRequest, +} +impl AzureBackupGoalFeatureSupportRequest { + pub fn new(feature_support_request: FeatureSupportRequest) -> Self { + Self { feature_support_request } + } +} +#[doc = "AzureBackupServer (DPMVenus) workload-specific protection container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupServerContainer { + #[serde(flatten)] + pub dpm_container: DpmContainer, +} +impl AzureBackupServerContainer { + pub fn new(dpm_container: DpmContainer) -> Self { + Self { dpm_container } + } +} +#[doc = "Backup engine type when Azure Backup Server is used to manage the backups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBackupServerEngine { + #[serde(flatten)] + pub backup_engine_base: BackupEngineBase, +} +impl AzureBackupServerEngine { + pub fn new(backup_engine_base: BackupEngineBase) -> Self { + Self { backup_engine_base } + } +} +#[doc = "AzureFileShare workload-specific backup request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[doc = "Backup copy will expire after the time specified (UTC)."] + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +impl AzureFileShareBackupRequest { + pub fn new(backup_request: BackupRequest) -> Self { + Self { + backup_request, + recovery_point_expiry_time_in_utc: None, + } + } +} +#[doc = "Protectable item for Azure Fileshare workloads."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[doc = "Full Fabric ID of container to which this protectable item belongs. For example, ARM ID."] + #[serde(rename = "parentContainerFabricId", default, skip_serializing_if = "Option::is_none")] + pub parent_container_fabric_id: Option, + #[doc = "Friendly name of container to which this protectable item belongs."] + #[serde(rename = "parentContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub parent_container_friendly_name: Option, + #[doc = "File Share type XSync or XSMB."] + #[serde(rename = "azureFileShareType", default, skip_serializing_if = "Option::is_none")] + pub azure_file_share_type: Option, +} +impl AzureFileShareProtectableItem { + pub fn new(workload_protectable_item: WorkloadProtectableItem) -> Self { + Self { + workload_protectable_item, + parent_container_fabric_id: None, + parent_container_friendly_name: None, + azure_file_share_type: None, + } + } +} +pub mod azure_file_share_protectable_item { + use super::*; + #[doc = "File Share type XSync or XSMB."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AzureFileShareType { + Invalid, + #[serde(rename = "XSMB")] + Xsmb, + XSync, + } +} +#[doc = "AzureStorage backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[doc = "Type of workload for the backup management"] + #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] + pub work_load_type: Option, + #[doc = "Base class for backup schedule."] + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[doc = "Base class for retention policy."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[doc = "TimeZone optional input as string. For example: TimeZone = \"Pacific Standard Time\"."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl AzureFileShareProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + work_load_type: None, + schedule_policy: None, + retention_policy: None, + time_zone: None, + } + } +} +pub mod azure_file_share_protection_policy { + use super::*; + #[doc = "Type of workload for the backup management"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkLoadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Update snapshot Uri with the correct friendly Name of the source Azure file share."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareProvisionIlrRequest { + #[serde(flatten)] + pub ilr_request: IlrRequest, + #[doc = "Recovery point ID."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "Source Storage account ARM Id"] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, +} +impl AzureFileShareProvisionIlrRequest { + pub fn new(ilr_request: IlrRequest) -> Self { + Self { + ilr_request, + recovery_point_id: None, + source_resource_id: None, + } + } +} +#[doc = "Azure File Share workload specific backup copy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[doc = "Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "Time at which this backup copy was created."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[doc = "Contains Url to the snapshot of fileshare, if applicable"] + #[serde(rename = "fileShareSnapshotUri", default, skip_serializing_if = "Option::is_none")] + pub file_share_snapshot_uri: Option, + #[doc = "Contains recovery point size"] + #[serde(rename = "recoveryPointSizeInGB", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_size_in_gb: Option, +} +impl AzureFileShareRecoveryPoint { + pub fn new(recovery_point: RecoveryPoint) -> Self { + Self { + recovery_point, + recovery_point_type: None, + recovery_point_time: None, + file_share_snapshot_uri: None, + recovery_point_size_in_gb: None, + } + } +} +#[doc = "AzureFileShare Restore Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileShareRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[doc = "Type of this recovery."] + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[doc = "Source storage account ARM Id"] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Options to resolve copy conflicts."] + #[serde(rename = "copyOptions", default, skip_serializing_if = "Option::is_none")] + pub copy_options: Option, + #[doc = "Restore Type (FullShareRestore or ItemLevelRestore)"] + #[serde(rename = "restoreRequestType", default, skip_serializing_if = "Option::is_none")] + pub restore_request_type: Option, + #[doc = "List of Source Files/Folders(which need to recover) and TargetFolderPath details"] + #[serde(rename = "restoreFileSpecs", default, skip_serializing_if = "Vec::is_empty")] + pub restore_file_specs: Vec, + #[doc = "Target Azure File Share Info."] + #[serde(rename = "targetDetails", default, skip_serializing_if = "Option::is_none")] + pub target_details: Option, +} +impl AzureFileShareRestoreRequest { + pub fn new(restore_request: RestoreRequest) -> Self { + Self { + restore_request, + recovery_type: None, + source_resource_id: None, + copy_options: None, + restore_request_type: None, + restore_file_specs: Vec::new(), + target_details: None, + } + } +} +pub mod azure_file_share_restore_request { + use super::*; + #[doc = "Type of this recovery."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[doc = "Options to resolve copy conflicts."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CopyOptions { + Invalid, + CreateCopy, + Skip, + Overwrite, + FailOnConflict, + } + #[doc = "Restore Type (FullShareRestore or ItemLevelRestore)"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestoreRequestType { + Invalid, + FullShareRestore, + ItemLevelRestore, + } +} +#[doc = "Azure File Share workload-specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileshareProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of the fileshare represented by this backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Backup status of this backup item."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Backup state of this backup item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Last backup operation status. Possible values: Healthy, Unhealthy."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[doc = "Timestamp of the last backup operation on this backup item."] + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[doc = "Health details of different KPIs"] + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[doc = "Additional information about Azure File Share backup item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl AzureFileshareProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + protection_status: None, + protection_state: None, + last_backup_status: None, + last_backup_time: None, + kpis_healths: None, + extended_info: None, + } + } +} +pub mod azure_fileshare_protected_item { + use super::*; + #[doc = "Backup state of this backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[doc = "Additional information about Azure File Share backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileshareProtectedItemExtendedInfo { + #[doc = "The oldest backup copy available for this item in the service."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "Number of available backup copies associated with this backup item."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[doc = "Indicates consistency of policy object and policy applied to this backup item."] + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[doc = "Indicates the state of this resource. Possible values are from enum ResourceState {Invalid, Active, SoftDeleted, Deleted}"] + #[serde(rename = "resourceState", default, skip_serializing_if = "Option::is_none")] + pub resource_state: Option, + #[doc = "The resource state sync time for this backup item."] + #[serde(rename = "resourceStateSyncTime", default, skip_serializing_if = "Option::is_none")] + pub resource_state_sync_time: Option, +} +impl AzureFileshareProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IaaS VM workload-specific backup item representing a classic virtual machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmContainer { + #[serde(flatten)] + pub iaa_svm_container: IaaSvmContainer, +} +impl AzureIaaSClassicComputeVmContainer { + pub fn new(iaa_svm_container: IaaSvmContainer) -> Self { + Self { iaa_svm_container } + } +} +#[doc = "IaaS VM workload-specific backup item representing the Classic Compute VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectableItem { + #[serde(flatten)] + pub iaa_svm_protectable_item: IaaSvmProtectableItem, +} +impl AzureIaaSClassicComputeVmProtectableItem { + pub fn new(iaa_svm_protectable_item: IaaSvmProtectableItem) -> Self { + Self { iaa_svm_protectable_item } + } +} +#[doc = "IaaS VM workload-specific backup item representing the Classic Compute VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSClassicComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +impl AzureIaaSClassicComputeVmProtectedItem { + pub fn new(azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem) -> Self { + Self { + azure_iaa_svm_protected_item, + } + } +} +#[doc = "IaaS VM workload-specific backup item representing an Azure Resource Manager virtual machine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmContainer { + #[serde(flatten)] + pub iaa_svm_container: IaaSvmContainer, +} +impl AzureIaaSComputeVmContainer { + pub fn new(iaa_svm_container: IaaSvmContainer) -> Self { + Self { iaa_svm_container } + } +} +#[doc = "IaaS VM workload-specific backup item representing the Azure Resource Manager VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectableItem { + #[serde(flatten)] + pub iaa_svm_protectable_item: IaaSvmProtectableItem, +} +impl AzureIaaSComputeVmProtectableItem { + pub fn new(iaa_svm_protectable_item: IaaSvmProtectableItem) -> Self { + Self { iaa_svm_protectable_item } + } +} +#[doc = "IaaS VM workload-specific backup item representing the Azure Resource Manager VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSComputeVmProtectedItem { + #[serde(flatten)] + pub azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem, +} +impl AzureIaaSComputeVmProtectedItem { + pub fn new(azure_iaa_svm_protected_item: AzureIaaSvmProtectedItem) -> Self { + Self { + azure_iaa_svm_protected_item, + } + } +} +#[doc = "Azure IaaS VM workload-specific error information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureIaaSvmErrorInfo { + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Title: Typically, the entity that the error pertains to."] + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "List of localized recommendations for above error code."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl AzureIaaSvmErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure IaaS VM workload-specific Health Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureIaaSvmHealthDetails { + #[serde(flatten)] + pub resource_health_details: ResourceHealthDetails, +} +impl AzureIaaSvmHealthDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure IaaS VM workload-specific job object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Time elapsed during the execution of this job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "Gets or sets the state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Error details on execution of this job."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Specifies whether the backup item is a Classic or an Azure Resource Manager VM."] + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[doc = "Azure IaaS VM workload-specific additional information for job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Container name of the entity on which the current job is executing."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Indicated that whether the job is adhoc(true) or scheduled(false)"] + #[serde(rename = "isUserTriggered", default, skip_serializing_if = "Option::is_none")] + pub is_user_triggered: Option, +} +impl AzureIaaSvmJob { + pub fn new(job: Job) -> Self { + Self { + job, + duration: None, + actions_info: Vec::new(), + error_details: Vec::new(), + virtual_machine_version: None, + extended_info: None, + container_name: None, + is_user_triggered: None, + } + } +} +#[doc = "Azure IaaS VM workload-specific additional information for job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureIaaSvmJobExtendedInfo { + #[doc = "List of tasks associated with this job."] + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[doc = "Job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Job internal properties."] + #[serde(rename = "internalPropertyBag", default, skip_serializing_if = "Option::is_none")] + pub internal_property_bag: Option, + #[doc = "Indicates progress of the job. Null if it has not started or completed."] + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[doc = "Time remaining for execution of this job."] + #[serde(rename = "estimatedRemainingDuration", default, skip_serializing_if = "Option::is_none")] + pub estimated_remaining_duration: Option, + #[doc = "Non localized error message on job execution."] + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +impl AzureIaaSvmJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure IaaS VM workload-specific job task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureIaaSvmJobTaskDetails { + #[doc = "The task display name."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The instanceId."] + #[serde(rename = "instanceId", default, skip_serializing_if = "Option::is_none")] + pub instance_id: Option, + #[doc = "Time elapsed for task."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "The status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Progress of the task."] + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, + #[doc = "Details about execution of the task.\r\neg: number of bytes transferred etc"] + #[serde(rename = "taskExecutionDetails", default, skip_serializing_if = "Option::is_none")] + pub task_execution_details: Option, +} +impl AzureIaaSvmJobTaskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure IaaS VM workload-specific job object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmJobV2 { + #[serde(flatten)] + pub job: Job, + #[doc = "Gets or sets the state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Container name of the entity on which the current job is executing."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Time elapsed during the execution of this job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "Error details on execution of this job."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Specifies whether the backup item is a Classic or an Azure Resource Manager VM."] + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[doc = "Azure IaaS VM workload-specific additional information for job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl AzureIaaSvmJobV2 { + pub fn new(job: Job) -> Self { + Self { + job, + actions_info: Vec::new(), + container_name: None, + duration: None, + error_details: Vec::new(), + virtual_machine_version: None, + extended_info: None, + } + } +} +#[doc = "IaaS VM workload-specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of the VM represented by this backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Fully qualified ARM ID of the virtual machine represented by this item."] + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[doc = "Backup status of this backup item."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Backup state of this backup item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Health status of protected item."] + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[doc = "Health details on this backup item."] + #[serde(rename = "healthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_details: Vec, + #[doc = "Health details of different KPIs"] + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, + #[doc = "Last backup operation status."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[doc = "Timestamp of the last backup operation on this backup item."] + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[doc = "Data ID of the protected item."] + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[doc = "Additional information on Azure IaaS VM specific backup item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Extended Properties for Azure IaasVM Backup."] + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, +} +impl AzureIaaSvmProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + virtual_machine_id: None, + protection_status: None, + protection_state: None, + health_status: None, + health_details: Vec::new(), + kpis_healths: None, + last_backup_status: None, + last_backup_time: None, + protected_item_data_id: None, + extended_info: None, + extended_properties: None, + } + } +} +pub mod azure_iaa_svm_protected_item { + use super::*; + #[doc = "Backup state of this backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[doc = "Health status of protected item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthStatus { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } +} +#[doc = "Additional information on Azure IaaS VM specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureIaaSvmProtectedItemExtendedInfo { + #[doc = "The oldest backup copy available for this backup item."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "Number of backup copies available for this backup item."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[doc = "Specifies if backup policy associated with the backup item is inconsistent."] + #[serde(rename = "policyInconsistent", default, skip_serializing_if = "Option::is_none")] + pub policy_inconsistent: Option, +} +impl AzureIaaSvmProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IaaS VM workload-specific backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureIaaSvmProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[serde(rename = "instantRPDetails", default, skip_serializing_if = "Option::is_none")] + pub instant_rp_details: Option, + #[doc = "Base class for backup schedule."] + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[doc = "Base class for retention policy."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, + #[doc = "Instant RP retention policy range in days"] + #[serde(rename = "instantRpRetentionRangeInDays", default, skip_serializing_if = "Option::is_none")] + pub instant_rp_retention_range_in_days: Option, + #[doc = "TimeZone optional input as string. For example: TimeZone = \"Pacific Standard Time\"."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[serde(rename = "policyType", default, skip_serializing_if = "Option::is_none")] + pub policy_type: Option, +} +impl AzureIaaSvmProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + instant_rp_details: None, + schedule_policy: None, + retention_policy: None, + instant_rp_retention_range_in_days: None, + time_zone: None, + policy_type: None, + } + } +} +pub mod azure_iaa_svm_protection_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PolicyType { + Invalid, + V1, + V2, + } +} +#[doc = "Azure Recovery Services Vault specific protection intent item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureRecoveryServiceVaultProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, +} +impl AzureRecoveryServiceVaultProtectionIntent { + pub fn new(protection_intent: ProtectionIntent) -> Self { + Self { protection_intent } + } +} +#[doc = "IaaS VM specific backup protection intent item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, + #[doc = "Friendly name of the VM represented by this backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +impl AzureResourceProtectionIntent { + pub fn new(protection_intent: ProtectionIntent) -> Self { + Self { + protection_intent, + friendly_name: None, + } + } +} +#[doc = "Container for SQL workloads under SQL Availability Group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlagWorkloadContainerProtectionContainer { + #[serde(flatten)] + pub azure_workload_container: AzureWorkloadContainer, +} +impl AzureSqlagWorkloadContainerProtectionContainer { + pub fn new(azure_workload_container: AzureWorkloadContainer) -> Self { + Self { azure_workload_container } + } +} +#[doc = "Azure Sql workload-specific container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, +} +impl AzureSqlContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { protection_container } + } +} +#[doc = "Azure SQL workload-specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services."] + #[serde(rename = "protectedItemDataId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_id: Option, + #[doc = "Backup state of the backed up item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Additional information on Azure Sql specific protected item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl AzureSqlProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + protected_item_data_id: None, + protection_state: None, + extended_info: None, + } + } +} +pub mod azure_sql_protected_item { + use super::*; + #[doc = "Backup state of the backed up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[doc = "Additional information on Azure Sql specific protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlProtectedItemExtendedInfo { + #[doc = "The oldest backup copy available for this item in the service."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "Number of available backup copies associated with this backup item."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[doc = "State of the backup policy associated with this backup item."] + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, +} +impl AzureSqlProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure SQL workload-specific backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[doc = "Base class for retention policy."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +impl AzureSqlProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + retention_policy: None, + } + } +} +#[doc = "Azure Storage Account workload-specific container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "Fully qualified ARM url."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Storage account version."] + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[doc = "Resource group name of Recovery Services Vault."] + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, + #[doc = "Number of items backed up in this container."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "Whether storage account lock is to be acquired for this container or not."] + #[serde(rename = "acquireStorageAccountLock", default, skip_serializing_if = "Option::is_none")] + pub acquire_storage_account_lock: Option, +} +impl AzureStorageContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + source_resource_id: None, + storage_account_version: None, + resource_group: None, + protected_item_count: None, + acquire_storage_account_lock: None, + } + } +} +pub mod azure_storage_container { + use super::*; + #[doc = "Whether storage account lock is to be acquired for this container or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AcquireStorageAccountLock { + Acquire, + NotAcquire, + } +} +#[doc = "Azure storage specific error information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageErrorInfo { + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "List of localized recommendations for above error code."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl AzureStorageErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure storage specific job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Time elapsed during the execution of this job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "Gets or sets the state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Error details on execution of this job."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Specifies friendly name of the storage account."] + #[serde(rename = "storageAccountName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_name: Option, + #[doc = "Specifies whether the Storage account is a Classic or an Azure Resource Manager Storage account."] + #[serde(rename = "storageAccountVersion", default, skip_serializing_if = "Option::is_none")] + pub storage_account_version: Option, + #[doc = "Azure Storage workload-specific additional information for job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Indicated that whether the job is adhoc(true) or scheduled(false)"] + #[serde(rename = "isUserTriggered", default, skip_serializing_if = "Option::is_none")] + pub is_user_triggered: Option, +} +impl AzureStorageJob { + pub fn new(job: Job) -> Self { + Self { + job, + duration: None, + actions_info: Vec::new(), + error_details: Vec::new(), + storage_account_name: None, + storage_account_version: None, + extended_info: None, + is_user_triggered: None, + } + } +} +#[doc = "Azure Storage workload-specific additional information for job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageJobExtendedInfo { + #[doc = "List of tasks for this job"] + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[doc = "Job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Non localized error message on job execution."] + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +impl AzureStorageJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure storage workload specific job task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageJobTaskDetails { + #[doc = "The task display name."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AzureStorageJobTaskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Storage-specific protectable containers"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageProtectableContainer { + #[serde(flatten)] + pub protectable_container: ProtectableContainer, +} +impl AzureStorageProtectableContainer { + pub fn new(protectable_container: ProtectableContainer) -> Self { + Self { protectable_container } + } +} +#[doc = "Azure workload-specific container"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmAppContainerProtectableContainer { + #[serde(flatten)] + pub protectable_container: ProtectableContainer, +} +impl AzureVmAppContainerProtectableContainer { + pub fn new(protectable_container: ProtectableContainer) -> Self { + Self { protectable_container } + } +} +#[doc = "Container for SQL workloads under Azure Virtual Machines."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmAppContainerProtectionContainer { + #[serde(flatten)] + pub azure_workload_container: AzureWorkloadContainer, +} +impl AzureVmAppContainerProtectionContainer { + pub fn new(azure_workload_container: AzureWorkloadContainer) -> Self { + Self { azure_workload_container } + } +} +#[doc = "AzureResource(IaaS VM) Specific feature support request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmResourceFeatureSupportRequest { + #[serde(flatten)] + pub feature_support_request: FeatureSupportRequest, + #[doc = "Size of the resource: VM size(A/D series etc) in case of IaasVM"] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "SKUs (Premium/Managed etc) in case of IaasVM"] + #[serde(rename = "vmSku", default, skip_serializing_if = "Option::is_none")] + pub vm_sku: Option, +} +impl AzureVmResourceFeatureSupportRequest { + pub fn new(feature_support_request: FeatureSupportRequest) -> Self { + Self { + feature_support_request, + vm_size: None, + vm_sku: None, + } + } +} +#[doc = "Response for feature support requests for Azure IaasVm"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureVmResourceFeatureSupportResponse { + #[doc = "Support status of feature"] + #[serde(rename = "supportStatus", default, skip_serializing_if = "Option::is_none")] + pub support_status: Option, +} +impl AzureVmResourceFeatureSupportResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod azure_vm_resource_feature_support_response { + use super::*; + #[doc = "Support status of feature"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SupportStatus { + Invalid, + Supported, + #[serde(rename = "DefaultOFF")] + DefaultOff, + #[serde(rename = "DefaultON")] + DefaultOn, + NotSupported, + } +} +#[doc = "Azure VM workload-specific workload item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadItem { + #[serde(flatten)] + pub workload_item: WorkloadItem, + #[doc = "Name for instance or AG"] + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[doc = "Host/Cluster Name for instance or AG"] + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[doc = "Indicates if workload item is auto-protectable"] + #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protectable: Option, + #[doc = "For instance or AG, indicates number of DB's present"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subinquireditemcount: Option, + #[doc = "For instance or AG, indicates number of DB's to be protected"] + #[serde(rename = "subWorkloadItemCount", default, skip_serializing_if = "Option::is_none")] + pub sub_workload_item_count: Option, +} +impl AzureVmWorkloadItem { + pub fn new(workload_item: WorkloadItem) -> Self { + Self { + workload_item, + parent_name: None, + server_name: None, + is_auto_protectable: None, + subinquireditemcount: None, + sub_workload_item_count: None, + } + } +} +#[doc = "Azure VM workload-specific protectable item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[doc = "Name for instance or AG"] + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[doc = "Parent Unique Name is added to provide the service formatted URI Name of the Parent\r\nOnly Applicable for data bases where the parent would be either Instance or a SQL AG."] + #[serde(rename = "parentUniqueName", default, skip_serializing_if = "Option::is_none")] + pub parent_unique_name: Option, + #[doc = "Host/Cluster Name for instance or AG"] + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[doc = "Indicates if protectable item is auto-protectable"] + #[serde(rename = "isAutoProtectable", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protectable: Option, + #[doc = "Indicates if protectable item is auto-protected"] + #[serde(rename = "isAutoProtected", default, skip_serializing_if = "Option::is_none")] + pub is_auto_protected: Option, + #[doc = "For instance or AG, indicates number of DB's present"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subinquireditemcount: Option, + #[doc = "For instance or AG, indicates number of DB's to be protected"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subprotectableitemcount: Option, + #[doc = "Pre-backup validation for Azure VM Workload provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prebackupvalidation: Option, +} +impl AzureVmWorkloadProtectableItem { + pub fn new(workload_protectable_item: WorkloadProtectableItem) -> Self { + Self { + workload_protectable_item, + parent_name: None, + parent_unique_name: None, + server_name: None, + is_auto_protectable: None, + is_auto_protected: None, + subinquireditemcount: None, + subprotectableitemcount: None, + prebackupvalidation: None, + } + } +} +#[doc = "Azure VM workload-specific protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of the DB represented by this backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Host/Cluster Name for instance or AG"] + #[serde(rename = "serverName", default, skip_serializing_if = "Option::is_none")] + pub server_name: Option, + #[doc = "Parent name of the DB such as Instance or Availability Group."] + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[doc = "Parent type of protected item, example: for a DB, standalone server or distributed"] + #[serde(rename = "parentType", default, skip_serializing_if = "Option::is_none")] + pub parent_type: Option, + #[doc = "Backup status of this backup item."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Backup state of this backup item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Last backup operation status. Possible values: Healthy, Unhealthy."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[doc = "Timestamp of the last backup operation on this backup item."] + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[doc = "Error Detail class which encapsulates Code, Message and Recommendations."] + #[serde(rename = "lastBackupErrorDetail", default, skip_serializing_if = "Option::is_none")] + pub last_backup_error_detail: Option, + #[doc = "Data ID of the protected item."] + #[serde(rename = "protectedItemDataSourceId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_data_source_id: Option, + #[doc = "Health status of the backup item, evaluated based on last heartbeat received"] + #[serde(rename = "protectedItemHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub protected_item_health_status: Option, + #[doc = "Additional information on Azure Workload for SQL specific backup item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Health details of different KPIs"] + #[serde(rename = "kpisHealths", default, skip_serializing_if = "Option::is_none")] + pub kpis_healths: Option, +} +impl AzureVmWorkloadProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + server_name: None, + parent_name: None, + parent_type: None, + protection_status: None, + protection_state: None, + last_backup_status: None, + last_backup_time: None, + last_backup_error_detail: None, + protected_item_data_source_id: None, + protected_item_health_status: None, + extended_info: None, + kpis_healths: None, + } + } +} +pub mod azure_vm_workload_protected_item { + use super::*; + #[doc = "Backup state of this backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } + #[doc = "Last backup operation status. Possible values: Healthy, Unhealthy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastBackupStatus { + Invalid, + Healthy, + Unhealthy, + #[serde(rename = "IRPending")] + IrPending, + } + #[doc = "Health status of the backup item, evaluated based on last heartbeat received"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectedItemHealthStatus { + Invalid, + Healthy, + Unhealthy, + NotReachable, + #[serde(rename = "IRPending")] + IrPending, + } +} +#[doc = "Additional information on Azure Workload for SQL specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureVmWorkloadProtectedItemExtendedInfo { + #[doc = "The oldest backup copy available for this backup item."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "Number of backup copies available for this backup item."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[doc = "Indicates consistency of policy object and policy applied to this backup item."] + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[doc = "Indicates consistency of policy object and policy applied to this backup item."] + #[serde(rename = "recoveryModel", default, skip_serializing_if = "Option::is_none")] + pub recovery_model: Option, +} +impl AzureVmWorkloadProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure VM (Mercury) workload-specific backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[doc = "Type of workload for the backup management"] + #[serde(rename = "workLoadType", default, skip_serializing_if = "Option::is_none")] + pub work_load_type: Option, + #[doc = "Common settings field for backup management"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[doc = "List of sub-protection policies which includes schedule and retention"] + #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] + pub sub_protection_policy: Vec, + #[doc = "Fix the policy inconsistency"] + #[serde(rename = "makePolicyConsistent", default, skip_serializing_if = "Option::is_none")] + pub make_policy_consistent: Option, +} +impl AzureVmWorkloadProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + work_load_type: None, + settings: None, + sub_protection_policy: Vec::new(), + make_policy_consistent: None, + } + } +} +pub mod azure_vm_workload_protection_policy { + use super::*; + #[doc = "Type of workload for the backup management"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkLoadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Azure VM workload-specific protected item representing SAP ASE Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +impl AzureVmWorkloadSapAseDatabaseProtectedItem { + pub fn new(azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem) -> Self { + Self { + azure_vm_workload_protected_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SAP ASE Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +impl AzureVmWorkloadSapAseDatabaseWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { azure_vm_workload_item } + } +} +#[doc = "Azure VM workload-specific protectable item representing SAP ASE System."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseSystemProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSapAseSystemProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SAP ASE System."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapAseSystemWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +impl AzureVmWorkloadSapAseSystemWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { azure_vm_workload_item } + } +} +#[doc = "Azure VM workload-specific protectable item representing SAP HANA Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSapHanaDatabaseProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific protected item representing SAP HANA Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +impl AzureVmWorkloadSapHanaDatabaseProtectedItem { + pub fn new(azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem) -> Self { + Self { + azure_vm_workload_protected_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SAP HANA Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +impl AzureVmWorkloadSapHanaDatabaseWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { azure_vm_workload_item } + } +} +#[doc = "Azure VM workload-specific protectable item representing SAP HANA System."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaSystemProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSapHanaSystemProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SAP HANA System."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSapHanaSystemWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +impl AzureVmWorkloadSapHanaSystemWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { azure_vm_workload_item } + } +} +#[doc = "Azure VM workload-specific protectable item representing SQL Availability Group."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlAvailabilityGroupProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSqlAvailabilityGroupProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific protectable item representing SQL Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSqlDatabaseProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific protected item representing SQL Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseProtectedItem { + #[serde(flatten)] + pub azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem, +} +impl AzureVmWorkloadSqlDatabaseProtectedItem { + pub fn new(azure_vm_workload_protected_item: AzureVmWorkloadProtectedItem) -> Self { + Self { + azure_vm_workload_protected_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SQL Database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlDatabaseWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, +} +impl AzureVmWorkloadSqlDatabaseWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { azure_vm_workload_item } + } +} +#[doc = "Azure VM workload-specific protectable item representing SQL Instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlInstanceProtectableItem { + #[serde(flatten)] + pub azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem, +} +impl AzureVmWorkloadSqlInstanceProtectableItem { + pub fn new(azure_vm_workload_protectable_item: AzureVmWorkloadProtectableItem) -> Self { + Self { + azure_vm_workload_protectable_item, + } + } +} +#[doc = "Azure VM workload-specific workload item representing SQL Instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureVmWorkloadSqlInstanceWorkloadItem { + #[serde(flatten)] + pub azure_vm_workload_item: AzureVmWorkloadItem, + #[doc = "Data Directory Paths for default directories"] + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +impl AzureVmWorkloadSqlInstanceWorkloadItem { + pub fn new(azure_vm_workload_item: AzureVmWorkloadItem) -> Self { + Self { + azure_vm_workload_item, + data_directory_paths: Vec::new(), + } + } +} +#[doc = "Azure Recovery Services Vault specific protection intent item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadAutoProtectionIntent { + #[serde(flatten)] + pub azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent, +} +impl AzureWorkloadAutoProtectionIntent { + pub fn new(azure_recovery_service_vault_protection_intent: AzureRecoveryServiceVaultProtectionIntent) -> Self { + Self { + azure_recovery_service_vault_protection_intent, + } + } +} +#[doc = "AzureWorkload workload-specific backup request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[doc = "Type of backup, viz. Full, Differential, Log or CopyOnlyFull"] + #[serde(rename = "backupType", default, skip_serializing_if = "Option::is_none")] + pub backup_type: Option, + #[doc = "Bool for Compression setting"] + #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] + pub enable_compression: Option, + #[doc = "Backup copy will expire after the time specified (UTC)."] + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +impl AzureWorkloadBackupRequest { + pub fn new(backup_request: BackupRequest) -> Self { + Self { + backup_request, + backup_type: None, + enable_compression: None, + recovery_point_expiry_time_in_utc: None, + } + } +} +pub mod azure_workload_backup_request { + use super::*; + #[doc = "Type of backup, viz. Full, Differential, Log or CopyOnlyFull"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupType { + Invalid, + Full, + Differential, + Log, + CopyOnlyFull, + Incremental, + } +} +#[doc = "Container for the workloads running inside Azure Compute or Classic Compute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "ARM ID of the virtual machine represented by this Azure Workload Container"] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Time stamp when this container was updated."] + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[doc = "Extended information of the container."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Workload type for which registration was sent."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Re-Do Operation"] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, +} +impl AzureWorkloadContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + source_resource_id: None, + last_updated_time: None, + extended_info: None, + workload_type: None, + operation_type: None, + } + } +} +pub mod azure_workload_container { + use super::*; + #[doc = "Workload type for which registration was sent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[doc = "Re-Do Operation"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OperationType { + Invalid, + Register, + Reregister, + } +} +#[doc = "Azure workload specific protection intent item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadContainerAutoProtectionIntent { + #[serde(flatten)] + pub protection_intent: ProtectionIntent, +} +impl AzureWorkloadContainerAutoProtectionIntent { + pub fn new(protection_intent: ProtectionIntent) -> Self { + Self { protection_intent } + } +} +#[doc = "Extended information of the container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWorkloadContainerExtendedInfo { + #[doc = "Host Os Name in case of Stand Alone and Cluster Name in case of distributed container."] + #[serde(rename = "hostServerName", default, skip_serializing_if = "Option::is_none")] + pub host_server_name: Option, + #[doc = "Details about inquired protectable items under a given container."] + #[serde(rename = "inquiryInfo", default, skip_serializing_if = "Option::is_none")] + pub inquiry_info: Option, + #[doc = "List of the nodes in case of distributed container."] + #[serde(rename = "nodesList", default, skip_serializing_if = "Vec::is_empty")] + pub nodes_list: Vec, +} +impl AzureWorkloadContainerExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure storage specific error information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWorkloadErrorInfo { + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "Title: Typically, the entity that the error pertains to."] + #[serde(rename = "errorTitle", default, skip_serializing_if = "Option::is_none")] + pub error_title: Option, + #[doc = "List of localized recommendations for above error code."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, + #[doc = "Additional details for above error code."] + #[serde(rename = "additionalDetails", default, skip_serializing_if = "Option::is_none")] + pub additional_details: Option, +} +impl AzureWorkloadErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure storage specific job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Workload type of the job"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Time elapsed during the execution of this job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "Gets or sets the state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Error details on execution of this job."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Azure VM workload-specific additional information for job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl AzureWorkloadJob { + pub fn new(job: Job) -> Self { + Self { + job, + workload_type: None, + duration: None, + actions_info: Vec::new(), + error_details: Vec::new(), + extended_info: None, + } + } +} +#[doc = "Azure VM workload-specific additional information for job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWorkloadJobExtendedInfo { + #[doc = "List of tasks for this job"] + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[doc = "Job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Non localized error message on job execution."] + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +impl AzureWorkloadJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure VM workload specific job task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWorkloadJobTaskDetails { + #[doc = "The task display name."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AzureWorkloadJobTaskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery point specific to PointInTime"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[doc = "List of log ranges"] + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +impl AzureWorkloadPointInTimeRecoveryPoint { + pub fn new(azure_workload_recovery_point: AzureWorkloadRecoveryPoint) -> Self { + Self { + azure_workload_recovery_point, + time_ranges: Vec::new(), + } + } +} +#[doc = "AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[doc = "PointInTime value"] + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +impl AzureWorkloadPointInTimeRestoreRequest { + pub fn new(azure_workload_restore_request: AzureWorkloadRestoreRequest) -> Self { + Self { + azure_workload_restore_request, + point_in_time: None, + } + } +} +#[doc = "Workload specific recovery point, specifically encapsulates full/diff recovery point"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[doc = "UTC time at which recovery point was created"] + #[serde(rename = "recoveryPointTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time_in_utc: Option, + #[doc = "Type of restore point"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Recovery point tier information."] + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[doc = "Eligibility of RP to be moved to another tier"] + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +impl AzureWorkloadRecoveryPoint { + pub fn new(recovery_point: RecoveryPoint) -> Self { + Self { + recovery_point, + recovery_point_time_in_utc: None, + type_: None, + recovery_point_tier_details: Vec::new(), + recovery_point_move_readiness_info: None, + } + } +} +pub mod azure_workload_recovery_point { + use super::*; + #[doc = "Type of restore point"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Full, + Log, + Differential, + Incremental, + } +} +#[doc = "AzureWorkload-specific restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[doc = "Type of this recovery."] + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[doc = "Fully qualified ARM ID of the VM on which workload that was running is being recovered."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "Workload specific property bag."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Details about target workload during restore operation."] + #[serde(rename = "targetInfo", default, skip_serializing_if = "Option::is_none")] + pub target_info: Option, + #[doc = "Defines whether the current recovery mode is file restore or database restore"] + #[serde(rename = "recoveryMode", default, skip_serializing_if = "Option::is_none")] + pub recovery_mode: Option, + #[doc = "This is the complete ARM Id of the target VM\r\nFor e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}"] + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, +} +impl AzureWorkloadRestoreRequest { + pub fn new(restore_request: RestoreRequest) -> Self { + Self { + restore_request, + recovery_type: None, + source_resource_id: None, + property_bag: None, + target_info: None, + recovery_mode: None, + target_virtual_machine_id: None, + } + } +} +pub mod azure_workload_restore_request { + use super::*; + #[doc = "Type of this recovery."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } + #[doc = "Defines whether the current recovery mode is file restore or database restore"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryMode { + Invalid, + FileRecovery, + WorkloadRecovery, + } +} +#[doc = "Recovery point specific to PointInTime in SAPHana"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint, +} +impl AzureWorkloadSapHanaPointInTimeRecoveryPoint { + pub fn new(azure_workload_point_in_time_recovery_point: AzureWorkloadPointInTimeRecoveryPoint) -> Self { + Self { + azure_workload_point_in_time_recovery_point, + } + } +} +#[doc = "AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[doc = "PointInTime value"] + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +impl AzureWorkloadSapHanaPointInTimeRestoreRequest { + pub fn new(azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest) -> Self { + Self { + azure_workload_sap_hana_restore_request, + point_in_time: None, + } + } +} +#[doc = "AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_point_in_time_restore_request: AzureWorkloadSapHanaPointInTimeRestoreRequest, + #[doc = "RP Rehydration Info"] + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +impl AzureWorkloadSapHanaPointInTimeRestoreWithRehydrateRequest { + pub fn new(azure_workload_sap_hana_point_in_time_restore_request: AzureWorkloadSapHanaPointInTimeRestoreRequest) -> Self { + Self { + azure_workload_sap_hana_point_in_time_restore_request, + recovery_point_rehydration_info: None, + } + } +} +#[doc = "SAPHana specific recoverypoint, specifically encapsulates full/diff recoverypoints"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, +} +impl AzureWorkloadSapHanaRecoveryPoint { + pub fn new(azure_workload_recovery_point: AzureWorkloadRecoveryPoint) -> Self { + Self { + azure_workload_recovery_point, + } + } +} +#[doc = "AzureWorkload SAP Hana-specific restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, +} +impl AzureWorkloadSapHanaRestoreRequest { + pub fn new(azure_workload_restore_request: AzureWorkloadRestoreRequest) -> Self { + Self { + azure_workload_restore_request, + } + } +} +#[doc = "AzureWorkload SAP Hana-specific restore with integrated rehydration of recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSapHanaRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest, + #[doc = "RP Rehydration Info"] + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +impl AzureWorkloadSapHanaRestoreWithRehydrateRequest { + pub fn new(azure_workload_sap_hana_restore_request: AzureWorkloadSapHanaRestoreRequest) -> Self { + Self { + azure_workload_sap_hana_restore_request, + recovery_point_rehydration_info: None, + } + } +} +#[doc = "Azure Workload SQL Auto Protection intent item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlAutoProtectionIntent { + #[serde(flatten)] + pub azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent, + #[doc = "Workload item type of the item for which intent is to be set"] + #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] + pub workload_item_type: Option, +} +impl AzureWorkloadSqlAutoProtectionIntent { + pub fn new(azure_workload_auto_protection_intent: AzureWorkloadAutoProtectionIntent) -> Self { + Self { + azure_workload_auto_protection_intent, + workload_item_type: None, + } + } +} +pub mod azure_workload_sql_auto_protection_intent { + use super::*; + #[doc = "Workload item type of the item for which intent is to be set"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + #[serde(rename = "SAPHanaSystem")] + SapHanaSystem, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseSystem")] + SapAseSystem, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Recovery point specific to PointInTime"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRecoveryPoint { + #[serde(flatten)] + pub azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint, + #[doc = "List of log ranges"] + #[serde(rename = "timeRanges", default, skip_serializing_if = "Vec::is_empty")] + pub time_ranges: Vec, +} +impl AzureWorkloadSqlPointInTimeRecoveryPoint { + pub fn new(azure_workload_sql_recovery_point: AzureWorkloadSqlRecoveryPoint) -> Self { + Self { + azure_workload_sql_recovery_point, + time_ranges: Vec::new(), + } + } +} +#[doc = "AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[doc = "PointInTime value"] + #[serde(rename = "pointInTime", default, skip_serializing_if = "Option::is_none")] + pub point_in_time: Option, +} +impl AzureWorkloadSqlPointInTimeRestoreRequest { + pub fn new(azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest) -> Self { + Self { + azure_workload_sql_restore_request, + point_in_time: None, + } + } +} +#[doc = "AzureWorkload SQL-specific restore with integrated rehydration of recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sql_point_in_time_restore_request: AzureWorkloadSqlPointInTimeRestoreRequest, + #[doc = "RP Rehydration Info"] + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +impl AzureWorkloadSqlPointInTimeRestoreWithRehydrateRequest { + pub fn new(azure_workload_sql_point_in_time_restore_request: AzureWorkloadSqlPointInTimeRestoreRequest) -> Self { + Self { + azure_workload_sql_point_in_time_restore_request, + recovery_point_rehydration_info: None, + } + } +} +#[doc = "SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with extended info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRecoveryPoint { + #[serde(flatten)] + pub azure_workload_recovery_point: AzureWorkloadRecoveryPoint, + #[doc = "Extended info class details"] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl AzureWorkloadSqlRecoveryPoint { + pub fn new(azure_workload_recovery_point: AzureWorkloadRecoveryPoint) -> Self { + Self { + azure_workload_recovery_point, + extended_info: None, + } + } +} +#[doc = "Extended info class details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureWorkloadSqlRecoveryPointExtendedInfo { + #[doc = "UTC time at which data directory info was captured"] + #[serde(rename = "dataDirectoryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub data_directory_time_in_utc: Option, + #[doc = "List of data directory paths during restore operation."] + #[serde(rename = "dataDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub data_directory_paths: Vec, +} +impl AzureWorkloadSqlRecoveryPointExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureWorkload SQL -specific restore. Specifically for full/diff restore"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreRequest { + #[serde(flatten)] + pub azure_workload_restore_request: AzureWorkloadRestoreRequest, + #[doc = "Default option set to true. If this is set to false, alternate data directory must be provided"] + #[serde(rename = "shouldUseAlternateTargetLocation", default, skip_serializing_if = "Option::is_none")] + pub should_use_alternate_target_location: Option, + #[doc = "SQL specific property where user can chose to set no-recovery when restore operation is tried"] + #[serde(rename = "isNonRecoverable", default, skip_serializing_if = "Option::is_none")] + pub is_non_recoverable: Option, + #[doc = "Data directory details"] + #[serde(rename = "alternateDirectoryPaths", default, skip_serializing_if = "Vec::is_empty")] + pub alternate_directory_paths: Vec, +} +impl AzureWorkloadSqlRestoreRequest { + pub fn new(azure_workload_restore_request: AzureWorkloadRestoreRequest) -> Self { + Self { + azure_workload_restore_request, + should_use_alternate_target_location: None, + is_non_recoverable: None, + alternate_directory_paths: Vec::new(), + } + } +} +#[doc = "AzureWorkload SQL-specific restore with integrated rehydration of recovery point"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureWorkloadSqlRestoreWithRehydrateRequest { + #[serde(flatten)] + pub azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest, + #[doc = "RP Rehydration Info"] + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +impl AzureWorkloadSqlRestoreWithRehydrateRequest { + pub fn new(azure_workload_sql_restore_request: AzureWorkloadSqlRestoreRequest) -> Self { + Self { + azure_workload_sql_restore_request, + recovery_point_rehydration_info: None, + } + } +} +#[doc = "BEK is bitlocker encryption key."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BekDetails { + #[doc = "Secret is BEK."] + #[serde(rename = "secretUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_url: Option, + #[doc = "ID of the Key Vault where this Secret is stored."] + #[serde(rename = "secretVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_vault_id: Option, + #[doc = "BEK data."] + #[serde(rename = "secretData", default, skip_serializing_if = "Option::is_none")] + pub secret_data: Option, +} +impl BekDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameters to fetch list of backup engines."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsBackupEngineQueryObject { + #[doc = "attribute to add extended info"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +impl BmsBackupEngineQueryObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameters to fetch list of backup engines."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsBackupEnginesQueryObject { + #[doc = "Backup management type for the backup engine."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Friendly name of the backup engine."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Attribute to add extended info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +impl BmsBackupEnginesQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bms_backup_engines_query_object { + use super::*; + #[doc = "Backup management type for the backup engine."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[doc = "Query parameters to fetch backup summaries."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsBackupSummariesQueryObject { + #[doc = "Backup management type for this container."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl BmsBackupSummariesQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bms_backup_summaries_query_object { + use super::*; + #[doc = "Backup management type for this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + BackupProtectedItemCountSummary, + BackupProtectionContainerCountSummary, + } +} +#[doc = "The query filters that can be used with the list containers API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BmsContainerQueryObject { + #[doc = "Backup management type for this container."] + #[serde(rename = "backupManagementType")] + pub backup_management_type: bms_container_query_object::BackupManagementType, + #[doc = "Type of container for filter"] + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[doc = "Backup engine name"] + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[doc = "Fabric name for filter"] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "Status of registration of this container with the Recovery Services Vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Friendly name of this container."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +impl BmsContainerQueryObject { + pub fn new(backup_management_type: bms_container_query_object::BackupManagementType) -> Self { + Self { + backup_management_type, + container_type: None, + backup_engine_name: None, + fabric_name: None, + status: None, + friendly_name: None, + } + } +} +pub mod bms_container_query_object { + use super::*; + #[doc = "Backup management type for this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of container for filter"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } +} +#[doc = "The query filters that can be used with the inquire container API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsContainersInquiryQueryObject { + #[doc = "Backup management type for this container."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Workload type for this container."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, +} +impl BmsContainersInquiryQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bms_containers_inquiry_query_object { + use super::*; + #[doc = "Backup management type for this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Workload type for this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Filters to list items that can be backed up."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmspoQueryObject { + #[doc = "Backup management type."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Workload type"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Full name of the container whose Protectable Objects should be returned."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Backup status query parameter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +impl BmspoQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bmspo_query_object { + use super::*; + #[doc = "Backup management type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureSql, + AzureBackupServer, + AzureWorkload, + AzureStorage, + DefaultBackup, + } + #[doc = "Workload type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Filters to list backup copies."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsrpQueryObject { + #[doc = "Backup copies created after this time."] + #[serde(rename = "startDate", default, skip_serializing_if = "Option::is_none")] + pub start_date: Option, + #[doc = "Backup copies created before this time."] + #[serde(rename = "endDate", default, skip_serializing_if = "Option::is_none")] + pub end_date: Option, + #[doc = "RestorePoint type"] + #[serde(rename = "restorePointQueryType", default, skip_serializing_if = "Option::is_none")] + pub restore_point_query_type: Option, + #[doc = "In Get Recovery Point, it tells whether extended information about recovery point is asked."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Whether the RP can be moved to another tier"] + #[serde(rename = "moveReadyRPOnly", default, skip_serializing_if = "Option::is_none")] + pub move_ready_rp_only: Option, +} +impl BmsrpQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bmsrp_query_object { + use super::*; + #[doc = "RestorePoint type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RestorePointQueryType { + Invalid, + Full, + Log, + Differential, + FullAndDifferential, + All, + Incremental, + } +} +#[doc = "The query filters that can be used with the refresh container API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsRefreshContainersQueryObject { + #[doc = "Backup management type for this container."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, +} +impl BmsRefreshContainersQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bms_refresh_containers_query_object { + use super::*; + #[doc = "Backup management type for this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[doc = "Filters to list items that can be backed up."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BmsWorkloadItemQueryObject { + #[doc = "Backup management type."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Workload Item type"] + #[serde(rename = "workloadItemType", default, skip_serializing_if = "Option::is_none")] + pub workload_item_type: Option, + #[doc = "Workload type"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Backup status query parameter."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, +} +impl BmsWorkloadItemQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod bms_workload_item_query_object { + use super::*; + #[doc = "Backup management type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureSql, + AzureBackupServer, + AzureWorkload, + AzureStorage, + DefaultBackup, + } + #[doc = "Workload Item type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + #[serde(rename = "SAPHanaSystem")] + SapHanaSystem, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseSystem")] + SapAseSystem, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[doc = "Workload type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[doc = "Backup status query parameter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionStatus { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[doc = "The base backup engine class. All workload specific backup engines derive from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupEngineBase { + #[doc = "Friendly name of the backup engine."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Type of backup management for the backup engine."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Registration status of the backup engine with the Recovery Services Vault."] + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, + #[doc = "Status of the backup engine with the Recovery Services Vault. = {Active/Deleting/DeleteFailed}"] + #[serde(rename = "backupEngineState", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_state: Option, + #[doc = "Backup status of the backup engine."] + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[doc = "Type of the backup engine."] + #[serde(rename = "backupEngineType")] + pub backup_engine_type: backup_engine_base::BackupEngineType, + #[doc = "Flag indicating if the backup engine be registered, once already registered."] + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[doc = "ID of the backup engine."] + #[serde(rename = "backupEngineId", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_id: Option, + #[doc = "Backup engine version"] + #[serde(rename = "dpmVersion", default, skip_serializing_if = "Option::is_none")] + pub dpm_version: Option, + #[doc = "Backup agent version"] + #[serde(rename = "azureBackupAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_agent_version: Option, + #[doc = "To check if backup agent upgrade available"] + #[serde(rename = "isAzureBackupAgentUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_azure_backup_agent_upgrade_available: Option, + #[doc = "To check if backup engine upgrade available"] + #[serde(rename = "isDpmUpgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_dpm_upgrade_available: Option, + #[doc = "Additional information on backup engine."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl BackupEngineBase { + pub fn new(backup_engine_type: backup_engine_base::BackupEngineType) -> Self { + Self { + friendly_name: None, + backup_management_type: None, + registration_status: None, + backup_engine_state: None, + health_status: None, + backup_engine_type, + can_re_register: None, + backup_engine_id: None, + dpm_version: None, + azure_backup_agent_version: None, + is_azure_backup_agent_upgrade_available: None, + is_dpm_upgrade_available: None, + extended_info: None, + } + } +} +pub mod backup_engine_base { + use super::*; + #[doc = "Type of backup management for the backup engine."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of the backup engine."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupEngineType { + Invalid, + DpmBackupEngine, + AzureBackupServerEngine, + } +} +#[doc = "The base backup engine class. All workload specific backup engines derive from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupEngineBaseResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The base backup engine class. All workload specific backup engines derive from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupEngineBaseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of BackupEngineBase resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupEngineBaseResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupEngineBaseResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Additional information on backup engine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupEngineExtendedInfo { + #[doc = "Database name of backup engine."] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "Number of protected items in the backup engine."] + #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] + pub protected_items_count: Option, + #[doc = "Number of protected servers in the backup engine."] + #[serde(rename = "protectedServersCount", default, skip_serializing_if = "Option::is_none")] + pub protected_servers_count: Option, + #[doc = "Number of disks in the backup engine."] + #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] + pub disk_count: Option, + #[doc = "Disk space used in the backup engine."] + #[serde(rename = "usedDiskSpace", default, skip_serializing_if = "Option::is_none")] + pub used_disk_space: Option, + #[doc = "Disk space currently available in the backup engine."] + #[serde(rename = "availableDiskSpace", default, skip_serializing_if = "Option::is_none")] + pub available_disk_space: Option, + #[doc = "Last refresh time in the backup engine."] + #[serde(rename = "refreshedAt", default, skip_serializing_if = "Option::is_none")] + pub refreshed_at: Option, + #[doc = "Protected instances in the backup engine."] + #[serde(rename = "azureProtectedInstances", default, skip_serializing_if = "Option::is_none")] + pub azure_protected_instances: Option, +} +impl BackupEngineExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backup management usages of a vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupManagementUsage { + #[doc = "Unit of the usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unit: Option, + #[doc = "Quota period of usage."] + #[serde(rename = "quotaPeriod", default, skip_serializing_if = "Option::is_none")] + pub quota_period: Option, + #[doc = "Next reset time of usage."] + #[serde(rename = "nextResetTime", default, skip_serializing_if = "Option::is_none")] + pub next_reset_time: Option, + #[doc = "Current value of usage."] + #[serde(rename = "currentValue", default, skip_serializing_if = "Option::is_none")] + pub current_value: Option, + #[doc = "Limit of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The name of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl BackupManagementUsage { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_management_usage { + use super::*; + #[doc = "Unit of the usage."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Unit { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + } +} +#[doc = "Backup management usage for vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupManagementUsageList { + #[doc = "The list of backup management usages for the given vault."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BackupManagementUsageList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup request. Workload-specific backup requests are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupRequest { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl BackupRequest { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Base class for backup request. Workload-specific backup requests are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup request. Workload-specific backup requests are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupRequestResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource storage details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceConfig { + #[doc = "Storage type"] + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[doc = "Storage type."] + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[doc = "Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked."] + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[doc = "Opt in details of Cross Region Restore feature."] + #[serde(rename = "crossRegionRestoreFlag", default, skip_serializing_if = "Option::is_none")] + pub cross_region_restore_flag: Option, + #[doc = "Vault Dedup state"] + #[serde(rename = "dedupState", default, skip_serializing_if = "Option::is_none")] + pub dedup_state: Option, + #[doc = "Vault x-cool state"] + #[serde(rename = "xcoolState", default, skip_serializing_if = "Option::is_none")] + pub xcool_state: Option, +} +impl BackupResourceConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_resource_config { + use super::*; + #[doc = "Storage type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[doc = "Storage type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[doc = "Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } + #[doc = "Vault Dedup state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DedupState { + Invalid, + Enabled, + Disabled, + } + #[doc = "Vault x-cool state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum XcoolState { + Invalid, + Enabled, + Disabled, + } +} +#[doc = "The resource storage details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The resource storage details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupResourceConfigResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceEncryptionConfig { + #[doc = "Encryption At Rest Type"] + #[serde(rename = "encryptionAtRestType", default, skip_serializing_if = "Option::is_none")] + pub encryption_at_rest_type: Option, + #[doc = "Key Vault Key URI"] + #[serde(rename = "keyUri", default, skip_serializing_if = "Option::is_none")] + pub key_uri: Option, + #[doc = "Key Vault Subscription Id"] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "lastUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub last_update_status: Option, + #[serde(rename = "infrastructureEncryptionState", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_encryption_state: Option, +} +impl BackupResourceEncryptionConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_resource_encryption_config { + use super::*; + #[doc = "Encryption At Rest Type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EncryptionAtRestType { + Invalid, + MicrosoftManaged, + CustomerManaged, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastUpdateStatus { + Invalid, + NotEnabled, + PartiallySucceeded, + PartiallyFailed, + Failed, + Succeeded, + Initialized, + FirstInitialization, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InfrastructureEncryptionState { + Invalid, + Disabled, + Enabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceEncryptionConfigExtended { + #[serde(flatten)] + pub backup_resource_encryption_config: BackupResourceEncryptionConfig, + #[doc = "User Assigned Identity Id"] + #[serde(rename = "userAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identity: Option, + #[doc = "bool to indicate whether to use system Assigned Identity or not"] + #[serde(rename = "useSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub use_system_assigned_identity: Option, +} +impl BackupResourceEncryptionConfigExtended { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceEncryptionConfigExtendedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupResourceEncryptionConfigExtendedResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceEncryptionConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupResourceEncryptionConfigResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Backup resource vault config details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceVaultConfig { + #[doc = "Storage type."] + #[serde(rename = "storageModelType", default, skip_serializing_if = "Option::is_none")] + pub storage_model_type: Option, + #[doc = "Storage type."] + #[serde(rename = "storageType", default, skip_serializing_if = "Option::is_none")] + pub storage_type: Option, + #[doc = "Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked."] + #[serde(rename = "storageTypeState", default, skip_serializing_if = "Option::is_none")] + pub storage_type_state: Option, + #[doc = "Enabled or Disabled."] + #[serde(rename = "enhancedSecurityState", default, skip_serializing_if = "Option::is_none")] + pub enhanced_security_state: Option, + #[doc = "Soft Delete feature state"] + #[serde(rename = "softDeleteFeatureState", default, skip_serializing_if = "Option::is_none")] + pub soft_delete_feature_state: Option, + #[doc = "ResourceGuard Operation Requests"] + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[doc = "Is soft delete feature state editable"] + #[serde(rename = "isSoftDeleteFeatureStateEditable", default, skip_serializing_if = "Option::is_none")] + pub is_soft_delete_feature_state_editable: Option, +} +impl BackupResourceVaultConfig { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_resource_vault_config { + use super::*; + #[doc = "Storage type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageModelType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[doc = "Storage type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageType { + Invalid, + GeoRedundant, + LocallyRedundant, + ZoneRedundant, + ReadAccessGeoZoneRedundant, + } + #[doc = "Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StorageTypeState { + Invalid, + Locked, + Unlocked, + } + #[doc = "Enabled or Disabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum EnhancedSecurityState { + Invalid, + Enabled, + Disabled, + } + #[doc = "Soft Delete feature state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SoftDeleteFeatureState { + Invalid, + Enabled, + Disabled, + } +} +#[doc = "Backup resource vault config details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupResourceVaultConfigResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Backup resource vault config details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BackupResourceVaultConfigResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "BackupStatus request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupStatusRequest { + #[doc = "Container Type - VM, SQLPaaS, DPM, AzureFileShare..."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Entire ARM resource id of the resource"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Protectable Item Logical Name"] + #[serde(rename = "poLogicalName", default, skip_serializing_if = "Option::is_none")] + pub po_logical_name: Option, +} +impl BackupStatusRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_status_request { + use super::*; + #[doc = "Container Type - VM, SQLPaaS, DPM, AzureFileShare..."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "BackupStatus response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BackupStatusResponse { + #[doc = "Specifies whether the container is registered or not"] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Specifies the arm resource id of the vault"] + #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] + pub vault_id: Option, + #[doc = "Specifies the fabric name - Azure or AD"] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;csname;vmname."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Specifies the product specific ds name. E.g. vm;iaasvmcontainer;csname;vmname."] + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[doc = "ErrorCode in case of intent failed"] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "ErrorMessage in case of intent failed."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Specifies the policy name which is used for protection"] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Container registration status"] + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, +} +impl BackupStatusResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod backup_status_response { + use super::*; + #[doc = "Specifies whether the container is registered or not"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionStatus { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } + #[doc = "Specifies the fabric name - Azure or AD"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricName { + Invalid, + Azure, + } +} +#[doc = "Localized display information of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryDisplay { + #[doc = "Name of the provider for display purposes"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "ResourceType for which this Operation can be performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operations Name itself."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of the operation having details of what operation is about."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ClientDiscoveryDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox log specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForLogSpecification { + #[doc = "Name for shoebox log specification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display name"] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "blob duration of shoebox log specification"] + #[serde(rename = "blobDuration", default, skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, +} +impl ClientDiscoveryForLogSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox properties in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForProperties { + #[doc = "Class to represent shoebox service specification in json client discovery."] + #[serde(rename = "serviceSpecification", default, skip_serializing_if = "Option::is_none")] + pub service_specification: Option, +} +impl ClientDiscoveryForProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Class to represent shoebox service specification in json client discovery."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryForServiceSpecification { + #[doc = "List of log specifications of this operation."] + #[serde(rename = "logSpecifications", default, skip_serializing_if = "Vec::is_empty")] + pub log_specifications: Vec, +} +impl ClientDiscoveryForServiceSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations List response which contains list of available APIs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryResponse { + #[doc = "List of available operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next chunk of Response."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ClientDiscoveryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Available operation details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientDiscoveryValueForSingleApi { + #[doc = "Name of the Operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Localized display information of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Class to represent shoebox properties in json client discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ClientDiscoveryValueForSingleApi { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Client script details for file / folder restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClientScriptForConnect { + #[doc = "File content of the client script for file / folder restore."] + #[serde(rename = "scriptContent", default, skip_serializing_if = "Option::is_none")] + pub script_content: Option, + #[doc = "File extension of the client script for file / folder restore - .ps1 , .sh , etc."] + #[serde(rename = "scriptExtension", default, skip_serializing_if = "Option::is_none")] + pub script_extension: Option, + #[doc = "OS type - Windows, Linux etc. for which this file / folder restore client script works."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "URL of Executable from where to source the content. If this is not null then ScriptContent should not be used"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "Mandatory suffix that should be added to the name of script that is given for download to user.\r\nIf its null or empty then , ignore it."] + #[serde(rename = "scriptNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub script_name_suffix: Option, +} +impl ClientScriptForConnect { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the Container Instance service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "An error response from the Container Instance service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the Container Instance service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container identity information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContainerIdentityInfo { + #[doc = "Unique name of the container"] + #[serde(rename = "uniqueName", default, skip_serializing_if = "Option::is_none")] + pub unique_name: Option, + #[doc = "Protection container identity - AAD Tenant"] + #[serde(rename = "aadTenantId", default, skip_serializing_if = "Option::is_none")] + pub aad_tenant_id: Option, + #[doc = "Protection container identity - AAD Service Principal"] + #[serde(rename = "servicePrincipalClientId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_client_id: Option, + #[doc = "Protection container identity - Audience"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, +} +impl ContainerIdentityInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Additional information of the DPMContainer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DpmContainerExtendedInfo { + #[doc = "Last refresh time of the DPMContainer."] + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, +} +impl DpmContainerExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Additional information on Backup engine specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of the managed item"] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Backup Management server protecting this backup item"] + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[doc = "Protection state of the backup engine"] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Additional information of DPM Protected item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl DpmProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + backup_engine_name: None, + protection_state: None, + extended_info: None, + } + } +} +pub mod dpm_protected_item { + use super::*; + #[doc = "Protection state of the backup engine"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[doc = "Additional information of DPM Protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DpmProtectedItemExtendedInfo { + #[doc = "Attribute to provide information on various DBs."] + #[serde(rename = "protectableObjectLoadPath", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_load_path: Option, + #[doc = "To check if backup item is disk protected."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protected: Option, + #[doc = "To check if backup item is cloud protected."] + #[serde(rename = "isPresentOnCloud", default, skip_serializing_if = "Option::is_none")] + pub is_present_on_cloud: Option, + #[doc = "Last backup status information on backup item."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[doc = "Last refresh time on backup item."] + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[doc = "Oldest cloud recovery point time."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "cloud recovery point count."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, + #[doc = "Oldest disk recovery point time."] + #[serde(rename = "onPremiseOldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_oldest_recovery_point: Option, + #[doc = "latest disk recovery point time."] + #[serde(rename = "onPremiseLatestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub on_premise_latest_recovery_point: Option, + #[doc = "disk recovery point count."] + #[serde(rename = "onPremiseRecoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub on_premise_recovery_point_count: Option, + #[doc = "To check if backup item is collocated."] + #[serde(rename = "isCollocated", default, skip_serializing_if = "Option::is_none")] + pub is_collocated: Option, + #[doc = "Protection group name of the backup item."] + #[serde(rename = "protectionGroupName", default, skip_serializing_if = "Option::is_none")] + pub protection_group_name: Option, + #[doc = "Used Disk storage in bytes."] + #[serde(rename = "diskStorageUsedInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_storage_used_in_bytes: Option, + #[doc = "total Disk storage in bytes."] + #[serde(rename = "totalDiskStorageSizeInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_disk_storage_size_in_bytes: Option, +} +impl DpmProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Daily retention format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DailyRetentionFormat { + #[doc = "List of days of the month."] + #[serde(rename = "daysOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_month: Vec, +} +impl DailyRetentionFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Daily retention schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DailyRetentionSchedule { + #[doc = "Retention times of retention policy."] + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[doc = "Retention duration."] + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +impl DailyRetentionSchedule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DailySchedule { + #[doc = "List of times of day this schedule has to be run."] + #[serde(rename = "scheduleRunTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_times: Vec, +} +impl DailySchedule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Day of the week."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Day { + #[doc = "Date of the month"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub date: Option, + #[doc = "Whether Date is last date of month"] + #[serde(rename = "isLast", default, skip_serializing_if = "Option::is_none")] + pub is_last: Option, +} +impl Day { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskExclusionProperties { + #[doc = "List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection."] + #[serde(rename = "diskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub disk_lun_list: Vec, + #[doc = "Flag to indicate whether DiskLunList is to be included/ excluded from backup."] + #[serde(rename = "isInclusionList", default, skip_serializing_if = "Option::is_none")] + pub is_inclusion_list: Option, +} +impl DiskExclusionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Disk information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskInformation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl DiskInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This is used to represent the various nodes of the distributed container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DistributedNodesInfo { + #[doc = "Name of the node under a distributed container."] + #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")] + pub node_name: Option, + #[doc = "Status of this Node.\r\nFailed | Succeeded"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Error Detail class which encapsulates Code, Message and Recommendations."] + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, +} +impl DistributedNodesInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Data Protection Manager (DPM) specific backup engine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmBackupEngine { + #[serde(flatten)] + pub backup_engine_base: BackupEngineBase, +} +impl DpmBackupEngine { + pub fn new(backup_engine_base: BackupEngineBase) -> Self { + Self { backup_engine_base } + } +} +#[doc = "DPM workload-specific protection container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "Specifies whether the container is re-registrable."] + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[doc = "ID of container."] + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[doc = "Number of protected items in the BackupEngine"] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "Backup engine Agent version"] + #[serde(rename = "dpmAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub dpm_agent_version: Option, + #[doc = "List of BackupEngines protecting the container"] + #[serde(rename = "dpmServers", default, skip_serializing_if = "Vec::is_empty")] + pub dpm_servers: Vec, + #[doc = "To check if upgrade available"] + #[serde(rename = "upgradeAvailable", default, skip_serializing_if = "Option::is_none")] + pub upgrade_available: Option, + #[doc = "Protection status of the container."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "Additional information of the DPMContainer."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl DpmContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + can_re_register: None, + container_id: None, + protected_item_count: None, + dpm_agent_version: None, + dpm_servers: Vec::new(), + upgrade_available: None, + protection_status: None, + extended_info: None, + } + } +} +#[doc = "DPM workload-specific error information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DpmErrorInfo { + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "List of localized recommendations for above error code."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl DpmErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DPM workload-specific job object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DpmJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Time elapsed for job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "DPM server name managing the backup item or backup job."] + #[serde(rename = "dpmServerName", default, skip_serializing_if = "Option::is_none")] + pub dpm_server_name: Option, + #[doc = "Name of cluster/server protecting current backup item, if any."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Type of container."] + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, + #[doc = "Type of backup item."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "The state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "The errors."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Additional information on the DPM workload-specific job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl DpmJob { + pub fn new(job: Job) -> Self { + Self { + job, + duration: None, + dpm_server_name: None, + container_name: None, + container_type: None, + workload_type: None, + actions_info: Vec::new(), + error_details: Vec::new(), + extended_info: None, + } + } +} +#[doc = "Additional information on the DPM workload-specific job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DpmJobExtendedInfo { + #[doc = "List of tasks associated with this job."] + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[doc = "The job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Non localized error message on job execution."] + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +impl DpmJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DPM workload-specific job task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DpmJobTaskDetails { + #[doc = "The task display name."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Time elapsed for task."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "The status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl DpmJobTaskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details needed if the VM was encrypted at the time of backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EncryptionDetails { + #[doc = "Identifies whether this backup copy represents an encrypted VM at the time of backup."] + #[serde(rename = "encryptionEnabled", default, skip_serializing_if = "Option::is_none")] + pub encryption_enabled: Option, + #[doc = "Key Url."] + #[serde(rename = "kekUrl", default, skip_serializing_if = "Option::is_none")] + pub kek_url: Option, + #[doc = "Secret Url."] + #[serde(rename = "secretKeyUrl", default, skip_serializing_if = "Option::is_none")] + pub secret_key_url: Option, + #[doc = "ID of Key Vault where KEK is stored."] + #[serde(rename = "kekVaultId", default, skip_serializing_if = "Option::is_none")] + pub kek_vault_id: Option, + #[doc = "ID of Key Vault where Secret is stored."] + #[serde(rename = "secretKeyVaultId", default, skip_serializing_if = "Option::is_none")] + pub secret_key_vault_id: Option, +} +impl EncryptionDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error Detail class which encapsulates Code, Message and Recommendations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error Message related to the Code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "List of recommendation strings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class is used to send blob details after exporting jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportJobsOperationResultInfo { + #[serde(flatten)] + pub operation_result_info_base: OperationResultInfoBase, + #[doc = "URL of the blob into which the serialized string of list of jobs is exported."] + #[serde(rename = "blobUrl", default, skip_serializing_if = "Option::is_none")] + pub blob_url: Option, + #[doc = "SAS key to access the blob. It expires in 15 mins."] + #[serde(rename = "blobSasKey", default, skip_serializing_if = "Option::is_none")] + pub blob_sas_key: Option, + #[doc = "URL of the blob into which the ExcelFile is uploaded."] + #[serde(rename = "excelFileBlobUrl", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_url: Option, + #[doc = "SAS key to access the blob. It expires in 15 mins."] + #[serde(rename = "excelFileBlobSasKey", default, skip_serializing_if = "Option::is_none")] + pub excel_file_blob_sas_key: Option, +} +impl ExportJobsOperationResultInfo { + pub fn new(operation_result_info_base: OperationResultInfoBase) -> Self { + Self { + operation_result_info_base, + blob_url: None, + blob_sas_key: None, + excel_file_blob_url: None, + excel_file_blob_sas_key: None, + } + } +} +#[doc = "Extended Properties for Azure IaasVM Backup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedProperties { + #[serde(rename = "diskExclusionProperties", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_properties: Option, + #[doc = "Linux VM name"] + #[serde(rename = "linuxVmApplicationName", default, skip_serializing_if = "Option::is_none")] + pub linux_vm_application_name: Option, +} +impl ExtendedProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for feature request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FeatureSupportRequest { + #[doc = "backup support feature type."] + #[serde(rename = "featureType")] + pub feature_type: String, +} +impl FeatureSupportRequest { + pub fn new(feature_type: String) -> Self { + Self { feature_type } + } +} +#[doc = "Base class for generic container of backup items"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "Name of the container's fabric"] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "Container extended information"] + #[serde(rename = "extendedInformation", default, skip_serializing_if = "Option::is_none")] + pub extended_information: Option, +} +impl GenericContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + fabric_name: None, + extended_information: None, + } + } +} +#[doc = "Container extended information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GenericContainerExtendedInfo { + #[doc = "Public key of container cert"] + #[serde(rename = "rawCertData", default, skip_serializing_if = "Option::is_none")] + pub raw_cert_data: Option, + #[doc = "Container identity information"] + #[serde(rename = "containerIdentityInfo", default, skip_serializing_if = "Option::is_none")] + pub container_identity_info: Option, + #[doc = "Azure Backup Service Endpoints for the container"] + #[serde(rename = "serviceEndpoints", default, skip_serializing_if = "Option::is_none")] + pub service_endpoints: Option, +} +impl GenericContainerExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of the container."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Indicates consistency of policy object and policy applied to this backup item."] + #[serde(rename = "policyState", default, skip_serializing_if = "Option::is_none")] + pub policy_state: Option, + #[doc = "Backup state of this backup item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Data Plane Service ID of the protected item."] + #[serde(rename = "protectedItemId", default, skip_serializing_if = "Option::is_none")] + pub protected_item_id: Option, + #[doc = "Loosely coupled (type, value) associations (example - parent of a protected item)"] + #[serde(rename = "sourceAssociations", default, skip_serializing_if = "Option::is_none")] + pub source_associations: Option, + #[doc = "Name of this backup item's fabric."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +impl GenericProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + policy_state: None, + protection_state: None, + protected_item_id: None, + source_associations: None, + fabric_name: None, + } + } +} +pub mod generic_protected_item { + use super::*; + #[doc = "Backup state of this backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + #[serde(rename = "IRPending")] + IrPending, + Protected, + ProtectionError, + ProtectionStopped, + ProtectionPaused, + } +} +#[doc = "Azure VM (Mercury) workload-specific backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[doc = "List of sub-protection policies which includes schedule and retention"] + #[serde(rename = "subProtectionPolicy", default, skip_serializing_if = "Vec::is_empty")] + pub sub_protection_policy: Vec, + #[doc = "TimeZone optional input as string. For example: TimeZone = \"Pacific Standard Time\"."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[doc = "Name of this policy's fabric."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, +} +impl GenericProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + sub_protection_policy: Vec::new(), + time_zone: None, + fabric_name: None, + } + } +} +#[doc = "Generic backup copy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GenericRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[doc = "Friendly name of the backup copy."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Type of the backup copy."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "Time at which this backup copy was created."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[doc = "Additional information associated with this backup copy."] + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, +} +impl GenericRecoveryPoint { + pub fn new(recovery_point: RecoveryPoint) -> Self { + Self { + recovery_point, + friendly_name: None, + recovery_point_type: None, + recovery_point_time: None, + recovery_point_additional_info: None, + } + } +} +#[doc = "Filters to list backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GetProtectedItemQueryObject { + #[doc = "Specifies if the additional information should be provided for this item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expand: Option, +} +impl GetProtectedItemQueryObject { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HourlySchedule { + #[doc = "Interval at which backup needs to be triggered. For hourly the value\r\n can be 4/6/8/12"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[doc = "To specify start time of the backup window"] + #[serde(rename = "scheduleWindowStartTime", default, skip_serializing_if = "Option::is_none")] + pub schedule_window_start_time: Option, + #[doc = "To specify duration of the backup window"] + #[serde(rename = "scheduleWindowDuration", default, skip_serializing_if = "Option::is_none")] + pub schedule_window_duration: Option, +} +impl HourlySchedule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters to Provision ILR API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IlrRequest { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl IlrRequest { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Parameters to Provision ILR API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IlrRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Parameters to Provision ILR API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl IlrRequestResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "IaaS VM workload-specific container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaaSvmContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "Fully qualified ARM url of the virtual machine represented by this Azure IaaS VM container."] + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[doc = "Specifies whether the container represents a Classic or an Azure Resource Manager VM."] + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[doc = "Resource group name of Recovery Services Vault."] + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +impl IaaSvmContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + virtual_machine_id: None, + virtual_machine_version: None, + resource_group: None, + } + } +} +#[doc = "IaaS VM workload-specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaaSvmProtectableItem { + #[serde(flatten)] + pub workload_protectable_item: WorkloadProtectableItem, + #[doc = "Fully qualified ARM ID of the virtual machine."] + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[doc = "Specifies whether the container represents a Classic or an Azure Resource Manager VM."] + #[serde(rename = "virtualMachineVersion", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_version: Option, + #[doc = "Resource group name of Recovery Services Vault."] + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +impl IaaSvmProtectableItem { + pub fn new(workload_protectable_item: WorkloadProtectableItem) -> Self { + Self { + workload_protectable_item, + virtual_machine_id: None, + virtual_machine_version: None, + resource_group: None, + } + } +} +#[doc = "IaaS VM workload-specific backup request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmBackupRequest { + #[serde(flatten)] + pub backup_request: BackupRequest, + #[doc = "Backup copy will expire after the time specified (UTC)."] + #[serde(rename = "recoveryPointExpiryTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_expiry_time_in_utc: Option, +} +impl IaasVmBackupRequest { + pub fn new(backup_request: BackupRequest) -> Self { + Self { + backup_request, + recovery_point_expiry_time_in_utc: None, + } + } +} +#[doc = "Restore files/folders from a backup copy of IaaS VM."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmilrRegistrationRequest { + #[serde(flatten)] + pub ilr_request: IlrRequest, + #[doc = "ID of the IaaS VM backup copy from where the files/folders have to be restored."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "Fully qualified ARM ID of the virtual machine whose the files / folders have to be restored."] + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, + #[doc = "iSCSI initiator name."] + #[serde(rename = "initiatorName", default, skip_serializing_if = "Option::is_none")] + pub initiator_name: Option, + #[doc = "Whether to renew existing registration with the iSCSI server."] + #[serde(rename = "renewExistingRegistration", default, skip_serializing_if = "Option::is_none")] + pub renew_existing_registration: Option, +} +impl IaasVmilrRegistrationRequest { + pub fn new(ilr_request: IlrRequest) -> Self { + Self { + ilr_request, + recovery_point_id: None, + virtual_machine_id: None, + initiator_name: None, + renew_existing_registration: None, + } + } +} +#[doc = "IaaS VM workload specific backup copy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRecoveryPoint { + #[serde(flatten)] + pub recovery_point: RecoveryPoint, + #[doc = "Type of the backup copy."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "Time at which this backup copy was created."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[doc = "Additional information associated with this backup copy."] + #[serde(rename = "recoveryPointAdditionalInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_additional_info: Option, + #[doc = "Storage type of the VM whose backup copy is created."] + #[serde(rename = "sourceVMStorageType", default, skip_serializing_if = "Option::is_none")] + pub source_vm_storage_type: Option, + #[doc = "Identifies whether the VM was encrypted when the backup copy is created."] + #[serde(rename = "isSourceVMEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_source_vm_encrypted: Option, + #[doc = "BEK is bitlocker key.\r\nKEK is encryption key for BEK\r\nIf the VM was encrypted then we will store following details :\r\n1. Secret(BEK) - Url + Backup Data + vaultId.\r\n2. Key(KEK) - Url + Backup Data + vaultId.\r\n3. EncryptionMechanism\r\nBEK and KEK can potentially have different vault ids."] + #[serde(rename = "keyAndSecret", default, skip_serializing_if = "Option::is_none")] + pub key_and_secret: Option, + #[doc = "Is the session to recover items from this backup copy still active."] + #[serde(rename = "isInstantIlrSessionActive", default, skip_serializing_if = "Option::is_none")] + pub is_instant_ilr_session_active: Option, + #[doc = "Recovery point tier information."] + #[serde(rename = "recoveryPointTierDetails", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_point_tier_details: Vec, + #[doc = "Whether VM is with Managed Disks"] + #[serde(rename = "isManagedVirtualMachine", default, skip_serializing_if = "Option::is_none")] + pub is_managed_virtual_machine: Option, + #[doc = "Virtual Machine Size"] + #[serde(rename = "virtualMachineSize", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_size: Option, + #[doc = "Original Storage Account Option"] + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[doc = "OS type"] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Disk configuration"] + #[serde(rename = "recoveryPointDiskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_disk_configuration: Option, + #[doc = "Identifies the zone of the VM at the time of backup. Applicable only for zone-pinned Vms"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "Eligibility of RP to be moved to another tier"] + #[serde(rename = "recoveryPointMoveReadinessInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_move_readiness_info: Option, +} +impl IaasVmRecoveryPoint { + pub fn new(recovery_point: RecoveryPoint) -> Self { + Self { + recovery_point, + recovery_point_type: None, + recovery_point_time: None, + recovery_point_additional_info: None, + source_vm_storage_type: None, + is_source_vm_encrypted: None, + key_and_secret: None, + is_instant_ilr_session_active: None, + recovery_point_tier_details: Vec::new(), + is_managed_virtual_machine: None, + virtual_machine_size: None, + original_storage_account_option: None, + os_type: None, + recovery_point_disk_configuration: None, + zones: Vec::new(), + recovery_point_move_readiness_info: None, + } + } +} +#[doc = "IaaS VM workload-specific restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreRequest { + #[serde(flatten)] + pub restore_request: RestoreRequest, + #[doc = "ID of the backup copy to be recovered."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "Type of this recovery."] + #[serde(rename = "recoveryType", default, skip_serializing_if = "Option::is_none")] + pub recovery_type: Option, + #[doc = "Fully qualified ARM ID of the VM which is being recovered."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "This is the complete ARM Id of the VM that will be created.\r\nFor e.g. /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}"] + #[serde(rename = "targetVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub target_virtual_machine_id: Option, + #[doc = "This is the ARM Id of the resource group that you want to create for this Virtual machine and other artifacts.\r\nFor e.g. /subscriptions/{subId}/resourcegroups/{rg}"] + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[doc = "Fully qualified ARM ID of the storage account to which the VM has to be restored."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[doc = "This is the virtual network Id of the vnet that will be attached to the virtual machine.\r\nUser will be validated for join action permissions in the linked access."] + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[doc = "Subnet ID, is the subnet ID associated with the to be restored VM. For Classic VMs it would be\r\n{VnetID}/Subnet/{SubnetName} and, for the Azure Resource Manager VMs it would be ARM resource ID used to represent\r\nthe subnet."] + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[doc = "Fully qualified ARM ID of the domain name to be associated to the VM being restored. This applies only to Classic\r\nVirtual Machines."] + #[serde(rename = "targetDomainNameId", default, skip_serializing_if = "Option::is_none")] + pub target_domain_name_id: Option, + #[doc = "Region in which the virtual machine is restored."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub region: Option, + #[doc = "Affinity group associated to VM to be restored. Used only for Classic Compute Virtual Machines."] + #[serde(rename = "affinityGroup", default, skip_serializing_if = "Option::is_none")] + pub affinity_group: Option, + #[doc = "Should a new cloud service be created while restoring the VM. If this is false, VM will be restored to the same\r\ncloud service as it was at the time of backup."] + #[serde(rename = "createNewCloudService", default, skip_serializing_if = "Option::is_none")] + pub create_new_cloud_service: Option, + #[doc = "Original Storage Account Option"] + #[serde(rename = "originalStorageAccountOption", default, skip_serializing_if = "Option::is_none")] + pub original_storage_account_option: Option, + #[doc = "Details needed if the VM was encrypted at the time of backup."] + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[doc = "List of Disk LUNs for partial restore"] + #[serde(rename = "restoreDiskLunList", default, skip_serializing_if = "Vec::is_empty")] + pub restore_disk_lun_list: Vec, + #[doc = "Flag to denote of an Unmanaged disk VM should be restored with Managed disks."] + #[serde(rename = "restoreWithManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub restore_with_managed_disks: Option, + #[doc = "DiskEncryptionSet's ID - needed if the VM needs to be encrypted at rest during restore with customer managed key."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "Target zone where the VM and its disks should be restored."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, + #[doc = "Encapsulates Managed Identity related information"] + #[serde(rename = "identityInfo", default, skip_serializing_if = "Option::is_none")] + pub identity_info: Option, + #[doc = "IaaS VM workload specific restore details for restores using managed identity"] + #[serde(rename = "identityBasedRestoreDetails", default, skip_serializing_if = "Option::is_none")] + pub identity_based_restore_details: Option, +} +impl IaasVmRestoreRequest { + pub fn new(restore_request: RestoreRequest) -> Self { + Self { + restore_request, + recovery_point_id: None, + recovery_type: None, + source_resource_id: None, + target_virtual_machine_id: None, + target_resource_group_id: None, + storage_account_id: None, + virtual_network_id: None, + subnet_id: None, + target_domain_name_id: None, + region: None, + affinity_group: None, + create_new_cloud_service: None, + original_storage_account_option: None, + encryption_details: None, + restore_disk_lun_list: Vec::new(), + restore_with_managed_disks: None, + disk_encryption_set_id: None, + zones: Vec::new(), + identity_info: None, + identity_based_restore_details: None, + } + } +} +pub mod iaas_vm_restore_request { + use super::*; + #[doc = "Type of this recovery."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryType { + Invalid, + OriginalLocation, + AlternateLocation, + RestoreDisks, + Offline, + } +} +#[doc = "IaaS VM workload-specific restore with integrated rehydration of recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IaasVmRestoreWithRehydrationRequest { + #[serde(flatten)] + pub iaas_vm_restore_request: IaasVmRestoreRequest, + #[doc = "RP Rehydration Info"] + #[serde(rename = "recoveryPointRehydrationInfo", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_rehydration_info: Option, +} +impl IaasVmRestoreWithRehydrationRequest { + pub fn new(iaas_vm_restore_request: IaasVmRestoreRequest) -> Self { + Self { + iaas_vm_restore_request, + recovery_point_rehydration_info: None, + } + } +} +#[doc = "IaaS VM workload specific restore details for restores using managed identity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityBasedRestoreDetails { + #[doc = "Gets the class type."] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Fully qualified ARM ID of the target storage account."] + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, +} +impl IdentityBasedRestoreDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Encapsulates Managed Identity related information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityInfo { + #[doc = "To differentiate if the managed identity is system assigned or user assigned"] + #[serde(rename = "isSystemAssignedIdentity", default, skip_serializing_if = "Option::is_none")] + pub is_system_assigned_identity: Option, + #[doc = "Managed Identity Resource Id\r\nOptional: Might not be required in the case of system assigned managed identity"] + #[serde(rename = "managedIdentityResourceId", default, skip_serializing_if = "Option::is_none")] + pub managed_identity_resource_id: Option, +} +impl IdentityInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about inquired protectable items under a given container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InquiryInfo { + #[doc = "Inquiry Status for this container such as\r\nInProgress | Failed | Succeeded"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Error Detail class which encapsulates Code, Message and Recommendations."] + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, + #[doc = "Inquiry Details which will have workload specific details.\r\nFor e.g. - For SQL and oracle this will contain different details."] + #[serde(rename = "inquiryDetails", default, skip_serializing_if = "Vec::is_empty")] + pub inquiry_details: Vec, +} +impl InquiryInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Validation for inquired protectable items under a given container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InquiryValidation { + #[doc = "Status for the Inquiry Validation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Error Detail class which encapsulates Code, Message and Recommendations."] + #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")] + pub error_detail: Option, + #[doc = "Error Additional Detail in case the status is non-success."] + #[serde(rename = "additionalDetail", default, skip_serializing_if = "Option::is_none")] + pub additional_detail: Option, +} +impl InquiryValidation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Target details for file / folder restore."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InstantItemRecoveryTarget { + #[doc = "List of client scripts."] + #[serde(rename = "clientScripts", default, skip_serializing_if = "Vec::is_empty")] + pub client_scripts: Vec, +} +impl InstantItemRecoveryTarget { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InstantRpAdditionalDetails { + #[serde(rename = "azureBackupRGNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_rg_name_prefix: Option, + #[serde(rename = "azureBackupRGNameSuffix", default, skip_serializing_if = "Option::is_none")] + pub azure_backup_rg_name_suffix: Option, +} +impl InstantRpAdditionalDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines workload agnostic properties for a job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[doc = "Friendly name of the entity on which the current job is executing."] + #[serde(rename = "entityFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub entity_friendly_name: Option, + #[doc = "Backup management type to execute the current job."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "The operation name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Job status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "ActivityId of job."] + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "jobType")] + pub job_type: String, +} +impl Job { + pub fn new(job_type: String) -> Self { + Self { + entity_friendly_name: None, + backup_management_type: None, + operation: None, + status: None, + start_time: None, + end_time: None, + activity_id: None, + job_type, + } + } +} +pub mod job { + use super::*; + #[doc = "Backup management type to execute the current job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } +} +#[doc = "Filters to list the jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobQueryObject { + #[doc = "Status of the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Type of backup management for the job."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "JobID represents the job uniquely."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "Job has started at this time. Value is in UTC."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Job has ended at this time. Value is in UTC."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +impl JobQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod job_query_object { + use super::*; + #[doc = "Status of the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Completed, + Failed, + CompletedWithWarnings, + Cancelled, + Cancelling, + } + #[doc = "Type of backup management for the job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operation { + Invalid, + Register, + UnRegister, + ConfigureBackup, + Backup, + Restore, + DisableBackup, + DeleteBackupData, + CrossRegionRestore, + Undelete, + UpdateCustomerManagedKey, + } +} +#[doc = "Defines workload agnostic properties for a job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Defines workload agnostic properties for a job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl JobResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Job resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl JobResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "KEK is encryption key for BEK."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KekDetails { + #[doc = "Key is KEK."] + #[serde(rename = "keyUrl", default, skip_serializing_if = "Option::is_none")] + pub key_url: Option, + #[doc = "Key Vault ID where this Key is stored."] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[doc = "KEK data."] + #[serde(rename = "keyBackupData", default, skip_serializing_if = "Option::is_none")] + pub key_backup_data: Option, +} +impl KekDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "KPI Resource Health Details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KpiResourceHealthDetails { + #[doc = "Resource Health Status"] + #[serde(rename = "resourceHealthStatus", default, skip_serializing_if = "Option::is_none")] + pub resource_health_status: Option, + #[doc = "Resource Health Status"] + #[serde(rename = "resourceHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_health_details: Vec, +} +impl KpiResourceHealthDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod kpi_resource_health_details { + use super::*; + #[doc = "Resource Health Status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceHealthStatus { + Healthy, + TransientDegraded, + PersistentDegraded, + TransientUnhealthy, + PersistentUnhealthy, + Invalid, + } +} +#[doc = "BEK is bitlocker key.\r\nKEK is encryption key for BEK\r\nIf the VM was encrypted then we will store following details :\r\n1. Secret(BEK) - Url + Backup Data + vaultId.\r\n2. Key(KEK) - Url + Backup Data + vaultId.\r\n3. EncryptionMechanism\r\nBEK and KEK can potentially have different vault ids."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyAndSecretDetails { + #[doc = "KEK is encryption key for BEK."] + #[serde(rename = "kekDetails", default, skip_serializing_if = "Option::is_none")] + pub kek_details: Option, + #[doc = "BEK is bitlocker encryption key."] + #[serde(rename = "bekDetails", default, skip_serializing_if = "Option::is_none")] + pub bek_details: Option, + #[doc = "Encryption mechanism: None/ SinglePass/ DoublePass"] + #[serde(rename = "encryptionMechanism", default, skip_serializing_if = "Option::is_none")] + pub encryption_mechanism: Option, +} +impl KeyAndSecretDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ListRecoveryPointsRecommendedForMoveRequest Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ListRecoveryPointsRecommendedForMoveRequest { + #[doc = "Gets the class type."] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "List of Recovery Points excluded from Move"] + #[serde(rename = "excludedRPList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_rp_list: Vec, +} +impl ListRecoveryPointsRecommendedForMoveRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Log policy schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, + #[doc = "Frequency of the log schedule operation of this policy in minutes."] + #[serde(rename = "scheduleFrequencyInMins", default, skip_serializing_if = "Option::is_none")] + pub schedule_frequency_in_mins: Option, +} +impl LogSchedulePolicy { + pub fn new(schedule_policy: SchedulePolicy) -> Self { + Self { + schedule_policy, + schedule_frequency_in_mins: None, + } + } +} +#[doc = "Long term retention policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermRetentionPolicy { + #[serde(flatten)] + pub retention_policy: RetentionPolicy, + #[doc = "Daily retention schedule."] + #[serde(rename = "dailySchedule", default, skip_serializing_if = "Option::is_none")] + pub daily_schedule: Option, + #[doc = "Weekly retention schedule."] + #[serde(rename = "weeklySchedule", default, skip_serializing_if = "Option::is_none")] + pub weekly_schedule: Option, + #[doc = "Monthly retention schedule."] + #[serde(rename = "monthlySchedule", default, skip_serializing_if = "Option::is_none")] + pub monthly_schedule: Option, + #[doc = "Yearly retention schedule."] + #[serde(rename = "yearlySchedule", default, skip_serializing_if = "Option::is_none")] + pub yearly_schedule: Option, +} +impl LongTermRetentionPolicy { + pub fn new(retention_policy: RetentionPolicy) -> Self { + Self { + retention_policy, + daily_schedule: None, + weekly_schedule: None, + monthly_schedule: None, + yearly_schedule: None, + } + } +} +#[doc = "Long term policy schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LongTermSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, +} +impl LongTermSchedulePolicy { + pub fn new(schedule_policy: SchedulePolicy) -> Self { + Self { schedule_policy } + } +} +#[doc = "MAB workload-specific Health Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabContainerHealthDetails { + #[doc = "Health Code"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Health Title"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Health Message"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Health Recommended Actions"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl MabContainerHealthDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container with items backed up using MAB backup engine."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabContainer { + #[serde(flatten)] + pub protection_container: ProtectionContainer, + #[doc = "Can the container be registered one more time."] + #[serde(rename = "canReRegister", default, skip_serializing_if = "Option::is_none")] + pub can_re_register: Option, + #[doc = "ContainerID represents the container."] + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[doc = "Number of items backed up in this container."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "Agent version of this container."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "Additional information of the container."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, + #[doc = "Health details on this mab container."] + #[serde(rename = "mabContainerHealthDetails", default, skip_serializing_if = "Vec::is_empty")] + pub mab_container_health_details: Vec, + #[doc = "Health state of mab container."] + #[serde(rename = "containerHealthState", default, skip_serializing_if = "Option::is_none")] + pub container_health_state: Option, +} +impl MabContainer { + pub fn new(protection_container: ProtectionContainer) -> Self { + Self { + protection_container, + can_re_register: None, + container_id: None, + protected_item_count: None, + agent_version: None, + extended_info: None, + mab_container_health_details: Vec::new(), + container_health_state: None, + } + } +} +#[doc = "Additional information of the container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabContainerExtendedInfo { + #[doc = "Time stamp when this container was refreshed."] + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[doc = "Type of backup items associated with this container."] + #[serde(rename = "backupItemType", default, skip_serializing_if = "Option::is_none")] + pub backup_item_type: Option, + #[doc = "List of backup items associated with this container."] + #[serde(rename = "backupItems", default, skip_serializing_if = "Vec::is_empty")] + pub backup_items: Vec, + #[doc = "Backup policy associated with this container."] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Latest backup status of this container."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, +} +impl MabContainerExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod mab_container_extended_info { + use super::*; + #[doc = "Type of backup items associated with this container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "MAB workload-specific error information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabErrorInfo { + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "List of localized recommendations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl MabErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "MAB workload-specific backup item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabFileFolderProtectedItem { + #[serde(flatten)] + pub protected_item: ProtectedItem, + #[doc = "Friendly name of this backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Name of the computer associated with this backup item."] + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[doc = "Status of last backup operation."] + #[serde(rename = "lastBackupStatus", default, skip_serializing_if = "Option::is_none")] + pub last_backup_status: Option, + #[doc = "Timestamp of the last backup operation on this backup item."] + #[serde(rename = "lastBackupTime", default, skip_serializing_if = "Option::is_none")] + pub last_backup_time: Option, + #[doc = "Protected, ProtectionStopped, IRPending or ProtectionError"] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "Sync time for deferred deletion in UTC"] + #[serde(rename = "deferredDeleteSyncTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_sync_time_in_utc: Option, + #[doc = "Additional information on the backed up item."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl MabFileFolderProtectedItem { + pub fn new(protected_item: ProtectedItem) -> Self { + Self { + protected_item, + friendly_name: None, + computer_name: None, + last_backup_status: None, + last_backup_time: None, + protection_state: None, + deferred_delete_sync_time_in_utc: None, + extended_info: None, + } + } +} +#[doc = "Additional information on the backed up item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabFileFolderProtectedItemExtendedInfo { + #[doc = "Last time when the agent data synced to service."] + #[serde(rename = "lastRefreshedAt", default, skip_serializing_if = "Option::is_none")] + pub last_refreshed_at: Option, + #[doc = "The oldest backup copy available."] + #[serde(rename = "oldestRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub oldest_recovery_point: Option, + #[doc = "Number of backup copies associated with the backup item."] + #[serde(rename = "recoveryPointCount", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_count: Option, +} +impl MabFileFolderProtectedItemExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "MAB workload-specific job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Time taken by job to run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "The state/actions applicable on jobs like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Name of server protecting the DS."] + #[serde(rename = "mabServerName", default, skip_serializing_if = "Option::is_none")] + pub mab_server_name: Option, + #[doc = "Server type of MAB container."] + #[serde(rename = "mabServerType", default, skip_serializing_if = "Option::is_none")] + pub mab_server_type: Option, + #[doc = "Workload type of backup item."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "The errors."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Additional information for the MAB workload-specific job."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl MabJob { + pub fn new(job: Job) -> Self { + Self { + job, + duration: None, + actions_info: Vec::new(), + mab_server_name: None, + mab_server_type: None, + workload_type: None, + error_details: Vec::new(), + extended_info: None, + } + } +} +pub mod mab_job { + use super::*; + #[doc = "Server type of MAB container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MabServerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + } + #[doc = "Workload type of backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Additional information for the MAB workload-specific job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabJobExtendedInfo { + #[doc = "List of tasks for this job."] + #[serde(rename = "tasksList", default, skip_serializing_if = "Vec::is_empty")] + pub tasks_list: Vec, + #[doc = "The job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, + #[doc = "Non localized error message specific to this job."] + #[serde(rename = "dynamicErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub dynamic_error_message: Option, +} +impl MabJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "MAB workload-specific job task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MabJobTaskDetails { + #[doc = "The task display name."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Time elapsed for task."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "The status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl MabJobTaskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Mab container-specific backup policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MabProtectionPolicy { + #[serde(flatten)] + pub protection_policy: ProtectionPolicy, + #[doc = "Base class for backup schedule."] + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[doc = "Base class for retention policy."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +impl MabProtectionPolicy { + pub fn new(protection_policy: ProtectionPolicy) -> Self { + Self { + protection_policy, + schedule_policy: None, + retention_policy: None, + } + } +} +#[doc = "Monthly retention schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MonthlyRetentionSchedule { + #[doc = "Retention schedule format type for monthly retention policy."] + #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_format_type: Option, + #[doc = "Daily retention format."] + #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_daily: Option, + #[doc = "Weekly retention format."] + #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_weekly: Option, + #[doc = "Retention times of retention policy."] + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[doc = "Retention duration."] + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +impl MonthlyRetentionSchedule { + pub fn new() -> Self { + Self::default() + } +} +pub mod monthly_retention_schedule { + use super::*; + #[doc = "Retention schedule format type for monthly retention policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RetentionScheduleFormatType { + Invalid, + Daily, + Weekly, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MoveRpAcrossTiersRequest { + #[doc = "Gets the class type."] + #[serde(rename = "objectType", default, skip_serializing_if = "Option::is_none")] + pub object_type: Option, + #[doc = "Source tier from where RP needs to be moved"] + #[serde(rename = "sourceTierType", default, skip_serializing_if = "Option::is_none")] + pub source_tier_type: Option, + #[doc = "Target tier where RP needs to be moved"] + #[serde(rename = "targetTierType", default, skip_serializing_if = "Option::is_none")] + pub target_tier_type: Option, +} +impl MoveRpAcrossTiersRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod move_rp_across_tiers_request { + use super::*; + #[doc = "Source tier from where RP needs to be moved"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceTierType { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[doc = "Target tier where RP needs to be moved"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetTierType { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } +} +#[doc = "The name of usage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NameInfo { + #[doc = "Value of usage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Localized value of usage."] + #[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")] + pub localized_value: Option, +} +impl NameInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NewErrorResponse { + #[doc = "The error object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl NewErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod new_error_response { + use super::*; + #[doc = "The error object."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Error { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, + } + impl Error { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Operation result info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResultInfo { + #[serde(flatten)] + pub operation_result_info_base: OperationResultInfoBase, + #[doc = "List of jobs created by this operation."] + #[serde(rename = "jobList", default, skip_serializing_if = "Vec::is_empty")] + pub job_list: Vec, +} +impl OperationResultInfo { + pub fn new(operation_result_info_base: OperationResultInfoBase) -> Self { + Self { + operation_result_info_base, + job_list: Vec::new(), + } + } +} +#[doc = "Base class for operation result info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationResultInfoBase { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl OperationResultInfoBase { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Base class for operation result info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResultInfoBaseResource { + #[serde(flatten)] + pub operation_worker_response: OperationWorkerResponse, + #[doc = "Base class for operation result info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, +} +impl OperationResultInfoBaseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationStatus { + #[doc = "ID of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Operation start time. Format: ISO-8601."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Operation end time. Format: ISO-8601."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Error information associated with operation status call."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[doc = "Base class for additional information of operation status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_status { + use super::*; + #[doc = "Operation status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + InProgress, + Succeeded, + Failed, + Canceled, + } +} +#[doc = "Error information associated with operation status call."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationStatusError { + #[doc = "Error code of the operation failure."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message displayed if the operation failure."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl OperationStatusError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for additional information of operation status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusExtendedInfo { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl OperationStatusExtendedInfo { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Operation status job extended info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[doc = "ID of the job created for this protected item."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, +} +impl OperationStatusJobExtendedInfo { + pub fn new(operation_status_extended_info: OperationStatusExtendedInfo) -> Self { + Self { + operation_status_extended_info, + job_id: None, + } + } +} +#[doc = "Operation status extended info for list of jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusJobsExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[doc = "IDs of the jobs created for the protected item."] + #[serde(rename = "jobIds", default, skip_serializing_if = "Vec::is_empty")] + pub job_ids: Vec, + #[doc = "Stores all the failed jobs along with the corresponding error codes."] + #[serde(rename = "failedJobsError", default, skip_serializing_if = "Option::is_none")] + pub failed_jobs_error: Option, +} +impl OperationStatusJobsExtendedInfo { + pub fn new(operation_status_extended_info: OperationStatusExtendedInfo) -> Self { + Self { + operation_status_extended_info, + job_ids: Vec::new(), + failed_jobs_error: None, + } + } +} +#[doc = "Operation status extended info for ILR provision action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusProvisionIlrExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[doc = "Target details for file / folder restore."] + #[serde(rename = "recoveryTarget", default, skip_serializing_if = "Option::is_none")] + pub recovery_target: Option, +} +impl OperationStatusProvisionIlrExtendedInfo { + pub fn new(operation_status_extended_info: OperationStatusExtendedInfo) -> Self { + Self { + operation_status_extended_info, + recovery_target: None, + } + } +} +#[doc = "Operation status extended info for ValidateOperation action."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationStatusValidateOperationExtendedInfo { + #[serde(flatten)] + pub operation_status_extended_info: OperationStatusExtendedInfo, + #[doc = "Base class for validate operation response."] + #[serde(rename = "validateOperationResponse", default, skip_serializing_if = "Option::is_none")] + pub validate_operation_response: Option, +} +impl OperationStatusValidateOperationExtendedInfo { + pub fn new(operation_status_extended_info: OperationStatusExtendedInfo) -> Self { + Self { + operation_status_extended_info, + validate_operation_response: None, + } + } +} +#[doc = "This is the base class for operation result responses."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationWorkerResponse { + #[doc = "HTTP Status Code of the operation."] + #[serde(rename = "statusCode", default, skip_serializing_if = "Option::is_none")] + pub status_code: Option, + #[doc = "HTTP headers associated with this operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, +} +impl OperationWorkerResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_worker_response { + use super::*; + #[doc = "HTTP Status Code of the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum StatusCode { + Continue, + SwitchingProtocols, + #[serde(rename = "OK")] + Ok, + Created, + Accepted, + NonAuthoritativeInformation, + NoContent, + ResetContent, + PartialContent, + MultipleChoices, + Ambiguous, + MovedPermanently, + Moved, + Found, + Redirect, + SeeOther, + RedirectMethod, + NotModified, + UseProxy, + Unused, + TemporaryRedirect, + RedirectKeepVerb, + BadRequest, + Unauthorized, + PaymentRequired, + Forbidden, + NotFound, + MethodNotAllowed, + NotAcceptable, + ProxyAuthenticationRequired, + RequestTimeout, + Conflict, + Gone, + LengthRequired, + PreconditionFailed, + RequestEntityTooLarge, + RequestUriTooLong, + UnsupportedMediaType, + RequestedRangeNotSatisfiable, + ExpectationFailed, + UpgradeRequired, + InternalServerError, + NotImplemented, + BadGateway, + ServiceUnavailable, + GatewayTimeout, + HttpVersionNotSupported, + } +} +#[doc = "Provides details for log ranges"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PointInTimeRange { + #[doc = "Start time of the time range for log recovery."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "End time of the time range for log recovery."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +impl PointInTimeRange { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Pre-backup validation for Azure VM Workload provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PreBackupValidation { + #[doc = "Status of protectable item, i.e. InProgress,Succeeded,Failed"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Error code of protectable item"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Message corresponding to the error code for the protectable item"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl PreBackupValidation { + pub fn new() -> Self { + Self::default() + } +} +pub mod pre_backup_validation { + use super::*; + #[doc = "Status of protectable item, i.e. InProgress,Succeeded,Failed"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Success, + Failed, + } +} +#[doc = "Contract to validate if backup can be enabled on the given resource in a given vault and given configuration.\r\nIt will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PreValidateEnableBackupRequest { + #[doc = "ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc"] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "ARM Virtual Machine Id"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "ARM id of the Recovery Services Vault"] + #[serde(rename = "vaultId", default, skip_serializing_if = "Option::is_none")] + pub vault_id: Option, + #[doc = "Configuration of VM if any needs to be validated like OS type etc"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PreValidateEnableBackupRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod pre_validate_enable_backup_request { + use super::*; + #[doc = "ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResourceType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Response contract for enable backup validation request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PreValidateEnableBackupResponse { + #[doc = "Validation Status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Response error code"] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Response error message"] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Recommended action for user"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recommendation: Option, + #[doc = "Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;rgname;vmname. This is required\r\nfor portal"] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Specifies the product specific ds name. E.g. vm;iaasvmcontainer;rgname;vmname. This is required for portal"] + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, +} +impl PreValidateEnableBackupResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod pre_validate_enable_backup_response { + use super::*; + #[doc = "Validation Status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Succeeded, + Failed, + } +} +#[doc = "Prepare DataMove Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrepareDataMoveRequest { + #[doc = "ARM Id of target vault"] + #[serde(rename = "targetResourceId")] + pub target_resource_id: String, + #[doc = "Target Region"] + #[serde(rename = "targetRegion")] + pub target_region: String, + #[doc = "DataMove Level"] + #[serde(rename = "dataMoveLevel")] + pub data_move_level: prepare_data_move_request::DataMoveLevel, + #[doc = "Source Container ArmIds\r\nThis needs to be populated only if DataMoveLevel is set to container"] + #[serde(rename = "sourceContainerArmIds", default, skip_serializing_if = "Vec::is_empty")] + pub source_container_arm_ids: Vec, + #[doc = "Ignore the artifacts which are already moved."] + #[serde(rename = "ignoreMoved", default, skip_serializing_if = "Option::is_none")] + pub ignore_moved: Option, +} +impl PrepareDataMoveRequest { + pub fn new(target_resource_id: String, target_region: String, data_move_level: prepare_data_move_request::DataMoveLevel) -> Self { + Self { + target_resource_id, + target_region, + data_move_level, + source_container_arm_ids: Vec::new(), + ignore_moved: None, + } + } +} +pub mod prepare_data_move_request { + use super::*; + #[doc = "DataMove Level"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataMoveLevel { + Invalid, + Vault, + Container, + } +} +#[doc = "Prepare DataMove Response"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrepareDataMoveResponse { + #[serde(flatten)] + pub vault_storage_config_operation_result_response: VaultStorageConfigOperationResultResponse, + #[doc = "Co-relationId for move operation"] + #[serde(rename = "correlationId", default, skip_serializing_if = "Option::is_none")] + pub correlation_id: Option, + #[doc = "Source Vault Properties"] + #[serde(rename = "sourceVaultProperties", default, skip_serializing_if = "Option::is_none")] + pub source_vault_properties: Option, +} +impl PrepareDataMoveResponse { + pub fn new(vault_storage_config_operation_result_response: VaultStorageConfigOperationResultResponse) -> Self { + Self { + vault_storage_config_operation_result_response, + correlation_id: None, + source_vault_properties: None, + } + } +} +#[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "Gets or sets id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Endpoint Connection Response Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[doc = "Gets or sets provisioning state of the private endpoint connection"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The Private Endpoint network resource that is linked to the Private Endpoint connection"] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "Private Link Service Connection State"] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_endpoint_connection { + use super::*; + #[doc = "Gets or sets provisioning state of the private endpoint connection"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Succeeded, + Deleting, + Failed, + Pending, + } +} +#[doc = "Private Endpoint Connection Response Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Private Endpoint Connection Response Properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnectionResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Private Link Service Connection State"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "Gets or sets the status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Gets or sets description"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Gets or sets actions required"] + #[serde(rename = "actionRequired", default, skip_serializing_if = "Option::is_none")] + pub action_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_link_service_connection_state { + use super::*; + #[doc = "Gets or sets the status"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[doc = "Protectable Container Class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectableContainer { + #[doc = "Friendly name of the container."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Type of backup management for the container."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of the container. The value of this property for\r\n1. Compute Azure VM is Microsoft.Compute/virtualMachines\r\n2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines"] + #[serde(rename = "protectableContainerType")] + pub protectable_container_type: protectable_container::ProtectableContainerType, + #[doc = "Status of health of the container."] + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[doc = "Fabric Id of the container such as ARM Id."] + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, +} +impl ProtectableContainer { + pub fn new(protectable_container_type: protectable_container::ProtectableContainerType) -> Self { + Self { + friendly_name: None, + backup_management_type: None, + protectable_container_type, + health_status: None, + container_id: None, + } + } +} +pub mod protectable_container { + use super::*; + #[doc = "Type of backup management for the container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of the container. The value of this property for\r\n1. Compute Azure VM is Microsoft.Compute/virtualMachines\r\n2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectableContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + #[serde(rename = "Microsoft.ClassicCompute/virtualMachines")] + MicrosoftClassicComputeVirtualMachines, + #[serde(rename = "Microsoft.Compute/virtualMachines")] + MicrosoftComputeVirtualMachines, + AzureWorkloadContainer, + } +} +#[doc = "Protectable Container Class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableContainerResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Protectable Container Class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectableContainerResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ProtectableContainer resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableContainerResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ProtectableContainerResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectedItem { + #[doc = "backup item type."] + #[serde(rename = "protectedItemType")] + pub protected_item_type: String, + #[doc = "Type of backup management for the backed up item."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of workload this item represents."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Unique name of container"] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "ARM ID of the resource to be backed up."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "ID of the backup policy with which this item is backed up."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Timestamp when the last (latest) backup copy was created for this backup item."] + #[serde(rename = "lastRecoveryPoint", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point: Option, + #[doc = "Name of the backup set the backup item belongs to"] + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, + #[doc = "Create mode to indicate recovery of existing soft deleted data source or creation of new data source."] + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[doc = "Time for deferred deletion in UTC"] + #[serde(rename = "deferredDeleteTimeInUTC", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_in_utc: Option, + #[doc = "Flag to identify whether the DS is scheduled for deferred delete"] + #[serde(rename = "isScheduledForDeferredDelete", default, skip_serializing_if = "Option::is_none")] + pub is_scheduled_for_deferred_delete: Option, + #[doc = "Time remaining before the DS marked for deferred delete is permanently deleted"] + #[serde(rename = "deferredDeleteTimeRemaining", default, skip_serializing_if = "Option::is_none")] + pub deferred_delete_time_remaining: Option, + #[doc = "Flag to identify whether the deferred deleted DS is to be purged soon"] + #[serde(rename = "isDeferredDeleteScheduleUpcoming", default, skip_serializing_if = "Option::is_none")] + pub is_deferred_delete_schedule_upcoming: Option, + #[doc = "Flag to identify that deferred deleted DS is to be moved into Pause state"] + #[serde(rename = "isRehydrate", default, skip_serializing_if = "Option::is_none")] + pub is_rehydrate: Option, + #[doc = "ResourceGuardOperationRequests on which LAC check will be performed"] + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[doc = "Flag to identify whether datasource is protected in archive"] + #[serde(rename = "isArchiveEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_archive_enabled: Option, + #[doc = "Name of the policy used for protection"] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, +} +impl ProtectedItem { + pub fn new(protected_item_type: String) -> Self { + Self { + protected_item_type, + backup_management_type: None, + workload_type: None, + container_name: None, + source_resource_id: None, + policy_id: None, + last_recovery_point: None, + backup_set_name: None, + create_mode: None, + deferred_delete_time_in_utc: None, + is_scheduled_for_deferred_delete: None, + deferred_delete_time_remaining: None, + is_deferred_delete_schedule_upcoming: None, + is_rehydrate: None, + resource_guard_operation_requests: Vec::new(), + is_archive_enabled: None, + policy_name: None, + } + } +} +pub mod protected_item { + use super::*; + #[doc = "Type of backup management for the backed up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of workload this item represents."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } + #[doc = "Create mode to indicate recovery of existing soft deleted data source or creation of new data source."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateMode { + Invalid, + Default, + Recover, + } +} +#[doc = "Filters to list backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectedItemQueryObject { + #[doc = "Health State for the backed up item."] + #[serde(rename = "healthState", default, skip_serializing_if = "Option::is_none")] + pub health_state: Option, + #[doc = "Backup management type for the backed up item."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of workload this item represents."] + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[doc = "Backup policy name associated with the backup item."] + #[serde(rename = "policyName", default, skip_serializing_if = "Option::is_none")] + pub policy_name: Option, + #[doc = "Name of the container."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "Backup Engine name"] + #[serde(rename = "backupEngineName", default, skip_serializing_if = "Option::is_none")] + pub backup_engine_name: Option, + #[doc = "Friendly name of protected item"] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Name of the fabric."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "Name of the backup set."] + #[serde(rename = "backupSetName", default, skip_serializing_if = "Option::is_none")] + pub backup_set_name: Option, +} +impl ProtectedItemQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod protected_item_query_object { + use super::*; + #[doc = "Health State for the backed up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HealthState { + Passed, + ActionRequired, + ActionSuggested, + Invalid, + } + #[doc = "Backup management type for the backed up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of workload this item represents."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Base class for backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectedItemResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup items."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectedItemResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ProtectedItem resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectedItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ProtectedItemResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for container with backup items. Containers with specific workloads are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainer { + #[doc = "Friendly name of the container."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Type of backup management for the container."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Status of registration of the container with the Recovery Services Vault."] + #[serde(rename = "registrationStatus", default, skip_serializing_if = "Option::is_none")] + pub registration_status: Option, + #[doc = "Status of health of the container."] + #[serde(rename = "healthStatus", default, skip_serializing_if = "Option::is_none")] + pub health_status: Option, + #[doc = "Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2.\r\nClassic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is\r\nWindows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload\r\nBackup is VMAppContainer"] + #[serde(rename = "containerType")] + pub container_type: protection_container::ContainerType, + #[doc = "Type of the protectable object associated with this container"] + #[serde(rename = "protectableObjectType", default, skip_serializing_if = "Option::is_none")] + pub protectable_object_type: Option, +} +impl ProtectionContainer { + pub fn new(container_type: protection_container::ContainerType) -> Self { + Self { + friendly_name: None, + backup_management_type: None, + registration_status: None, + health_status: None, + container_type, + protectable_object_type: None, + } + } +} +pub mod protection_container { + use super::*; + #[doc = "Type of backup management for the container."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of the container. The value of this property for: 1. Compute Azure VM is Microsoft.Compute/virtualMachines 2.\r\nClassic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is\r\nWindows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload\r\nBackup is VMAppContainer"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ContainerType { + Invalid, + Unknown, + #[serde(rename = "IaasVMContainer")] + IaasVmContainer, + #[serde(rename = "IaasVMServiceContainer")] + IaasVmServiceContainer, + #[serde(rename = "DPMContainer")] + DpmContainer, + AzureBackupServerContainer, + #[serde(rename = "MABContainer")] + MabContainer, + Cluster, + AzureSqlContainer, + Windows, + VCenter, + #[serde(rename = "VMAppContainer")] + VmAppContainer, + #[serde(rename = "SQLAGWorkLoadContainer")] + SqlagWorkLoadContainer, + StorageContainer, + GenericContainer, + #[serde(rename = "Microsoft.ClassicCompute/virtualMachines")] + MicrosoftClassicComputeVirtualMachines, + #[serde(rename = "Microsoft.Compute/virtualMachines")] + MicrosoftComputeVirtualMachines, + AzureWorkloadContainer, + } +} +#[doc = "Base class for container with backup items. Containers with specific workloads are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for container with backup items. Containers with specific workloads are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectionContainerResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ProtectionContainer resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ProtectionContainerResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup ProtectionIntent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionIntent { + #[doc = "backup protectionIntent type."] + #[serde(rename = "protectionIntentItemType")] + pub protection_intent_item_type: protection_intent::ProtectionIntentItemType, + #[doc = "Type of backup management for the backed up item."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "ARM ID of the resource to be backed up."] + #[serde(rename = "sourceResourceId", default, skip_serializing_if = "Option::is_none")] + pub source_resource_id: Option, + #[doc = "ID of the item which is getting protected, In case of Azure Vm , it is ProtectedItemId"] + #[serde(rename = "itemId", default, skip_serializing_if = "Option::is_none")] + pub item_id: Option, + #[doc = "ID of the backup policy with which this item is backed up."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Backup state of this backup item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +impl ProtectionIntent { + pub fn new(protection_intent_item_type: protection_intent::ProtectionIntentItemType) -> Self { + Self { + protection_intent_item_type, + backup_management_type: None, + source_resource_id: None, + item_id: None, + policy_id: None, + protection_state: None, + } + } +} +pub mod protection_intent { + use super::*; + #[doc = "backup protectionIntent type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionIntentItemType { + Invalid, + AzureResourceItem, + RecoveryServiceVaultItem, + AzureWorkloadContainerAutoProtectionIntent, + AzureWorkloadAutoProtectionIntent, + #[serde(rename = "AzureWorkloadSQLAutoProtectionIntent")] + AzureWorkloadSqlAutoProtectionIntent, + } + #[doc = "Type of backup management for the backed up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Backup state of this backup item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[doc = "Filters to list protection intent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionIntentQueryObject { + #[doc = "Backup management type for the backed up item"] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of workload this item represents"] + #[serde(rename = "itemType", default, skip_serializing_if = "Option::is_none")] + pub item_type: Option, + #[doc = "Parent name of the intent"] + #[serde(rename = "parentName", default, skip_serializing_if = "Option::is_none")] + pub parent_name: Option, + #[doc = "Item name of the intent"] + #[serde(rename = "itemName", default, skip_serializing_if = "Option::is_none")] + pub item_name: Option, +} +impl ProtectionIntentQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod protection_intent_query_object { + use super::*; + #[doc = "Backup management type for the backed up item"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Type of workload this item represents"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ItemType { + Invalid, + #[serde(rename = "SQLInstance")] + SqlInstance, + #[serde(rename = "SQLAvailabilityGroupContainer")] + SqlAvailabilityGroupContainer, + } +} +#[doc = "Base class for backup ProtectionIntent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionIntentResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup ProtectionIntent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectionIntentResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ProtectionIntent resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionIntentResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ProtectionIntentResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup policy. Workload-specific backup policies are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionPolicy { + #[doc = "Number of items associated with this policy."] + #[serde(rename = "protectedItemsCount", default, skip_serializing_if = "Option::is_none")] + pub protected_items_count: Option, + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "backupManagementType")] + pub backup_management_type: String, + #[doc = "ResourceGuard Operation Requests"] + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +impl ProtectionPolicy { + pub fn new(backup_management_type: String) -> Self { + Self { + protected_items_count: None, + backup_management_type, + resource_guard_operation_requests: Vec::new(), + } + } +} +#[doc = "Filters the list backup policies API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionPolicyQueryObject { + #[doc = "Backup management type for the backup policy."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Fabric name for filter"] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "Workload type for the backup policy."] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, +} +impl ProtectionPolicyQueryObject { + pub fn new() -> Self { + Self::default() + } +} +pub mod protection_policy_query_object { + use super::*; + #[doc = "Backup management type for the backup policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BackupManagementType { + Invalid, + #[serde(rename = "AzureIaasVM")] + AzureIaasVm, + #[serde(rename = "MAB")] + Mab, + #[serde(rename = "DPM")] + Dpm, + AzureBackupServer, + AzureSql, + AzureStorage, + AzureWorkload, + DefaultBackup, + } + #[doc = "Workload type for the backup policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WorkloadType { + Invalid, + #[serde(rename = "VM")] + Vm, + FileFolder, + AzureSqlDb, + #[serde(rename = "SQLDB")] + Sqldb, + Exchange, + Sharepoint, + #[serde(rename = "VMwareVM")] + VMwareVm, + SystemState, + Client, + GenericDataSource, + #[serde(rename = "SQLDataBase")] + SqlDataBase, + AzureFileShare, + #[serde(rename = "SAPHanaDatabase")] + SapHanaDatabase, + #[serde(rename = "SAPAseDatabase")] + SapAseDatabase, + } +} +#[doc = "Base class for backup policy. Workload-specific backup policies are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionPolicyResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup policy. Workload-specific backup policies are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectionPolicyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ProtectionPolicy resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionPolicyResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ProtectionPolicyResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup copies. Workload-specific backup copies are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPoint { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl RecoveryPoint { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Disk configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointDiskConfiguration { + #[doc = "Number of disks included in backup"] + #[serde(rename = "numberOfDisksIncludedInBackup", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_included_in_backup: Option, + #[doc = "Number of disks attached to the VM"] + #[serde(rename = "numberOfDisksAttachedToVm", default, skip_serializing_if = "Option::is_none")] + pub number_of_disks_attached_to_vm: Option, + #[doc = "Information of disks included in backup"] + #[serde(rename = "includedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub included_disk_list: Vec, + #[doc = "Information of disks excluded from backup"] + #[serde(rename = "excludedDiskList", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_disk_list: Vec, +} +impl RecoveryPointDiskConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointMoveReadinessInfo { + #[serde(rename = "isReadyForMove", default, skip_serializing_if = "Option::is_none")] + pub is_ready_for_move: Option, + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Option::is_none")] + pub additional_info: Option, +} +impl RecoveryPointMoveReadinessInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "RP Rehydration Info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointRehydrationInfo { + #[doc = "How long the rehydrated RP should be kept\r\nShould be ISO8601 Duration format e.g. \"P7D\""] + #[serde(rename = "rehydrationRetentionDuration", default, skip_serializing_if = "Option::is_none")] + pub rehydration_retention_duration: Option, + #[doc = "Rehydration Priority"] + #[serde(rename = "rehydrationPriority", default, skip_serializing_if = "Option::is_none")] + pub rehydration_priority: Option, +} +impl RecoveryPointRehydrationInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod recovery_point_rehydration_info { + use super::*; + #[doc = "Rehydration Priority"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RehydrationPriority { + Standard, + High, + } +} +#[doc = "Base class for backup copies. Workload-specific backup copies are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup copies. Workload-specific backup copies are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecoveryPointResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of RecoveryPoint resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl RecoveryPointResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery point tier information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointTierInformation { + #[doc = "Recovery point tier type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Recovery point tier status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Recovery point tier status."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl RecoveryPointTierInformation { + pub fn new() -> Self { + Self::default() + } +} +pub mod recovery_point_tier_information { + use super::*; + #[doc = "Recovery point tier type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[doc = "Recovery point tier status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[doc = "RecoveryPoint Tier Information V2"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointTierInformationV2 { + #[serde(flatten)] + pub recovery_point_tier_information: RecoveryPointTierInformation, + #[doc = "Recovery point tier type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Recovery point tier status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl RecoveryPointTierInformationV2 { + pub fn new() -> Self { + Self::default() + } +} +pub mod recovery_point_tier_information_v2 { + use super::*; + #[doc = "Recovery point tier type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + #[serde(rename = "InstantRP")] + InstantRp, + #[serde(rename = "HardenedRP")] + HardenedRp, + #[serde(rename = "ArchivedRP")] + ArchivedRp, + } + #[doc = "Recovery point tier status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Invalid, + Valid, + Disabled, + Deleted, + Rehydrated, + } +} +#[doc = "ARM Resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource Id represents the complete path to the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name associated with the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/..."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Optional ETag."] + #[serde(rename = "eTag", default, skip_serializing_if = "Option::is_none")] + pub e_tag: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardOperationDetail { + #[serde(rename = "vaultCriticalOperation", default, skip_serializing_if = "Option::is_none")] + pub vault_critical_operation: Option, + #[serde(rename = "defaultResourceRequest", default, skip_serializing_if = "Option::is_none")] + pub default_resource_request: Option, +} +impl ResourceGuardOperationDetail { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardProxyBase { + #[serde(rename = "resourceGuardResourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_guard_resource_id: Option, + #[serde(rename = "resourceGuardOperationDetails", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_details: Vec, + #[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_updated_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ResourceGuardProxyBase { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardProxyBaseResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResourceGuardProxyBaseResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of ResourceGuardProxyBase resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceGuardProxyBaseResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ResourceGuardProxyBaseResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Health Details for backup items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceHealthDetails { + #[doc = "Health Code"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Health Title"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[doc = "Health Message"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Health Recommended Actions"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl ResourceHealthDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base for all lists of resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceList { + #[doc = "The uri to fetch the next page of resources. Call ListNext() fetches next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Restore file specs like file path, type and target folder path info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestoreFileSpecs { + #[doc = "Source File/Folder path"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Indicates what the Path variable stands for"] + #[serde(rename = "fileSpecType", default, skip_serializing_if = "Option::is_none")] + pub file_spec_type: Option, + #[doc = "Destination folder path in target FileShare"] + #[serde(rename = "targetFolderPath", default, skip_serializing_if = "Option::is_none")] + pub target_folder_path: Option, +} +impl RestoreFileSpecs { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for restore request. Workload-specific restore requests are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestoreRequest { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl RestoreRequest { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Base class for restore request. Workload-specific restore requests are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestoreRequestResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for restore request. Workload-specific restore requests are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RestoreRequestResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Retention duration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RetentionDuration { + #[doc = "Count of duration types. Retention duration is obtained by the counting the duration type Count times.\r\nFor example, when Count = 3 and DurationType = Weeks, retention duration will be three weeks."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Retention duration type of retention policy."] + #[serde(rename = "durationType", default, skip_serializing_if = "Option::is_none")] + pub duration_type: Option, +} +impl RetentionDuration { + pub fn new() -> Self { + Self::default() + } +} +pub mod retention_duration { + use super::*; + #[doc = "Retention duration type of retention policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DurationType { + Invalid, + Days, + Weeks, + Months, + Years, + } +} +#[doc = "Base class for retention policy."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RetentionPolicy { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "retentionPolicyType")] + pub retention_policy_type: String, +} +impl RetentionPolicy { + pub fn new(retention_policy_type: String) -> Self { + Self { retention_policy_type } + } +} +#[doc = "SQLDataDirectory info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDataDirectory { + #[doc = "Type of data directory mapping"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "File path"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Logical name of the file"] + #[serde(rename = "logicalName", default, skip_serializing_if = "Option::is_none")] + pub logical_name: Option, +} +impl SqlDataDirectory { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_data_directory { + use super::*; + #[doc = "Type of data directory mapping"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Invalid, + Data, + Log, + } +} +#[doc = "Encapsulates information regarding data directory"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlDataDirectoryMapping { + #[doc = "Type of data directory mapping"] + #[serde(rename = "mappingType", default, skip_serializing_if = "Option::is_none")] + pub mapping_type: Option, + #[doc = "Restore source logical name path"] + #[serde(rename = "sourceLogicalName", default, skip_serializing_if = "Option::is_none")] + pub source_logical_name: Option, + #[doc = "Restore source path"] + #[serde(rename = "sourcePath", default, skip_serializing_if = "Option::is_none")] + pub source_path: Option, + #[doc = "Target path"] + #[serde(rename = "targetPath", default, skip_serializing_if = "Option::is_none")] + pub target_path: Option, +} +impl SqlDataDirectoryMapping { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_data_directory_mapping { + use super::*; + #[doc = "Type of data directory mapping"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MappingType { + Invalid, + Data, + Log, + } +} +#[doc = "Base class for backup schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SchedulePolicy { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "schedulePolicyType")] + pub schedule_policy_type: String, +} +impl SchedulePolicy { + pub fn new(schedule_policy_type: String) -> Self { + Self { schedule_policy_type } + } +} +#[doc = "Base class for get security pin request body"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecurityPinBase { + #[doc = "ResourceGuard Operation Requests"] + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, +} +impl SecurityPinBase { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common settings field for backup management"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Settings { + #[doc = "TimeZone optional input as string. For example: TimeZone = \"Pacific Standard Time\"."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[doc = "SQL compression flag"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issqlcompression: Option, + #[doc = "Workload compression flag. This has been added so that 'isSqlCompression'\r\nwill be deprecated once clients upgrade to consider this flag."] + #[serde(rename = "isCompression", default, skip_serializing_if = "Option::is_none")] + pub is_compression: Option, +} +impl Settings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Simple policy retention."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimpleRetentionPolicy { + #[serde(flatten)] + pub retention_policy: RetentionPolicy, + #[doc = "Retention duration."] + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +impl SimpleRetentionPolicy { + pub fn new(retention_policy: RetentionPolicy) -> Self { + Self { + retention_policy, + retention_duration: None, + } + } +} +#[doc = "Simple policy schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimpleSchedulePolicy { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, + #[doc = "Frequency of the schedule operation of this policy."] + #[serde(rename = "scheduleRunFrequency", default, skip_serializing_if = "Option::is_none")] + pub schedule_run_frequency: Option, + #[doc = "List of days of week this schedule has to be run."] + #[serde(rename = "scheduleRunDays", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_days: Vec, + #[doc = "List of times of day this schedule has to be run."] + #[serde(rename = "scheduleRunTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_times: Vec, + #[serde(rename = "hourlySchedule", default, skip_serializing_if = "Option::is_none")] + pub hourly_schedule: Option, + #[doc = "At every number weeks this schedule has to be run."] + #[serde(rename = "scheduleWeeklyFrequency", default, skip_serializing_if = "Option::is_none")] + pub schedule_weekly_frequency: Option, +} +impl SimpleSchedulePolicy { + pub fn new(schedule_policy: SchedulePolicy) -> Self { + Self { + schedule_policy, + schedule_run_frequency: None, + schedule_run_days: Vec::new(), + schedule_run_times: Vec::new(), + hourly_schedule: None, + schedule_weekly_frequency: None, + } + } +} +pub mod simple_schedule_policy { + use super::*; + #[doc = "Frequency of the schedule operation of this policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScheduleRunFrequency { + Invalid, + Daily, + Weekly, + Hourly, + } +} +#[doc = "The V2 policy schedule for IaaS that supports hourly backups."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SimpleSchedulePolicyV2 { + #[serde(flatten)] + pub schedule_policy: SchedulePolicy, + #[doc = "Frequency of the schedule operation of this policy."] + #[serde(rename = "scheduleRunFrequency", default, skip_serializing_if = "Option::is_none")] + pub schedule_run_frequency: Option, + #[serde(rename = "hourlySchedule", default, skip_serializing_if = "Option::is_none")] + pub hourly_schedule: Option, + #[serde(rename = "dailySchedule", default, skip_serializing_if = "Option::is_none")] + pub daily_schedule: Option, + #[serde(rename = "weeklySchedule", default, skip_serializing_if = "Option::is_none")] + pub weekly_schedule: Option, +} +impl SimpleSchedulePolicyV2 { + pub fn new(schedule_policy: SchedulePolicy) -> Self { + Self { + schedule_policy, + schedule_run_frequency: None, + hourly_schedule: None, + daily_schedule: None, + weekly_schedule: None, + } + } +} +pub mod simple_schedule_policy_v2 { + use super::*; + #[doc = "Frequency of the schedule operation of this policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScheduleRunFrequency { + Invalid, + Daily, + Weekly, + Hourly, + } +} +#[doc = "Sub-protection policy which includes schedule and retention"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubProtectionPolicy { + #[doc = "Type of backup policy type"] + #[serde(rename = "policyType", default, skip_serializing_if = "Option::is_none")] + pub policy_type: Option, + #[doc = "Base class for backup schedule."] + #[serde(rename = "schedulePolicy", default, skip_serializing_if = "Option::is_none")] + pub schedule_policy: Option, + #[doc = "Base class for retention policy."] + #[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")] + pub retention_policy: Option, +} +impl SubProtectionPolicy { + pub fn new() -> Self { + Self::default() + } +} +pub mod sub_protection_policy { + use super::*; + #[doc = "Type of backup policy type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PolicyType { + Invalid, + Full, + Differential, + Log, + CopyOnlyFull, + Incremental, + } +} +#[doc = "Target Azure File Share Info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetAfsRestoreInfo { + #[doc = "File share name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Target file share resource ARM ID"] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, +} +impl TargetAfsRestoreInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details about target workload during restore operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetRestoreInfo { + #[doc = "Can Overwrite if Target DataBase already exists"] + #[serde(rename = "overwriteOption", default, skip_serializing_if = "Option::is_none")] + pub overwrite_option: Option, + #[doc = "Resource Id name of the container in which Target DataBase resides"] + #[serde(rename = "containerId", default, skip_serializing_if = "Option::is_none")] + pub container_id: Option, + #[doc = "Database name InstanceName/DataBaseName for SQL or System/DbName for SAP Hana"] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[doc = "Target directory location for restore as files."] + #[serde(rename = "targetDirectoryForFileRestore", default, skip_serializing_if = "Option::is_none")] + pub target_directory_for_file_restore: Option, +} +impl TargetRestoreInfo { + pub fn new() -> Self { + Self::default() + } +} +pub mod target_restore_info { + use super::*; + #[doc = "Can Overwrite if Target DataBase already exists"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OverwriteOption { + Invalid, + FailOnConflict, + Overwrite, + } +} +#[doc = "The token information details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TokenInformation { + #[doc = "Token value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub token: Option, + #[doc = "Expiry time of token."] + #[serde(rename = "expiryTimeInUtcTicks", default, skip_serializing_if = "Option::is_none")] + pub expiry_time_in_utc_ticks: Option, + #[doc = "Security PIN"] + #[serde(rename = "securityPIN", default, skip_serializing_if = "Option::is_none")] + pub security_pin: Option, +} +impl TokenInformation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trigger DataMove Request"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerDataMoveRequest { + #[doc = "ARM Id of source vault"] + #[serde(rename = "sourceResourceId")] + pub source_resource_id: String, + #[doc = "Source Region"] + #[serde(rename = "sourceRegion")] + pub source_region: String, + #[doc = "DataMove Level"] + #[serde(rename = "dataMoveLevel")] + pub data_move_level: trigger_data_move_request::DataMoveLevel, + #[doc = "Correlation Id"] + #[serde(rename = "correlationId")] + pub correlation_id: String, + #[doc = "Source Container ArmIds"] + #[serde(rename = "sourceContainerArmIds", default, skip_serializing_if = "Vec::is_empty")] + pub source_container_arm_ids: Vec, + #[doc = "Pause GC"] + #[serde(rename = "pauseGC", default, skip_serializing_if = "Option::is_none")] + pub pause_gc: Option, +} +impl TriggerDataMoveRequest { + pub fn new( + source_resource_id: String, + source_region: String, + data_move_level: trigger_data_move_request::DataMoveLevel, + correlation_id: String, + ) -> Self { + Self { + source_resource_id, + source_region, + data_move_level, + correlation_id, + source_container_arm_ids: Vec::new(), + pause_gc: None, + } + } +} +pub mod trigger_data_move_request { + use super::*; + #[doc = "DataMove Level"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataMoveLevel { + Invalid, + Vault, + Container, + } +} +#[doc = "Request body of unlock delete API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnlockDeleteRequest { + #[serde(rename = "resourceGuardOperationRequests", default, skip_serializing_if = "Vec::is_empty")] + pub resource_guard_operation_requests: Vec, + #[serde(rename = "resourceToBeDeleted", default, skip_serializing_if = "Option::is_none")] + pub resource_to_be_deleted: Option, +} +impl UnlockDeleteRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response of Unlock Delete API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnlockDeleteResponse { + #[doc = "This is the time when unlock delete privileges will get expired."] + #[serde(rename = "unlockDeleteExpiryTime", default, skip_serializing_if = "Option::is_none")] + pub unlock_delete_expiry_time: Option, +} +impl UnlockDeleteResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureRestoreValidation request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateIaasVmRestoreOperationRequest { + #[serde(flatten)] + pub validate_restore_operation_request: ValidateRestoreOperationRequest, +} +impl ValidateIaasVmRestoreOperationRequest { + pub fn new(validate_restore_operation_request: ValidateRestoreOperationRequest) -> Self { + Self { + validate_restore_operation_request, + } + } +} +#[doc = "Base class for validate operation request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateOperationRequest { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl ValidateOperationRequest { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Base class for validate operation response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidateOperationResponse { + #[doc = "Gets the validation result"] + #[serde(rename = "validationResults", default, skip_serializing_if = "Vec::is_empty")] + pub validation_results: Vec, +} +impl ValidateOperationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidateOperationsResponse { + #[doc = "Base class for validate operation response."] + #[serde(rename = "validateOperationResponse", default, skip_serializing_if = "Option::is_none")] + pub validate_operation_response: Option, +} +impl ValidateOperationsResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AzureRestoreValidation request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidateRestoreOperationRequest { + #[serde(flatten)] + pub validate_operation_request: ValidateOperationRequest, + #[doc = "Base class for restore request. Workload-specific restore requests are derived from this class."] + #[serde(rename = "restoreRequest", default, skip_serializing_if = "Option::is_none")] + pub restore_request: Option, +} +impl ValidateRestoreOperationRequest { + pub fn new(validate_operation_request: ValidateOperationRequest) -> Self { + Self { + validate_operation_request, + restore_request: None, + } + } +} +#[doc = "Vault level Job"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultJob { + #[serde(flatten)] + pub job: Job, + #[doc = "Time elapsed during the execution of this job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub duration: Option, + #[doc = "Gets or sets the state/actions applicable on this job like cancel/retry."] + #[serde(rename = "actionsInfo", default, skip_serializing_if = "Vec::is_empty")] + pub actions_info: Vec, + #[doc = "Error details on execution of this job."] + #[serde(rename = "errorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub error_details: Vec, + #[doc = "Vault Job for CMK - has CMK specific info."] + #[serde(rename = "extendedInfo", default, skip_serializing_if = "Option::is_none")] + pub extended_info: Option, +} +impl VaultJob { + pub fn new(job: Job) -> Self { + Self { + job, + duration: None, + actions_info: Vec::new(), + error_details: Vec::new(), + extended_info: None, + } + } +} +#[doc = "Vault Job specific error information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultJobErrorInfo { + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Localized error string."] + #[serde(rename = "errorString", default, skip_serializing_if = "Option::is_none")] + pub error_string: Option, + #[doc = "List of localized recommendations for above error code."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub recommendations: Vec, +} +impl VaultJobErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault Job for CMK - has CMK specific info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultJobExtendedInfo { + #[doc = "Job properties."] + #[serde(rename = "propertyBag", default, skip_serializing_if = "Option::is_none")] + pub property_bag: Option, +} +impl VaultJobExtendedInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation result response for Vault Storage Config"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultStorageConfigOperationResultResponse { + #[doc = "This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types."] + #[serde(rename = "objectType")] + pub object_type: String, +} +impl VaultStorageConfigOperationResultResponse { + pub fn new(object_type: String) -> Self { + Self { object_type } + } +} +#[doc = "Weekly retention format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WeeklyRetentionFormat { + #[doc = "List of days of the week."] + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[doc = "List of weeks of month."] + #[serde(rename = "weeksOfTheMonth", default, skip_serializing_if = "Vec::is_empty")] + pub weeks_of_the_month: Vec, +} +impl WeeklyRetentionFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Weekly retention schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WeeklyRetentionSchedule { + #[doc = "List of days of week for weekly retention policy."] + #[serde(rename = "daysOfTheWeek", default, skip_serializing_if = "Vec::is_empty")] + pub days_of_the_week: Vec, + #[doc = "Retention times of retention policy."] + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[doc = "Retention duration."] + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +impl WeeklyRetentionSchedule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WeeklySchedule { + #[serde(rename = "scheduleRunDays", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_days: Vec, + #[doc = "List of times of day this schedule has to be run."] + #[serde(rename = "scheduleRunTimes", default, skip_serializing_if = "Vec::is_empty")] + pub schedule_run_times: Vec, +} +impl WeeklySchedule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of an inquired protectable item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkloadInquiryDetails { + #[doc = "Type of the Workload such as SQL, Oracle etc."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Contains the protectable item Count inside this Container."] + #[serde(rename = "itemCount", default, skip_serializing_if = "Option::is_none")] + pub item_count: Option, + #[doc = "Validation for inquired protectable items under a given container."] + #[serde(rename = "inquiryValidation", default, skip_serializing_if = "Option::is_none")] + pub inquiry_validation: Option, +} +impl WorkloadInquiryDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadItem { + #[doc = "Type of backup management to backup an item."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of workload for the backup management"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Type of the backup item."] + #[serde(rename = "workloadItemType")] + pub workload_item_type: String, + #[doc = "Friendly name of the backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "State of the back up item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +impl WorkloadItem { + pub fn new(workload_item_type: String) -> Self { + Self { + backup_management_type: None, + workload_type: None, + workload_item_type, + friendly_name: None, + protection_state: None, + } + } +} +pub mod workload_item { + use super::*; + #[doc = "State of the back up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkloadItemResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl WorkloadItemResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of WorkloadItem resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkloadItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl WorkloadItemResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkloadProtectableItem { + #[doc = "Type of backup management to backup an item."] + #[serde(rename = "backupManagementType", default, skip_serializing_if = "Option::is_none")] + pub backup_management_type: Option, + #[doc = "Type of workload for the backup management"] + #[serde(rename = "workloadType", default, skip_serializing_if = "Option::is_none")] + pub workload_type: Option, + #[doc = "Type of the backup item."] + #[serde(rename = "protectableItemType")] + pub protectable_item_type: String, + #[doc = "Friendly name of the backup item."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "State of the back up item."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, +} +impl WorkloadProtectableItem { + pub fn new(protectable_item_type: String) -> Self { + Self { + backup_management_type: None, + workload_type: None, + protectable_item_type, + friendly_name: None, + protection_state: None, + } + } +} +pub mod workload_protectable_item { + use super::*; + #[doc = "State of the back up item."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProtectionState { + Invalid, + NotProtected, + Protecting, + Protected, + ProtectionFailed, + } +} +#[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkloadProtectableItemResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Base class for backup item. Workload-specific backup items are derived from this class."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl WorkloadProtectableItemResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of WorkloadProtectableItem resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkloadProtectableItemResourceList { + #[serde(flatten)] + pub resource_list: ResourceList, + #[doc = "List of resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl WorkloadProtectableItemResourceList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Yearly retention schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct YearlyRetentionSchedule { + #[doc = "Retention schedule format for yearly retention policy."] + #[serde(rename = "retentionScheduleFormatType", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_format_type: Option, + #[doc = "List of months of year of yearly retention policy."] + #[serde(rename = "monthsOfYear", default, skip_serializing_if = "Vec::is_empty")] + pub months_of_year: Vec, + #[doc = "Daily retention format."] + #[serde(rename = "retentionScheduleDaily", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_daily: Option, + #[doc = "Weekly retention format."] + #[serde(rename = "retentionScheduleWeekly", default, skip_serializing_if = "Option::is_none")] + pub retention_schedule_weekly: Option, + #[doc = "Retention times of retention policy."] + #[serde(rename = "retentionTimes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_times: Vec, + #[doc = "Retention duration."] + #[serde(rename = "retentionDuration", default, skip_serializing_if = "Option::is_none")] + pub retention_duration: Option, +} +impl YearlyRetentionSchedule { + pub fn new() -> Self { + Self::default() + } +} +pub mod yearly_retention_schedule { + use super::*; + #[doc = "Retention schedule format for yearly retention policy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RetentionScheduleFormatType { + Invalid, + Daily, + Weekly, + } +} diff --git a/services/mgmt/recoveryservicesbackup/src/package_2022_02/operations.rs b/services/mgmt/recoveryservicesbackup/src/package_2022_02/operations.rs new file mode 100644 index 0000000000..8f0c7a951f --- /dev/null +++ b/services/mgmt/recoveryservicesbackup/src/package_2022_02/operations.rs @@ -0,0 +1,7832 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn backup_engines(&self) -> backup_engines::Client { + backup_engines::Client(self.clone()) + } + pub fn backup_jobs(&self) -> backup_jobs::Client { + backup_jobs::Client(self.clone()) + } + pub fn backup_operation_results(&self) -> backup_operation_results::Client { + backup_operation_results::Client(self.clone()) + } + pub fn backup_operation_statuses(&self) -> backup_operation_statuses::Client { + backup_operation_statuses::Client(self.clone()) + } + pub fn backup_policies(&self) -> backup_policies::Client { + backup_policies::Client(self.clone()) + } + pub fn backup_protectable_items(&self) -> backup_protectable_items::Client { + backup_protectable_items::Client(self.clone()) + } + pub fn backup_protected_items(&self) -> backup_protected_items::Client { + backup_protected_items::Client(self.clone()) + } + pub fn backup_protection_containers(&self) -> backup_protection_containers::Client { + backup_protection_containers::Client(self.clone()) + } + pub fn backup_protection_intent(&self) -> backup_protection_intent::Client { + backup_protection_intent::Client(self.clone()) + } + pub fn backup_resource_encryption_configs(&self) -> backup_resource_encryption_configs::Client { + backup_resource_encryption_configs::Client(self.clone()) + } + pub fn backup_resource_storage_configs_non_crr(&self) -> backup_resource_storage_configs_non_crr::Client { + backup_resource_storage_configs_non_crr::Client(self.clone()) + } + pub fn backup_resource_vault_configs(&self) -> backup_resource_vault_configs::Client { + backup_resource_vault_configs::Client(self.clone()) + } + pub fn backup_status(&self) -> backup_status::Client { + backup_status::Client(self.clone()) + } + pub fn backup_usage_summaries(&self) -> backup_usage_summaries::Client { + backup_usage_summaries::Client(self.clone()) + } + pub fn backup_workload_items(&self) -> backup_workload_items::Client { + backup_workload_items::Client(self.clone()) + } + pub fn backups(&self) -> backups::Client { + backups::Client(self.clone()) + } + pub fn bms_prepare_data_move_operation_result(&self) -> bms_prepare_data_move_operation_result::Client { + bms_prepare_data_move_operation_result::Client(self.clone()) + } + pub fn export_jobs_operation_results(&self) -> export_jobs_operation_results::Client { + export_jobs_operation_results::Client(self.clone()) + } + pub fn feature_support(&self) -> feature_support::Client { + feature_support::Client(self.clone()) + } + pub fn item_level_recovery_connections(&self) -> item_level_recovery_connections::Client { + item_level_recovery_connections::Client(self.clone()) + } + pub fn job_cancellations(&self) -> job_cancellations::Client { + job_cancellations::Client(self.clone()) + } + pub fn job_details(&self) -> job_details::Client { + job_details::Client(self.clone()) + } + pub fn job_operation_results(&self) -> job_operation_results::Client { + job_operation_results::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn operation(&self) -> operation::Client { + operation::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint(&self) -> private_endpoint::Client { + private_endpoint::Client(self.clone()) + } + pub fn private_endpoint_connection(&self) -> private_endpoint_connection::Client { + private_endpoint_connection::Client(self.clone()) + } + pub fn protectable_containers(&self) -> protectable_containers::Client { + protectable_containers::Client(self.clone()) + } + pub fn protected_item_operation_results(&self) -> protected_item_operation_results::Client { + protected_item_operation_results::Client(self.clone()) + } + pub fn protected_item_operation_statuses(&self) -> protected_item_operation_statuses::Client { + protected_item_operation_statuses::Client(self.clone()) + } + pub fn protected_items(&self) -> protected_items::Client { + protected_items::Client(self.clone()) + } + pub fn protection_container_operation_results(&self) -> protection_container_operation_results::Client { + protection_container_operation_results::Client(self.clone()) + } + pub fn protection_container_refresh_operation_results(&self) -> protection_container_refresh_operation_results::Client { + protection_container_refresh_operation_results::Client(self.clone()) + } + pub fn protection_containers(&self) -> protection_containers::Client { + protection_containers::Client(self.clone()) + } + pub fn protection_intent(&self) -> protection_intent::Client { + protection_intent::Client(self.clone()) + } + pub fn protection_policies(&self) -> protection_policies::Client { + protection_policies::Client(self.clone()) + } + pub fn protection_policy_operation_results(&self) -> protection_policy_operation_results::Client { + protection_policy_operation_results::Client(self.clone()) + } + pub fn protection_policy_operation_statuses(&self) -> protection_policy_operation_statuses::Client { + protection_policy_operation_statuses::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn recovery_points_recommended_for_move(&self) -> recovery_points_recommended_for_move::Client { + recovery_points_recommended_for_move::Client(self.clone()) + } + pub fn resource_guard_proxies(&self) -> resource_guard_proxies::Client { + resource_guard_proxies::Client(self.clone()) + } + pub fn resource_guard_proxy(&self) -> resource_guard_proxy::Client { + resource_guard_proxy::Client(self.clone()) + } + pub fn restores(&self) -> restores::Client { + restores::Client(self.clone()) + } + pub fn security_pi_ns(&self) -> security_pi_ns::Client { + security_pi_ns::Client(self.clone()) + } + pub fn validate_operation(&self) -> validate_operation::Client { + validate_operation::Client(self.clone()) + } + pub fn validate_operation_results(&self) -> validate_operation_results::Client { + validate_operation_results::Client(self.clone()) + } + pub fn validate_operation_statuses(&self) -> validate_operation_statuses::Client { + validate_operation_statuses::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Get(#[from] backup_resource_storage_configs_non_crr::get::Error), + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Update(#[from] backup_resource_storage_configs_non_crr::update::Error), + #[error(transparent)] + BackupResourceStorageConfigsNonCrr_Patch(#[from] backup_resource_storage_configs_non_crr::patch::Error), + #[error(transparent)] + ProtectionIntent_Validate(#[from] protection_intent::validate::Error), + #[error(transparent)] + BackupStatus_Get(#[from] backup_status::get::Error), + #[error(transparent)] + FeatureSupport_Validate(#[from] feature_support::validate::Error), + #[error(transparent)] + ProtectionIntent_Get(#[from] protection_intent::get::Error), + #[error(transparent)] + ProtectionIntent_CreateOrUpdate(#[from] protection_intent::create_or_update::Error), + #[error(transparent)] + ProtectionIntent_Delete(#[from] protection_intent::delete::Error), + #[error(transparent)] + BackupProtectionIntent_List(#[from] backup_protection_intent::list::Error), + #[error(transparent)] + BackupUsageSummaries_List(#[from] backup_usage_summaries::list::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Get(#[from] backup_resource_vault_configs::get::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Put(#[from] backup_resource_vault_configs::put::Error), + #[error(transparent)] + BackupResourceVaultConfigs_Update(#[from] backup_resource_vault_configs::update::Error), + #[error(transparent)] + BackupResourceEncryptionConfigs_Get(#[from] backup_resource_encryption_configs::get::Error), + #[error(transparent)] + BackupResourceEncryptionConfigs_Update(#[from] backup_resource_encryption_configs::update::Error), + #[error(transparent)] + PrivateEndpointConnection_Get(#[from] private_endpoint_connection::get::Error), + #[error(transparent)] + PrivateEndpointConnection_Put(#[from] private_endpoint_connection::put::Error), + #[error(transparent)] + PrivateEndpointConnection_Delete(#[from] private_endpoint_connection::delete::Error), + #[error(transparent)] + PrivateEndpoint_GetOperationStatus(#[from] private_endpoint::get_operation_status::Error), + #[error(transparent)] + GetOperationStatus(#[from] get_operation_status::Error), + #[error(transparent)] + BmsPrepareDataMove(#[from] bms_prepare_data_move::Error), + #[error(transparent)] + BmsPrepareDataMoveOperationResult_Get(#[from] bms_prepare_data_move_operation_result::get::Error), + #[error(transparent)] + BmsTriggerDataMove(#[from] bms_trigger_data_move::Error), + #[error(transparent)] + ProtectedItems_Get(#[from] protected_items::get::Error), + #[error(transparent)] + ProtectedItems_CreateOrUpdate(#[from] protected_items::create_or_update::Error), + #[error(transparent)] + ProtectedItems_Delete(#[from] protected_items::delete::Error), + #[error(transparent)] + ProtectedItemOperationResults_Get(#[from] protected_item_operation_results::get::Error), + #[error(transparent)] + RecoveryPoints_List(#[from] recovery_points::list::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + Restores_Trigger(#[from] restores::trigger::Error), + #[error(transparent)] + BackupPolicies_List(#[from] backup_policies::list::Error), + #[error(transparent)] + ProtectionPolicies_Get(#[from] protection_policies::get::Error), + #[error(transparent)] + ProtectionPolicies_CreateOrUpdate(#[from] protection_policies::create_or_update::Error), + #[error(transparent)] + ProtectionPolicies_Delete(#[from] protection_policies::delete::Error), + #[error(transparent)] + ProtectionPolicyOperationResults_Get(#[from] protection_policy_operation_results::get::Error), + #[error(transparent)] + BackupJobs_List(#[from] backup_jobs::list::Error), + #[error(transparent)] + JobDetails_Get(#[from] job_details::get::Error), + #[error(transparent)] + JobCancellations_Trigger(#[from] job_cancellations::trigger::Error), + #[error(transparent)] + JobOperationResults_Get(#[from] job_operation_results::get::Error), + #[error(transparent)] + ExportJobsOperationResults_Get(#[from] export_jobs_operation_results::get::Error), + #[error(transparent)] + Jobs_Export(#[from] jobs::export::Error), + #[error(transparent)] + BackupProtectedItems_List(#[from] backup_protected_items::list::Error), + #[error(transparent)] + Operation_Validate(#[from] operation::validate::Error), + #[error(transparent)] + ValidateOperation_Trigger(#[from] validate_operation::trigger::Error), + #[error(transparent)] + ValidateOperationResults_Get(#[from] validate_operation_results::get::Error), + #[error(transparent)] + ValidateOperationStatuses_Get(#[from] validate_operation_statuses::get::Error), + #[error(transparent)] + BackupEngines_List(#[from] backup_engines::list::Error), + #[error(transparent)] + BackupEngines_Get(#[from] backup_engines::get::Error), + #[error(transparent)] + ProtectionContainerRefreshOperationResults_Get(#[from] protection_container_refresh_operation_results::get::Error), + #[error(transparent)] + ProtectableContainers_List(#[from] protectable_containers::list::Error), + #[error(transparent)] + ProtectionContainers_Get(#[from] protection_containers::get::Error), + #[error(transparent)] + ProtectionContainers_Register(#[from] protection_containers::register::Error), + #[error(transparent)] + ProtectionContainers_Unregister(#[from] protection_containers::unregister::Error), + #[error(transparent)] + ProtectionContainers_Inquire(#[from] protection_containers::inquire::Error), + #[error(transparent)] + BackupWorkloadItems_List(#[from] backup_workload_items::list::Error), + #[error(transparent)] + ProtectionContainerOperationResults_Get(#[from] protection_container_operation_results::get::Error), + #[error(transparent)] + Backups_Trigger(#[from] backups::trigger::Error), + #[error(transparent)] + ProtectedItemOperationStatuses_Get(#[from] protected_item_operation_statuses::get::Error), + #[error(transparent)] + ItemLevelRecoveryConnections_Provision(#[from] item_level_recovery_connections::provision::Error), + #[error(transparent)] + ItemLevelRecoveryConnections_Revoke(#[from] item_level_recovery_connections::revoke::Error), + #[error(transparent)] + ProtectionContainers_Refresh(#[from] protection_containers::refresh::Error), + #[error(transparent)] + BackupOperationResults_Get(#[from] backup_operation_results::get::Error), + #[error(transparent)] + BackupOperationStatuses_Get(#[from] backup_operation_statuses::get::Error), + #[error(transparent)] + ProtectionPolicyOperationStatuses_Get(#[from] protection_policy_operation_statuses::get::Error), + #[error(transparent)] + BackupProtectableItems_List(#[from] backup_protectable_items::list::Error), + #[error(transparent)] + BackupProtectionContainers_List(#[from] backup_protection_containers::list::Error), + #[error(transparent)] + SecurityPiNs_Get(#[from] security_pi_ns::get::Error), + #[error(transparent)] + MoveRecoveryPoint(#[from] move_recovery_point::Error), + #[error(transparent)] + RecoveryPointsRecommendedForMove_List(#[from] recovery_points_recommended_for_move::list::Error), + #[error(transparent)] + ResourceGuardProxies_Get(#[from] resource_guard_proxies::get::Error), + #[error(transparent)] + ResourceGuardProxy_Get(#[from] resource_guard_proxy::get::Error), + #[error(transparent)] + ResourceGuardProxy_Put(#[from] resource_guard_proxy::put::Error), + #[error(transparent)] + ResourceGuardProxy_Delete(#[from] resource_guard_proxy::delete::Error), + #[error(transparent)] + ResourceGuardProxy_UnlockDelete(#[from] resource_guard_proxy::unlock_delete::Error), +} +pub mod backup_resource_storage_configs_non_crr { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn patch( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> patch::Builder { + patch::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod patch { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_intent { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "It will validate followings\r\n1. Vault capacity\r\n2. VM is already protected\r\n3. Any VM related configuration passed in properties."] + pub fn validate( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + intent_object_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + intent_object_name: intent_object_name.into(), + } + } + } + pub mod validate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::PreValidateEnableBackupRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupPreValidateProtection", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PreValidateEnableBackupResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + pub(crate) parameters: models::ProtectionIntentResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/backupProtectionIntent/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_status { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the container backup status"] + pub fn get( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupStatusRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupStatus", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupStatusResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod feature_support { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "It will validate if given feature with resource properties is supported in service"] + pub fn validate( + &self, + azure_region: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + azure_region: azure_region.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod validate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) azure_region: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::FeatureSupportRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/providers/Microsoft.RecoveryServices/locations/{}/backupValidateFeatures", + self.client.endpoint(), + &self.subscription_id, + &self.azure_region + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureVmResourceFeatureSupportResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_protection_intent { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionIntents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionIntentResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_usage_summaries { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/Subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupUsageSummaries", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupManagementUsageList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RecoveryServices/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClientDiscoveryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_vault_configs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceVaultConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceVaultConfigResource, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupconfig/vaultconfig", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceVaultConfigResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_resource_encryption_configs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEncryptionConfigs/backupResourceEncryptionConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupResourceEncryptionConfigExtendedResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::BackupResourceEncryptionConfigResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEncryptionConfigs/backupResourceEncryptionConfig" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnectionResource), + Created201(models::PrivateEndpointConnectionResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnectionResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the operation status for a private endpoint connection."] + pub fn get_operation_status( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/privateEndpointConnections/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . private_endpoint_connection_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +impl Client { + pub fn get_operation_status( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get_operation_status::Builder { + get_operation_status::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + pub fn bms_prepare_data_move( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> bms_prepare_data_move::Builder { + bms_prepare_data_move::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn bms_trigger_data_move( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> bms_trigger_data_move::Builder { + bms_trigger_data_move::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + #[doc = "Move recovery point from one datastore to another store."] + pub fn move_recovery_point( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> move_recovery_point::Builder { + move_recovery_point::Builder { + client: self.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } +} +pub mod get_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/operationStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_prepare_data_move { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::PrepareDataMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/prepareDataMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_trigger_data_move { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::TriggerDataMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/triggerDataMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod move_recovery_point { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::MoveRpAcrossTiersRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/move" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } +} +pub mod bms_prepare_data_move_operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VaultStorageConfigOperationResultResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::NewErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupstorageconfig/vaultstorageconfig/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultStorageConfigOperationResultResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NewErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectedItemResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::ProtectedItemResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_item_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectedItemResource), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + filter: None, + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod restores { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::RestoreRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/restore" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + pub fn create_or_update( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionPolicyResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) parameters: models::ProtectionPolicyResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policy_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionPolicyResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_details { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_cancellations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod job_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . job_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod export_jobs_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OperationResultInfoBaseResource), + Accepted202(models::OperationResultInfoBaseResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobs/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultInfoBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResultInfoBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn export( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> export::Builder { + export::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod export { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupJobsExport", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protected_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectedItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectedItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn validate( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod validate { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::ValidateOperationRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperation", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateOperationsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::ValidateOperationRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupTriggerValidateOperation" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ValidateOperationsResponse), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateOperationsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod validate_operation_statuses { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupValidateOperationsStatuses/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_engines { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + backup_engine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + backup_engine_name: backup_engine_name.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupEngineBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) backup_engine_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupEngines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.backup_engine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BackupEngineBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_container_refresh_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protectable_containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectableContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableContainerResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + } + } + pub fn register( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + parameters: impl Into, + ) -> register::Builder { + register::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + parameters: parameters.into(), + } + } + pub fn unregister( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> unregister::Builder { + unregister::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + } + } + #[doc = "Inquires all the protectable items under the given container."] + pub fn inquire( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> inquire::Builder { + inquire::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + filter: None, + } + } + pub fn refresh( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod register { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) parameters: models::ProtectionContainerResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unregister { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod inquire { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/inquire" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/refreshContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_workload_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/items" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkloadItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_container_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerResource), + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/operationResults/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn trigger( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> trigger::Builder { + trigger::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + } + pub mod trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::BackupRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/backup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protected_item_operation_statuses { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/operationsStatus/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod item_level_recovery_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn provision( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + parameters: impl Into, + ) -> provision::Builder { + provision::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + parameters: parameters.into(), + } + } + pub fn revoke( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + recovery_point_id: impl Into, + ) -> revoke::Builder { + revoke::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + recovery_point_id: recovery_point_id.into(), + } + } + } + pub mod provision { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + pub(crate) parameters: models::IlrRequestResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/provisionInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod revoke { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) recovery_point_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPoints/{}/revokeInstantItemRecovery" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name , & self . recovery_point_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_operation_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperationResults/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_operation_statuses { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupOperations/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name, + &self.operation_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod protection_policy_operation_statuses { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + operation_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupPolicies/{}/operations/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . policy_name , & self . operation_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protectable_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + skip_token: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectableItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WorkloadProtectableItemResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod backup_protection_containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupProtectionContainers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod security_pi_ns { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + parameters: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: Option, + } + impl Builder { + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupSecurityPIN", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TokenInformation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod recovery_points_recommended_for_move { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + container_name: impl Into, + protected_item_name: impl Into, + parameters: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + container_name: container_name.into(), + protected_item_name: protected_item_name.into(), + parameters: parameters.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) container_name: String, + pub(crate) protected_item_name: String, + pub(crate) parameters: models::ListRecoveryPointsRecommendedForMoveRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupFabrics/{}/protectionContainers/{}/protectedItems/{}/recoveryPointsRecommendedForMove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . fabric_name , & self . container_name , & self . protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guard_proxies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vault_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod resource_guard_proxy { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn put( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> put::Builder { + put::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + } + } + pub fn unlock_delete( + &self, + vault_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + resource_guard_proxy_name: impl Into, + parameters: impl Into, + ) -> unlock_delete::Builder { + unlock_delete::Builder { + client: self.0.clone(), + vault_name: vault_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + resource_guard_proxy_name: resource_guard_proxy_name.into(), + parameters: parameters.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod put { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceGuardProxyBaseResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unlock_delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) vault_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) resource_guard_proxy_name: String, + pub(crate) parameters: models::UnlockDeleteRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/backupResourceGuardProxies/{}/unlockDelete" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . vault_name , & self . resource_guard_proxy_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UnlockDeleteResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/recoveryservicessiterecovery/Cargo.toml b/services/mgmt/recoveryservicessiterecovery/Cargo.toml index 62892cdea9..8e5119745c 100644 --- a/services/mgmt/recoveryservicessiterecovery/Cargo.toml +++ b/services/mgmt/recoveryservicessiterecovery/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_recoveryservicessiterecovery" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-12", "package-2021-11", "package-2021-10", "package-2021-08"] +features = ["no-default-tag", "package-2022-01", "package-2021-12", "package-2021-11", "package-2021-10"] [features] -default = ["package-2022-01", "enable_reqwest"] +default = ["package-2022-02", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2022-02" = [] "package-2022-01" = [] "package-2021-12" = [] "package-2021-11" = [] diff --git a/services/mgmt/recoveryservicessiterecovery/README.md b/services/mgmt/recoveryservicessiterecovery/README.md index 60b9ee7126..1b263cc066 100644 --- a/services/mgmt/recoveryservicessiterecovery/README.md +++ b/services/mgmt/recoveryservicessiterecovery/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/recoveryse To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2022-01`. +The default tag is `package-2022-02`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2022-02` has 135 operations from 1 API versions: `2022-02-01`. Use crate feature `package-2022-02` to enable. The operations will be in the `package_2022_02` module. - `package-2022-01` has 135 operations from 1 API versions: `2022-01-01`. Use crate feature `package-2022-01` to enable. The operations will be in the `package_2022_01` module. - `package-2021-12` has 135 operations from 1 API versions: `2021-12-01`. Use crate feature `package-2021-12` to enable. The operations will be in the `package_2021_12` module. - `package-2021-11` has 135 operations from 1 API versions: `2021-11-01`. Use crate feature `package-2021-11` to enable. The operations will be in the `package_2021_11` module. diff --git a/services/mgmt/recoveryservicessiterecovery/src/lib.rs b/services/mgmt/recoveryservicessiterecovery/src/lib.rs index bcb0db3b58..217c8e0251 100644 --- a/services/mgmt/recoveryservicessiterecovery/src/lib.rs +++ b/services/mgmt/recoveryservicessiterecovery/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2022-02")] +pub mod package_2022_02; +#[cfg(all(feature = "package-2022-02", not(feature = "no-default-tag")))] +pub use package_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2022-01")] pub mod package_2022_01; #[cfg(all(feature = "package-2022-01", not(feature = "no-default-tag")))] diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/mod.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/models.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/models.rs new file mode 100644 index 0000000000..818e17d86b --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/models.rs @@ -0,0 +1,14555 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "A2A add disk(s) input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aAddDisksInput { + #[serde(flatten)] + pub add_disks_provider_specific_input: AddDisksProviderSpecificInput, + #[doc = "The list of vm disk details."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The list of vm managed disk details."] + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, +} +impl A2aAddDisksInput { + pub fn new(add_disks_provider_specific_input: AddDisksProviderSpecificInput) -> Self { + Self { + add_disks_provider_specific_input, + vm_disks: Vec::new(), + vm_managed_disks: Vec::new(), + } + } +} +#[doc = "ApplyRecoveryPoint input specific to A2A provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +impl A2aApplyRecoveryPointInput { + pub fn new(apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput) -> Self { + Self { + apply_recovery_point_provider_specific_input, + } + } +} +#[doc = "A2A cloud creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +impl A2aContainerCreationInput { + pub fn new(replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput) -> Self { + Self { + replication_provider_specific_container_creation_input, + } + } +} +#[doc = "A2A container mapping input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput, + #[doc = "A value indicating whether the auto update is enabled."] + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[doc = "The automation account arm id."] + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[doc = "A value indicating the type authentication to use for automation Account."] + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +impl A2aContainerMappingInput { + pub fn new(replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput) -> Self { + Self { + replication_provider_specific_container_mapping_input, + agent_auto_update_status: None, + automation_account_arm_id: None, + automation_account_authentication_type: None, + } + } +} +pub mod a2a_container_mapping_input { + use super::*; + #[doc = "A value indicating whether the auto update is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[doc = "A value indicating the type authentication to use for automation Account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } + impl Default for AutomationAccountAuthenticationType { + fn default() -> Self { + Self::RunAsAccount + } + } +} +#[doc = "A2A create protection intent input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCreateProtectionIntentInput { + #[serde(flatten)] + pub create_protection_intent_provider_specific_details: CreateProtectionIntentProviderSpecificDetails, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId")] + pub fabric_object_id: String, + #[doc = "The primary location for the virtual machine."] + #[serde(rename = "primaryLocation")] + pub primary_location: String, + #[doc = "The recovery location for the virtual machine."] + #[serde(rename = "recoveryLocation")] + pub recovery_location: String, + #[doc = "The recovery subscription Id of the virtual machine."] + #[serde(rename = "recoverySubscriptionId")] + pub recovery_subscription_id: String, + #[doc = "The recovery availability type of the virtual machine."] + #[serde(rename = "recoveryAvailabilityType")] + pub recovery_availability_type: a2a_create_protection_intent_input::RecoveryAvailabilityType, + #[doc = "Protection Profile custom input."] + #[serde(rename = "protectionProfileCustomInput", default, skip_serializing_if = "Option::is_none")] + pub protection_profile_custom_input: Option, + #[doc = "The recovery resource group Id. Valid for V2 scenarios."] + #[serde(rename = "recoveryResourceGroupId")] + pub recovery_resource_group_id: String, + #[doc = "Storage account custom input."] + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, + #[doc = "Recovery Availability Set custom input."] + #[serde(rename = "recoveryAvailabilitySetCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_custom_input: Option, + #[doc = "Recovery Virtual network custom input."] + #[serde(rename = "recoveryVirtualNetworkCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network_custom_input: Option, + #[doc = "Recovery Proximity placement group custom input."] + #[serde( + rename = "recoveryProximityPlacementGroupCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_proximity_placement_group_custom_input: Option, + #[doc = "A value indicating whether the auto protection is enabled."] + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[doc = "The list of vm disk inputs."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The list of vm managed disk inputs."] + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[doc = "The multi vm group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The multi vm group id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "Storage account custom input."] + #[serde(rename = "recoveryBootDiagStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[doc = "The recovery availability zone."] + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[doc = "A value indicating whether the auto update is enabled."] + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[doc = "A value indicating the authentication type for automation account. The default value is \"RunAsAccount\"."] + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, + #[doc = "The automation account arm id."] + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, +} +impl A2aCreateProtectionIntentInput { + pub fn new( + create_protection_intent_provider_specific_details: CreateProtectionIntentProviderSpecificDetails, + fabric_object_id: String, + primary_location: String, + recovery_location: String, + recovery_subscription_id: String, + recovery_availability_type: a2a_create_protection_intent_input::RecoveryAvailabilityType, + recovery_resource_group_id: String, + ) -> Self { + Self { + create_protection_intent_provider_specific_details, + fabric_object_id, + primary_location, + recovery_location, + recovery_subscription_id, + recovery_availability_type, + protection_profile_custom_input: None, + recovery_resource_group_id, + primary_staging_storage_account_custom_input: None, + recovery_availability_set_custom_input: None, + recovery_virtual_network_custom_input: None, + recovery_proximity_placement_group_custom_input: None, + auto_protection_of_data_disk: None, + vm_disks: Vec::new(), + vm_managed_disks: Vec::new(), + multi_vm_group_name: None, + multi_vm_group_id: None, + recovery_boot_diag_storage_account: None, + disk_encryption_info: None, + recovery_availability_zone: None, + agent_auto_update_status: None, + automation_account_authentication_type: None, + automation_account_arm_id: None, + } + } +} +pub mod a2a_create_protection_intent_input { + use super::*; + #[doc = "The recovery availability type of the virtual machine."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryAvailabilityType { + Single, + AvailabilitySet, + AvailabilityZone, + } + #[doc = "A value indicating whether the auto protection is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } + #[doc = "A value indicating whether the auto update is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[doc = "A value indicating the authentication type for automation account. The default value is \"RunAsAccount\"."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } + impl Default for AutomationAccountAuthenticationType { + fn default() -> Self { + Self::RunAsAccount + } + } +} +#[doc = "ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +impl A2aCrossClusterMigrationApplyRecoveryPointInput { + pub fn new(apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput) -> Self { + Self { + apply_recovery_point_provider_specific_input, + } + } +} +#[doc = "A2ACrossClusterMigration cloud creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +impl A2aCrossClusterMigrationContainerCreationInput { + pub fn new(replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput) -> Self { + Self { + replication_provider_specific_container_creation_input, + } + } +} +#[doc = "A2A Cross-Cluster Migration enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The recovery container Id."] + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, +} +impl A2aCrossClusterMigrationEnableProtectionInput { + pub fn new(enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput) -> Self { + Self { + enable_protection_provider_specific_input, + fabric_object_id: None, + recovery_container_id: None, + } + } +} +#[doc = "A2A Cross-Cluster Migration Policy creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, +} +impl A2aCrossClusterMigrationPolicyCreationInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + } + } +} +#[doc = "A2A provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aCrossClusterMigrationReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "Primary fabric location."] + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[doc = "The type of operating system."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "An id associated with the PE that survives actions like switch protection which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in being able to have an Id that denotes the \"same\" protected item even though other internal Ids/ARM Id might be changing."] + #[serde(rename = "lifecycleId", default, skip_serializing_if = "Option::is_none")] + pub lifecycle_id: Option, +} +impl A2aCrossClusterMigrationReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + fabric_object_id: None, + primary_fabric_location: None, + os_type: None, + vm_protection_state: None, + vm_protection_state_description: None, + lifecycle_id: None, + } + } +} +#[doc = "A2A enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId")] + pub fabric_object_id: String, + #[doc = "The recovery container Id."] + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[doc = "The recovery resource group Id. Valid for V2 scenarios."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "The recovery cloud service Id. Valid for V1 scenarios."] + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[doc = "The recovery availability set Id."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "The recovery proximity placement group Id."] + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[doc = "The list of vm disk details."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The list of vm managed disk details."] + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[doc = "The multi vm group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The multi vm group id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "The boot diagnostic storage account."] + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[doc = "The recovery availability zone."] + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "recoveryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_extended_location: Option, + #[doc = "The recovery Azure virtual network ARM id."] + #[serde(rename = "recoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_network_id: Option, + #[doc = "The recovery subnet name."] + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[doc = "The virtual machine scale set Id."] + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[doc = "The recovery capacity reservation group Id."] + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +impl A2aEnableProtectionInput { + pub fn new(enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, fabric_object_id: String) -> Self { + Self { + enable_protection_provider_specific_input, + fabric_object_id, + recovery_container_id: None, + recovery_resource_group_id: None, + recovery_cloud_service_id: None, + recovery_availability_set_id: None, + recovery_proximity_placement_group_id: None, + vm_disks: Vec::new(), + vm_managed_disks: Vec::new(), + multi_vm_group_name: None, + multi_vm_group_id: None, + recovery_boot_diag_storage_account_id: None, + disk_encryption_info: None, + recovery_availability_zone: None, + recovery_extended_location: None, + recovery_azure_network_id: None, + recovery_subnet_name: None, + recovery_virtual_machine_scale_set_id: None, + recovery_capacity_reservation_group_id: None, + } + } +} +#[doc = "Model class for event details of a A2A event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The protected item arm name."] + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[doc = "The azure vm arm id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "Fabric arm name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The fabric location."] + #[serde(rename = "fabricLocation", default, skip_serializing_if = "Option::is_none")] + pub fabric_location: Option, + #[doc = "Remote fabric arm name."] + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, + #[doc = "Remote fabric location."] + #[serde(rename = "remoteFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_location: Option, +} +impl A2aEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + protected_item_name: None, + fabric_object_id: None, + fabric_name: None, + fabric_location: None, + remote_fabric_name: None, + remote_fabric_location: None, + } + } +} +#[doc = "A2A Policy creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: a2a_policy_creation_input::MultiVmSyncStatus, +} +impl A2aPolicyCreationInput { + pub fn new( + policy_provider_specific_input: PolicyProviderSpecificInput, + multi_vm_sync_status: a2a_policy_creation_input::MultiVmSyncStatus, + ) -> Self { + Self { + policy_provider_specific_input, + recovery_point_history: None, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status, + } + } +} +pub mod a2a_policy_creation_input { + use super::*; + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[doc = "A2A specific policy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[doc = "The crash consistent snapshot frequency in minutes."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} +impl A2aPolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status: None, + crash_consistent_frequency_in_minutes: None, + } + } +} +#[doc = "A2A protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct A2aProtectedDiskDetails { + #[doc = "The disk uri."] + #[serde(rename = "diskUri", default, skip_serializing_if = "Option::is_none")] + pub disk_uri: Option, + #[doc = "The recovery disk storage account."] + #[serde(rename = "recoveryAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account_id: Option, + #[doc = "The primary disk storage account."] + #[serde(rename = "primaryDiskAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_disk_azure_storage_account_id: Option, + #[doc = "Recovery disk uri."] + #[serde(rename = "recoveryDiskUri", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_uri: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[doc = "The primary staging storage account."] + #[serde(rename = "primaryStagingAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_azure_storage_account_id: Option, + #[doc = "The type of disk."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "A value indicating whether resync is required for this disk."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property."] + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[doc = "The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property."] + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[doc = "The data pending for replication in MB at staging account."] + #[serde( + rename = "dataPendingInStagingStorageAccountInMB", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_pending_in_staging_storage_account_in_mb: Option, + #[doc = "The data pending at source virtual machine in MB."] + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[doc = "The disk state."] + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[doc = "The disk level operations list."] + #[serde(rename = "allowedDiskLevelOperation", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_disk_level_operation: Vec, + #[doc = "A value indicating whether vm has encrypted os disk or not."] + #[serde(rename = "isDiskEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_encrypted: Option, + #[doc = "The secret URL / identifier (BEK)."] + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[doc = "The KeyVault resource id for secret (BEK)."] + #[serde(rename = "dekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub dek_key_vault_arm_id: Option, + #[doc = "A value indicating whether disk key got encrypted or not."] + #[serde(rename = "isDiskKeyEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_key_encrypted: Option, + #[doc = "The key URL / identifier (KEK)."] + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[doc = "The KeyVault resource id for key (KEK)."] + #[serde(rename = "kekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub kek_key_vault_arm_id: Option, + #[doc = "The failover name for the managed disk."] + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[doc = "The test failover name for the managed disk."] + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +impl A2aProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A2A protected managed disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct A2aProtectedManagedDiskDetails { + #[doc = "The managed disk Arm id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The recovery disk resource group Arm Id."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "Recovery target disk Arm Id."] + #[serde(rename = "recoveryTargetDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_id: Option, + #[doc = "Recovery replica disk Arm Id."] + #[serde(rename = "recoveryReplicaDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_id: Option, + #[doc = "Recovery original target disk Arm Id."] + #[serde(rename = "recoveryOrignalTargetDiskId", default, skip_serializing_if = "Option::is_none")] + pub recovery_orignal_target_disk_id: Option, + #[doc = "The replica disk type. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[doc = "The target disk type after failover. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[doc = "The recovery disk encryption set Id."] + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[doc = "The primary disk encryption set Id."] + #[serde(rename = "primaryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub primary_disk_encryption_set_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[doc = "The primary staging storage account."] + #[serde(rename = "primaryStagingAzureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_azure_storage_account_id: Option, + #[doc = "The type of disk."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "A value indicating whether resync is required for this disk."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property."] + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[doc = "The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property."] + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[doc = "The data pending for replication in MB at staging account."] + #[serde( + rename = "dataPendingInStagingStorageAccountInMB", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_pending_in_staging_storage_account_in_mb: Option, + #[doc = "The data pending at source virtual machine in MB."] + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[doc = "The disk state."] + #[serde(rename = "diskState", default, skip_serializing_if = "Option::is_none")] + pub disk_state: Option, + #[doc = "The disk level operations list."] + #[serde(rename = "allowedDiskLevelOperation", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_disk_level_operation: Vec, + #[doc = "A value indicating whether vm has encrypted os disk or not."] + #[serde(rename = "isDiskEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_encrypted: Option, + #[doc = "The secret URL / identifier (BEK)."] + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[doc = "The KeyVault resource id for secret (BEK)."] + #[serde(rename = "dekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub dek_key_vault_arm_id: Option, + #[doc = "A value indicating whether disk key got encrypted or not."] + #[serde(rename = "isDiskKeyEncrypted", default, skip_serializing_if = "Option::is_none")] + pub is_disk_key_encrypted: Option, + #[doc = "The key URL / identifier (KEK)."] + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[doc = "The KeyVault resource id for key (KEK)."] + #[serde(rename = "kekKeyVaultArmId", default, skip_serializing_if = "Option::is_none")] + pub kek_key_vault_arm_id: Option, + #[doc = "The failover name for the managed disk."] + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[doc = "The test failover name for the managed disk."] + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +impl A2aProtectedManagedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A2A provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[doc = "A value indicating whether the auto update is enabled."] + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[doc = "The automation account arm id."] + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[doc = "A value indicating the type authentication to use for automation Account."] + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, + #[doc = "The schedule arm name."] + #[serde(rename = "scheduleName", default, skip_serializing_if = "Option::is_none")] + pub schedule_name: Option, + #[doc = "The job schedule arm name."] + #[serde(rename = "jobScheduleName", default, skip_serializing_if = "Option::is_none")] + pub job_schedule_name: Option, +} +impl A2aProtectionContainerMappingDetails { + pub fn new(protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails) -> Self { + Self { + protection_container_mapping_provider_specific_details, + agent_auto_update_status: None, + automation_account_arm_id: None, + automation_account_authentication_type: None, + schedule_name: None, + job_schedule_name: None, + } + } +} +pub mod a2a_protection_container_mapping_details { + use super::*; + #[doc = "A value indicating whether the auto update is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[doc = "A value indicating the type authentication to use for automation Account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } + impl Default for AutomationAccountAuthenticationType { + fn default() -> Self { + Self::RunAsAccount + } + } +} +#[doc = "Azure VM unmanaged disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionIntentDiskInputDetails { + #[doc = "The disk Uri."] + #[serde(rename = "diskUri")] + pub disk_uri: String, + #[doc = "Storage account custom input."] + #[serde( + rename = "recoveryAzureStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_azure_storage_account_custom_input: Option, + #[doc = "Storage account custom input."] + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, +} +impl A2aProtectionIntentDiskInputDetails { + pub fn new(disk_uri: String) -> Self { + Self { + disk_uri, + recovery_azure_storage_account_custom_input: None, + primary_staging_storage_account_custom_input: None, + } + } +} +#[doc = "Azure VM managed disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aProtectionIntentManagedDiskInputDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "Storage account custom input."] + #[serde( + rename = "primaryStagingStorageAccountCustomInput", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_staging_storage_account_custom_input: Option, + #[doc = "Recovery Resource Group custom input."] + #[serde(rename = "recoveryResourceGroupCustomInput", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_custom_input: Option, + #[doc = "The replica disk type. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[doc = "The target disk type after failover. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[doc = "The recovery disk encryption set Id."] + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +impl A2aProtectionIntentManagedDiskInputDetails { + pub fn new(disk_id: String) -> Self { + Self { + disk_id, + primary_staging_storage_account_custom_input: None, + recovery_resource_group_custom_input: None, + recovery_replica_disk_account_type: None, + recovery_target_disk_account_type: None, + recovery_disk_encryption_set_id: None, + disk_encryption_info: None, + } + } +} +#[doc = "A2A provider specific recovery point details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aRecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[doc = "A value indicating whether the recovery point is multi VM consistent."] + #[serde(rename = "recoveryPointSyncType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_sync_type: Option, + #[doc = "List of disk ids representing a recovery point."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +impl A2aRecoveryPointDetails { + pub fn new(provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails) -> Self { + Self { + provider_specific_recovery_point_details, + recovery_point_sync_type: None, + disks: Vec::new(), + } + } +} +pub mod a2a_recovery_point_details { + use super::*; + #[doc = "A value indicating whether the recovery point is multi VM consistent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointSyncType { + MultiVmSyncRecoveryPoint, + PerVmRecoveryPoint, + } +} +#[doc = "A2A remove disk(s) input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aRemoveDisksInput { + #[serde(flatten)] + pub remove_disks_provider_specific_input: RemoveDisksProviderSpecificInput, + #[doc = "The list of vm disk vhd URIs."] + #[serde(rename = "vmDisksUris", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks_uris: Vec, + #[doc = "The list of vm managed disk Ids."] + #[serde(rename = "vmManagedDisksIds", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks_ids: Vec, +} +impl A2aRemoveDisksInput { + pub fn new(remove_disks_provider_specific_input: RemoveDisksProviderSpecificInput) -> Self { + Self { + remove_disks_provider_specific_input, + vm_disks_uris: Vec::new(), + vm_managed_disks_ids: Vec::new(), + } + } +} +#[doc = "A2A provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The initial primary availability zone."] + #[serde(rename = "initialPrimaryZone", default, skip_serializing_if = "Option::is_none")] + pub initial_primary_zone: Option, + #[doc = "The initial primary fabric location."] + #[serde(rename = "initialPrimaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_primary_fabric_location: Option, + #[doc = "The initial recovery availability zone."] + #[serde(rename = "initialRecoveryZone", default, skip_serializing_if = "Option::is_none")] + pub initial_recovery_zone: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "initialPrimaryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_primary_extended_location: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "initialRecoveryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_recovery_extended_location: Option, + #[doc = "The initial recovery fabric location."] + #[serde(rename = "initialRecoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub initial_recovery_fabric_location: Option, + #[doc = "The multi vm group Id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "The multi vm group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "Whether Multi VM group is auto created or specified by user."] + #[serde(rename = "multiVmGroupCreateOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_create_option: Option, + #[doc = "The management Id."] + #[serde(rename = "managementId", default, skip_serializing_if = "Option::is_none")] + pub management_id: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "The list of unprotected disks."] + #[serde(rename = "unprotectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub unprotected_disks: Vec, + #[doc = "The list of protected managed disks."] + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, + #[doc = "The recovery boot diagnostic storage account Arm Id."] + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[doc = "Primary fabric location."] + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[doc = "The recovery fabric location."] + #[serde(rename = "recoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_location: Option, + #[doc = "The type of operating system."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The size of recovery virtual machine."] + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[doc = "The name of recovery virtual machine."] + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[doc = "The recovery resource group."] + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[doc = "The recovery cloud service."] + #[serde(rename = "recoveryCloudService", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service: Option, + #[doc = "The recovery availability set."] + #[serde(rename = "recoveryAvailabilitySet", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set: Option, + #[doc = "The recovery virtual network."] + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[doc = "The test failover virtual network."] + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[doc = "The virtual machine nic details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "Azure to Azure VM synced configuration details."] + #[serde(rename = "vmSyncedConfigDetails", default, skip_serializing_if = "Option::is_none")] + pub vm_synced_config_details: Option, + #[doc = "The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property."] + #[serde(rename = "monitoringPercentageCompletion", default, skip_serializing_if = "Option::is_none")] + pub monitoring_percentage_completion: Option, + #[doc = "The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property."] + #[serde(rename = "monitoringJobType", default, skip_serializing_if = "Option::is_none")] + pub monitoring_job_type: Option, + #[doc = "The last heartbeat received from the source server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "The agent version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[doc = "A value indicating whether replication agent update is required."] + #[serde(rename = "isReplicationAgentUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_replication_agent_update_required: Option, + #[doc = "Agent certificate expiry date."] + #[serde(rename = "agentCertificateExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_certificate_expiry_date: Option, + #[doc = "A value indicating whether agent certificate update is required."] + #[serde( + rename = "isReplicationAgentCertificateUpdateRequired", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_replication_agent_certificate_update_required: Option, + #[doc = "The recovery fabric object Id."] + #[serde(rename = "recoveryFabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_object_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "An id associated with the PE that survives actions like switch protection which change the backing PE/CPE objects internally.The lifecycle id gets carried forward to have a link/continuity in being able to have an Id that denotes the \"same\" protected item even though other internal Ids/ARM Id might be changing."] + #[serde(rename = "lifecycleId", default, skip_serializing_if = "Option::is_none")] + pub lifecycle_id: Option, + #[doc = "The test failover fabric object Id."] + #[serde(rename = "testFailoverRecoveryFabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub test_failover_recovery_fabric_object_id: Option, + #[doc = "The last RPO value in seconds."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "The time (in UTC) when the last RPO value was calculated by Protection Service."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The primary availability zone."] + #[serde(rename = "primaryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub primary_availability_zone: Option, + #[doc = "The recovery availability zone."] + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "primaryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_extended_location: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "recoveryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_extended_location: Option, + #[doc = "The encryption type of the VM."] + #[serde(rename = "vmEncryptionType", default, skip_serializing_if = "Option::is_none")] + pub vm_encryption_type: Option, + #[doc = "The test failover vm name."] + #[serde(rename = "tfoAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub tfo_azure_vm_name: Option, + #[doc = "The recovery azure generation."] + #[serde(rename = "recoveryAzureGeneration", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_generation: Option, + #[doc = "The recovery proximity placement group Id."] + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[doc = "A value indicating whether the auto protection is enabled."] + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[doc = "The recovery virtual machine scale set id."] + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[doc = "The recovery capacity reservation group Id."] + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +impl A2aReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + fabric_object_id: None, + initial_primary_zone: None, + initial_primary_fabric_location: None, + initial_recovery_zone: None, + initial_primary_extended_location: None, + initial_recovery_extended_location: None, + initial_recovery_fabric_location: None, + multi_vm_group_id: None, + multi_vm_group_name: None, + multi_vm_group_create_option: None, + management_id: None, + protected_disks: Vec::new(), + unprotected_disks: Vec::new(), + protected_managed_disks: Vec::new(), + recovery_boot_diag_storage_account_id: None, + primary_fabric_location: None, + recovery_fabric_location: None, + os_type: None, + recovery_azure_vm_size: None, + recovery_azure_vm_name: None, + recovery_azure_resource_group_id: None, + recovery_cloud_service: None, + recovery_availability_set: None, + selected_recovery_azure_network_id: None, + selected_tfo_azure_network_id: None, + vm_nics: Vec::new(), + vm_synced_config_details: None, + monitoring_percentage_completion: None, + monitoring_job_type: None, + last_heartbeat: None, + agent_version: None, + agent_expiry_date: None, + is_replication_agent_update_required: None, + agent_certificate_expiry_date: None, + is_replication_agent_certificate_update_required: None, + recovery_fabric_object_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + lifecycle_id: None, + test_failover_recovery_fabric_object_id: None, + rpo_in_seconds: None, + last_rpo_calculated_time: None, + primary_availability_zone: None, + recovery_availability_zone: None, + primary_extended_location: None, + recovery_extended_location: None, + vm_encryption_type: None, + tfo_azure_vm_name: None, + recovery_azure_generation: None, + recovery_proximity_placement_group_id: None, + auto_protection_of_data_disk: None, + recovery_virtual_machine_scale_set_id: None, + recovery_capacity_reservation_group_id: None, + } + } +} +pub mod a2a_replication_details { + use super::*; + #[doc = "Whether Multi VM group is auto created or specified by user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmGroupCreateOption { + AutoCreated, + UserSpecified, + } + #[doc = "The encryption type of the VM."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum VmEncryptionType { + NotEncrypted, + OnePassEncrypted, + TwoPassEncrypted, + } + #[doc = "A value indicating whether the auto protection is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } +} +#[doc = "A2A provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReplicationIntentDetails { + #[serde(flatten)] + pub replication_protection_intent_provider_specific_settings: ReplicationProtectionIntentProviderSpecificSettings, + #[doc = "The fabric specific object Id of the virtual machine."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The primary location for the virtual machine."] + #[serde(rename = "primaryLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_location: Option, + #[doc = "The recovery location for the virtual machine."] + #[serde(rename = "recoveryLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_location: Option, + #[doc = "The recovery subscription Id of the virtual machine."] + #[serde(rename = "recoverySubscriptionId", default, skip_serializing_if = "Option::is_none")] + pub recovery_subscription_id: Option, + #[doc = "The list of vm disk details."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The list of vm managed disk details."] + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[doc = "The recovery resource group id."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "Protection Profile custom input."] + #[serde(rename = "protectionProfile", default, skip_serializing_if = "Option::is_none")] + pub protection_profile: Option, + #[doc = "Storage account custom input."] + #[serde(rename = "primaryStagingStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub primary_staging_storage_account: Option, + #[doc = "Recovery Availability Set custom input."] + #[serde(rename = "recoveryAvailabilitySet", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set: Option, + #[doc = "Recovery Virtual network custom input."] + #[serde(rename = "recoveryVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network: Option, + #[doc = "Recovery Proximity placement group custom input."] + #[serde(rename = "recoveryProximityPlacementGroup", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group: Option, + #[doc = "A value indicating whether the auto protection is enabled."] + #[serde(rename = "autoProtectionOfDataDisk", default, skip_serializing_if = "Option::is_none")] + pub auto_protection_of_data_disk: Option, + #[doc = "The multi vm group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The multi vm group id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "Storage account custom input."] + #[serde(rename = "recoveryBootDiagStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[doc = "The recovery availability zone."] + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[doc = "The recovery availability type of the virtual machine."] + #[serde(rename = "recoveryAvailabilityType")] + pub recovery_availability_type: String, + #[doc = "A value indicating whether the auto update is enabled."] + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[doc = "The automation account arm id."] + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[doc = "A value indicating the type authentication to use for automation Account."] + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +impl A2aReplicationIntentDetails { + pub fn new( + replication_protection_intent_provider_specific_settings: ReplicationProtectionIntentProviderSpecificSettings, + recovery_availability_type: String, + ) -> Self { + Self { + replication_protection_intent_provider_specific_settings, + fabric_object_id: None, + primary_location: None, + recovery_location: None, + recovery_subscription_id: None, + vm_disks: Vec::new(), + vm_managed_disks: Vec::new(), + recovery_resource_group_id: None, + protection_profile: None, + primary_staging_storage_account: None, + recovery_availability_set: None, + recovery_virtual_network: None, + recovery_proximity_placement_group: None, + auto_protection_of_data_disk: None, + multi_vm_group_name: None, + multi_vm_group_id: None, + recovery_boot_diag_storage_account: None, + disk_encryption_info: None, + recovery_availability_zone: None, + recovery_availability_type, + agent_auto_update_status: None, + automation_account_arm_id: None, + automation_account_authentication_type: None, + } + } +} +pub mod a2a_replication_intent_details { + use super::*; + #[doc = "A value indicating whether the auto protection is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutoProtectionOfDataDisk { + Disabled, + Enabled, + } + #[doc = "A value indicating whether the auto update is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[doc = "A value indicating the type authentication to use for automation Account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } + impl Default for AutomationAccountAuthenticationType { + fn default() -> Self { + Self::RunAsAccount + } + } +} +#[doc = "Azure specific reprotect input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The recovery container Id."] + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[doc = "The list of vm disk details."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The recovery resource group Id. Valid for V2 scenarios."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "The recovery cloud service Id. Valid for V1 scenarios."] + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[doc = "The recovery availability set."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "The Policy Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +impl A2aReprotectInput { + pub fn new(reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput) -> Self { + Self { + reverse_replication_provider_specific_input, + recovery_container_id: None, + vm_disks: Vec::new(), + recovery_resource_group_id: None, + recovery_cloud_service_id: None, + recovery_availability_set_id: None, + policy_id: None, + } + } +} +#[doc = "A2A specific switch protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aSwitchProtectionInput { + #[serde(flatten)] + pub switch_protection_provider_specific_input: SwitchProtectionProviderSpecificInput, + #[doc = "The recovery container Id."] + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[doc = "The list of vm disk details."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The list of vm managed disk details."] + #[serde(rename = "vmManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_managed_disks: Vec, + #[doc = "The recovery resource group Id. Valid for V2 scenarios."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "The recovery cloud service Id. Valid for V1 scenarios."] + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[doc = "The recovery availability set."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "The Policy Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "The boot diagnostic storage account."] + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[doc = "The recovery availability zone."] + #[serde(rename = "recoveryAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_zone: Option, + #[doc = "The recovery proximity placement group Id."] + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[doc = "The virtual machine scale set id."] + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[doc = "The recovery capacity reservation group Id."] + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +impl A2aSwitchProtectionInput { + pub fn new(switch_protection_provider_specific_input: SwitchProtectionProviderSpecificInput) -> Self { + Self { + switch_protection_provider_specific_input, + recovery_container_id: None, + vm_disks: Vec::new(), + vm_managed_disks: Vec::new(), + recovery_resource_group_id: None, + recovery_cloud_service_id: None, + recovery_availability_set_id: None, + policy_id: None, + recovery_boot_diag_storage_account_id: None, + recovery_availability_zone: None, + recovery_proximity_placement_group_id: None, + recovery_virtual_machine_scale_set_id: None, + recovery_capacity_reservation_group_id: None, + disk_encryption_info: None, + } + } +} +#[doc = "A2A provider specific input for test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[doc = "The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "A value indicating whether to use recovery cloud service for TFO or not."] + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, +} +impl A2aTestFailoverInput { + pub fn new(test_failover_provider_specific_input: TestFailoverProviderSpecificInput) -> Self { + Self { + test_failover_provider_specific_input, + recovery_point_id: None, + cloud_service_creation_option: None, + } + } +} +#[doc = "A2A provider specific input for unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "A value indicating whether to use recovery cloud service for failover or not."] + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, +} +impl A2aUnplannedFailoverInput { + pub fn new(unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput) -> Self { + Self { + unplanned_failover_provider_specific_input, + recovery_point_id: None, + cloud_service_creation_option: None, + } + } +} +#[doc = "A2A unprotected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct A2aUnprotectedDiskDetails { + #[doc = "The source lun Id for the data disk."] + #[serde(rename = "diskLunId", default, skip_serializing_if = "Option::is_none")] + pub disk_lun_id: Option, + #[doc = "A value indicating whether the disk auto protection is enabled."] + #[serde(rename = "diskAutoProtectionStatus", default, skip_serializing_if = "Option::is_none")] + pub disk_auto_protection_status: Option, +} +impl A2aUnprotectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod a2a_unprotected_disk_details { + use super::*; + #[doc = "A value indicating whether the disk auto protection is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskAutoProtectionStatus { + Disabled, + Enabled, + } +} +#[doc = "A2A update protection container mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUpdateContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + #[doc = "A value indicating whether the auto update is enabled."] + #[serde(rename = "agentAutoUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_auto_update_status: Option, + #[doc = "The automation account arm id."] + #[serde(rename = "automationAccountArmId", default, skip_serializing_if = "Option::is_none")] + pub automation_account_arm_id: Option, + #[doc = "A value indicating the type authentication to use for automation Account."] + #[serde(rename = "automationAccountAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub automation_account_authentication_type: Option, +} +impl A2aUpdateContainerMappingInput { + pub fn new( + replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + ) -> Self { + Self { + replication_provider_specific_update_container_mapping_input, + agent_auto_update_status: None, + automation_account_arm_id: None, + automation_account_authentication_type: None, + } + } +} +pub mod a2a_update_container_mapping_input { + use super::*; + #[doc = "A value indicating whether the auto update is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentAutoUpdateStatus { + Disabled, + Enabled, + } + #[doc = "A value indicating the type authentication to use for automation Account."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AutomationAccountAuthenticationType { + RunAsAccount, + SystemAssignedIdentity, + } + impl Default for AutomationAccountAuthenticationType { + fn default() -> Self { + Self::RunAsAccount + } + } +} +#[doc = "InMage Azure V2 input to update replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[doc = "The target cloud service ARM Id (for V1)."] + #[serde(rename = "recoveryCloudServiceId", default, skip_serializing_if = "Option::is_none")] + pub recovery_cloud_service_id: Option, + #[doc = "The target resource group ARM Id (for V2)."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, + #[doc = "Managed disk update details."] + #[serde(rename = "managedDiskUpdateDetails", default, skip_serializing_if = "Vec::is_empty")] + pub managed_disk_update_details: Vec, + #[doc = "The boot diagnostic storage account."] + #[serde(rename = "recoveryBootDiagStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_boot_diag_storage_account_id: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[doc = "The user given name for Test Failover VM."] + #[serde(rename = "tfoAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub tfo_azure_vm_name: Option, + #[doc = "The recovery proximity placement group Id."] + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, + #[doc = "The recovery virtual machine scale set Id."] + #[serde(rename = "recoveryVirtualMachineScaleSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_machine_scale_set_id: Option, + #[doc = "The recovery capacity reservation group Id."] + #[serde(rename = "recoveryCapacityReservationGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_capacity_reservation_group_id: Option, +} +impl A2aUpdateReplicationProtectedItemInput { + pub fn new(update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput) -> Self { + Self { + update_replication_protected_item_provider_input, + recovery_cloud_service_id: None, + recovery_resource_group_id: None, + managed_disk_update_details: Vec::new(), + recovery_boot_diag_storage_account_id: None, + disk_encryption_info: None, + tfo_azure_vm_name: None, + recovery_proximity_placement_group_id: None, + recovery_virtual_machine_scale_set_id: None, + recovery_capacity_reservation_group_id: None, + } + } +} +#[doc = "A2A disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aVmDiskInputDetails { + #[doc = "The disk Uri."] + #[serde(rename = "diskUri")] + pub disk_uri: String, + #[doc = "The recovery VHD storage account Id."] + #[serde(rename = "recoveryAzureStorageAccountId")] + pub recovery_azure_storage_account_id: String, + #[doc = "The primary staging storage account Id."] + #[serde(rename = "primaryStagingAzureStorageAccountId")] + pub primary_staging_azure_storage_account_id: String, +} +impl A2aVmDiskInputDetails { + pub fn new(disk_uri: String, recovery_azure_storage_account_id: String, primary_staging_azure_storage_account_id: String) -> Self { + Self { + disk_uri, + recovery_azure_storage_account_id, + primary_staging_azure_storage_account_id, + } + } +} +#[doc = "A2A managed disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct A2aVmManagedDiskInputDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "The primary staging storage account Arm Id."] + #[serde(rename = "primaryStagingAzureStorageAccountId")] + pub primary_staging_azure_storage_account_id: String, + #[doc = "The target resource group Arm Id."] + #[serde(rename = "recoveryResourceGroupId")] + pub recovery_resource_group_id: String, + #[doc = "The replica disk type. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[doc = "The target disk type after failover. Its an optional value and will be same as source disk type if not user provided."] + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[doc = "The recovery disk encryption set Id."] + #[serde(rename = "recoveryDiskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_disk_encryption_set_id: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, +} +impl A2aVmManagedDiskInputDetails { + pub fn new(disk_id: String, primary_staging_azure_storage_account_id: String, recovery_resource_group_id: String) -> Self { + Self { + disk_id, + primary_staging_azure_storage_account_id, + recovery_resource_group_id, + recovery_replica_disk_account_type: None, + recovery_target_disk_account_type: None, + recovery_disk_encryption_set_id: None, + disk_encryption_info: None, + } + } +} +#[doc = "A2A Vm managed disk update details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct A2aVmManagedDiskUpdateDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The target disk type before failover."] + #[serde(rename = "recoveryTargetDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_target_disk_account_type: Option, + #[doc = "The replica disk type before failover."] + #[serde(rename = "recoveryReplicaDiskAccountType", default, skip_serializing_if = "Option::is_none")] + pub recovery_replica_disk_account_type: Option, + #[doc = "Recovery disk encryption info (BEK and KEK)."] + #[serde(rename = "diskEncryptionInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_info: Option, + #[doc = "The target disk name for unplanned failover operation."] + #[serde(rename = "failoverDiskName", default, skip_serializing_if = "Option::is_none")] + pub failover_disk_name: Option, + #[doc = "The target disk name for test failover operation."] + #[serde(rename = "tfoDiskName", default, skip_serializing_if = "Option::is_none")] + pub tfo_disk_name: Option, +} +impl A2aVmManagedDiskUpdateDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Zone details data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct A2aZoneDetails { + #[doc = "Source zone info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The target zone info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl A2aZoneDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Task of the Job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AsrTask { + #[doc = "The Id."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, + #[doc = "The unique Task name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The state/actions applicable on this task."] + #[serde(rename = "allowedActions", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_actions: Vec, + #[doc = "The name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped."] + #[serde(rename = "stateDescription", default, skip_serializing_if = "Option::is_none")] + pub state_description: Option, + #[doc = "The type of task. Details in CustomDetails property depend on this type."] + #[serde(rename = "taskType", default, skip_serializing_if = "Option::is_none")] + pub task_type: Option, + #[doc = "Task details based on specific task type."] + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, + #[doc = "This class represents the group task details when parent child relationship exists in the drill down."] + #[serde(rename = "groupTaskCustomDetails", default, skip_serializing_if = "Option::is_none")] + pub group_task_custom_details: Option, + #[doc = "The task error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, +} +impl AsrTask { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input for add disk(s) operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddDisksInput { + #[doc = "Add Disks input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AddDisksInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Add Disks input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddDisksInputProperties { + #[doc = "Add Disks provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: AddDisksProviderSpecificInput, +} +impl AddDisksInputProperties { + pub fn new(provider_specific_details: AddDisksProviderSpecificInput) -> Self { + Self { provider_specific_details } + } +} +#[doc = "Add Disks provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddDisksProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl AddDisksProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input required to add a provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddRecoveryServicesProviderInput { + #[doc = "The properties of an add provider request."] + pub properties: AddRecoveryServicesProviderInputProperties, +} +impl AddRecoveryServicesProviderInput { + pub fn new(properties: AddRecoveryServicesProviderInputProperties) -> Self { + Self { properties } + } +} +#[doc = "The properties of an add provider request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddRecoveryServicesProviderInputProperties { + #[doc = "The name of the machine where the provider is getting added."] + #[serde(rename = "machineName")] + pub machine_name: String, + #[doc = "The Id of the machine where the provider is getting added."] + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[doc = "The Bios Id of the machine."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "Identity provider input."] + #[serde(rename = "authenticationIdentityInput")] + pub authentication_identity_input: IdentityProviderInput, + #[doc = "Identity provider input."] + #[serde(rename = "resourceAccessIdentityInput")] + pub resource_access_identity_input: IdentityProviderInput, + #[doc = "Identity provider input."] + #[serde(rename = "dataPlaneAuthenticationIdentityInput", default, skip_serializing_if = "Option::is_none")] + pub data_plane_authentication_identity_input: Option, +} +impl AddRecoveryServicesProviderInputProperties { + pub fn new( + machine_name: String, + authentication_identity_input: IdentityProviderInput, + resource_access_identity_input: IdentityProviderInput, + ) -> Self { + Self { + machine_name, + machine_id: None, + bios_id: None, + authentication_identity_input, + resource_access_identity_input, + data_plane_authentication_identity_input: None, + } + } +} +#[doc = "Input required to add vCenter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddVCenterRequest { + #[doc = "The properties of an add vCenter request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AddVCenterRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an add vCenter request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddVCenterRequestProperties { + #[doc = "The friendly name of the vCenter."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The IP address of the vCenter to be discovered."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The process server Id from where the discovery is orchestrated."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The port number for discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The account Id which has privileges to discover the vCenter."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +impl AddVCenterRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentDetails { + #[doc = "The Id of the agent running on the server."] + #[serde(rename = "agentId", default, skip_serializing_if = "Option::is_none")] + pub agent_id: Option, + #[doc = "The Id of the machine to which the agent is registered."] + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[doc = "The machine BIOS Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The machine FQDN."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The disks."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +impl AgentDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Agent disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AgentDiskDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[doc = "The lun of disk."] + #[serde(rename = "lunId", default, skip_serializing_if = "Option::is_none")] + pub lun_id: Option, +} +impl AgentDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Implements the Alert class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Alert { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The properties of an alert."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Alert { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of alerts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertCollection { + #[doc = "The list of alerts."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AlertCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an alert."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AlertProperties { + #[doc = "A value indicating whether to send email to subscription administrator."] + #[serde(rename = "sendToOwners", default, skip_serializing_if = "Option::is_none")] + pub send_to_owners: Option, + #[doc = "The custom email address for sending emails."] + #[serde(rename = "customEmailAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub custom_email_addresses: Vec, + #[doc = "The locale for the email notification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub locale: Option, +} +impl AlertProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of appliance details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplianceCollection { + #[doc = "The appliance details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApplianceCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameter to get appliance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApplianceQueryParameter { + #[doc = "The providerType to be used for fetching appliance details."] + #[serde(rename = "providerType", default, skip_serializing_if = "Option::is_none")] + pub provider_type: Option, +} +impl ApplianceQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Appliance specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplianceSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ApplianceSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input to apply recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointInput { + #[doc = "Input properties to apply recovery point."] + pub properties: ApplyRecoveryPointInputProperties, +} +impl ApplyRecoveryPointInput { + pub fn new(properties: ApplyRecoveryPointInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Input properties to apply recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointInputProperties { + #[doc = "The recovery point Id."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "Provider specific input for apply recovery point."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: ApplyRecoveryPointProviderSpecificInput, +} +impl ApplyRecoveryPointInputProperties { + pub fn new(provider_specific_details: ApplyRecoveryPointProviderSpecificInput) -> Self { + Self { + recovery_point_id: None, + provider_specific_details, + } + } +} +#[doc = "Provider specific input for apply recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyRecoveryPointProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ApplyRecoveryPointProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "This class represents job details based on specific job type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsrJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, +} +impl AsrJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { job_details } + } +} +#[doc = "This class represents the task details for an automation runbook."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutomationRunbookTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "The recovery plan task name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The cloud service of the automation runbook account."] + #[serde(rename = "cloudServiceName", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_name: Option, + #[doc = "The subscription Id of the automation runbook account."] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "The automation account name of the runbook."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "The runbook Id."] + #[serde(rename = "runbookId", default, skip_serializing_if = "Option::is_none")] + pub runbook_id: Option, + #[doc = "The runbook name."] + #[serde(rename = "runbookName", default, skip_serializing_if = "Option::is_none")] + pub runbook_name: Option, + #[doc = "The job Id of the runbook execution."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The execution output of the runbook."] + #[serde(rename = "jobOutput", default, skip_serializing_if = "Option::is_none")] + pub job_output: Option, + #[doc = "A value indicating whether it is a primary side script or not."] + #[serde(rename = "isPrimarySideScript", default, skip_serializing_if = "Option::is_none")] + pub is_primary_side_script: Option, +} +impl AutomationRunbookTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + name: None, + cloud_service_name: None, + subscription_id: None, + account_name: None, + runbook_id: None, + runbook_name: None, + job_id: None, + job_output: None, + is_primary_side_script: None, + } + } +} +#[doc = "Fabric provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[doc = "The Location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl AzureFabricCreationInput { + pub fn new(fabric_specific_creation_input: FabricSpecificCreationInput) -> Self { + Self { + fabric_specific_creation_input, + location: None, + } + } +} +#[doc = "Azure Fabric Specific Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[doc = "The Location for the Azure fabric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "The container Ids for the Azure fabric."] + #[serde(rename = "containerIds", default, skip_serializing_if = "Vec::is_empty")] + pub container_ids: Vec, + #[doc = "The zones."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub zones: Vec, +} +impl AzureFabricSpecificDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { + fabric_specific_details, + location: None, + container_ids: Vec::new(), + zones: Vec::new(), + } + } +} +#[doc = "Create network mappings input properties/behavior specific to Azure to Azure Network mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, + #[doc = "The primary azure vnet Id."] + #[serde(rename = "primaryNetworkId")] + pub primary_network_id: String, +} +impl AzureToAzureCreateNetworkMappingInput { + pub fn new(fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, primary_network_id: String) -> Self { + Self { + fabric_specific_create_network_mapping_input, + primary_network_id, + } + } +} +#[doc = "A2A Network Mapping fabric specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, + #[doc = "The primary fabric location."] + #[serde(rename = "primaryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_location: Option, + #[doc = "The recovery fabric location."] + #[serde(rename = "recoveryFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_location: Option, +} +impl AzureToAzureNetworkMappingSettings { + pub fn new(network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings) -> Self { + Self { + network_mapping_fabric_specific_settings, + primary_fabric_location: None, + recovery_fabric_location: None, + } + } +} +#[doc = "Updates network mappings input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureToAzureUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, + #[doc = "The primary azure vnet Id."] + #[serde(rename = "primaryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub primary_network_id: Option, +} +impl AzureToAzureUpdateNetworkMappingInput { + pub fn new(fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput) -> Self { + Self { + fabric_specific_update_network_mapping_input, + primary_network_id: None, + } + } +} +#[doc = "Azure to Azure VM synced configuration details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureToAzureVmSyncedConfigDetails { + #[doc = "The Azure VM tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The Azure VM input endpoints."] + #[serde(rename = "inputEndpoints", default, skip_serializing_if = "Vec::is_empty")] + pub input_endpoints: Vec, +} +impl AzureToAzureVmSyncedConfigDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Disk details for E2A provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureVmDiskDetails { + #[doc = "VHD type."] + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[doc = "The VHD id."] + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[doc = "The disk resource id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "VHD name."] + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, + #[doc = "Max side in MB."] + #[serde(rename = "maxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub max_size_mb: Option, + #[doc = "Blob uri of the Azure disk."] + #[serde(rename = "targetDiskLocation", default, skip_serializing_if = "Option::is_none")] + pub target_disk_location: Option, + #[doc = "The target Azure disk name."] + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, + #[doc = "Ordinal\\LunId of the disk for the Azure VM."] + #[serde(rename = "lunId", default, skip_serializing_if = "Option::is_none")] + pub lun_id: Option, + #[doc = "The DiskEncryptionSet ARM ID."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The custom target Azure disk name."] + #[serde(rename = "customTargetDiskName", default, skip_serializing_if = "Option::is_none")] + pub custom_target_disk_name: Option, +} +impl AzureVmDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents the error used to indicate why the target compute size is not applicable."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ComputeSizeErrorDetails { + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The severity of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, +} +impl ComputeSizeErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigurationSettings { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ConfigurationSettings { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Request to configure alerts for the system."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConfigureAlertRequest { + #[doc = "Properties of a configure alert request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ConfigureAlertRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a configure alert request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConfigureAlertRequestProperties { + #[doc = "A value indicating whether to send email to subscription administrator."] + #[serde(rename = "sendToOwners", default, skip_serializing_if = "Option::is_none")] + pub send_to_owners: Option, + #[doc = "The custom email address for sending emails."] + #[serde(rename = "customEmailAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub custom_email_addresses: Vec, + #[doc = "The locale for the email notification."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub locale: Option, +} +impl ConfigureAlertRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class contains monitoring details of all the inconsistent Protected Entities in Vmm."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConsistencyCheckTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "The list of inconsistent Vm details."] + #[serde(rename = "vmDetails", default, skip_serializing_if = "Vec::is_empty")] + pub vm_details: Vec, +} +impl ConsistencyCheckTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + vm_details: Vec::new(), + } + } +} +#[doc = "Create network mappings input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateNetworkMappingInput { + #[doc = "Common input details for network mapping operation."] + pub properties: CreateNetworkMappingInputProperties, +} +impl CreateNetworkMappingInput { + pub fn new(properties: CreateNetworkMappingInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Common input details for network mapping operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateNetworkMappingInputProperties { + #[doc = "Recovery fabric Name."] + #[serde(rename = "recoveryFabricName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_name: Option, + #[doc = "Recovery network Id."] + #[serde(rename = "recoveryNetworkId")] + pub recovery_network_id: String, + #[doc = "Input details specific to fabrics during Network Mapping."] + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +impl CreateNetworkMappingInputProperties { + pub fn new(recovery_network_id: String) -> Self { + Self { + recovery_fabric_name: None, + recovery_network_id, + fabric_specific_details: None, + } + } +} +#[doc = "Protection Policy input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreatePolicyInput { + #[doc = "Policy creation properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CreatePolicyInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy creation properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreatePolicyInputProperties { + #[doc = "Base class for provider specific input."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +impl CreatePolicyInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create protection container input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionContainerInput { + #[doc = "Create protection container input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CreateProtectionContainerInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create protection container input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionContainerInputProperties { + #[doc = "Provider specific inputs for container creation."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_input: Vec, +} +impl CreateProtectionContainerInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configure pairing input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionContainerMappingInput { + #[doc = "Configure pairing input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CreateProtectionContainerMappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configure pairing input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionContainerMappingInputProperties { + #[doc = "The target unique protection container name."] + #[serde(rename = "targetProtectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_id: Option, + #[doc = "Applicable policy."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Provider specific input for pairing operations."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +impl CreateProtectionContainerMappingInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create protection intent input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionIntentInput { + #[doc = "Create protection intent input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CreateProtectionIntentInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create protection intent input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateProtectionIntentProperties { + #[doc = "Create protection intent provider specific input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl CreateProtectionIntentProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Create protection intent provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateProtectionIntentProviderSpecificDetails { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl CreateProtectionIntentProviderSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Create recovery plan input class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateRecoveryPlanInput { + #[doc = "Recovery plan creation properties."] + pub properties: CreateRecoveryPlanInputProperties, +} +impl CreateRecoveryPlanInput { + pub fn new(properties: CreateRecoveryPlanInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Recovery plan creation properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateRecoveryPlanInputProperties { + #[doc = "The primary fabric Id."] + #[serde(rename = "primaryFabricId")] + pub primary_fabric_id: String, + #[doc = "The recovery fabric Id."] + #[serde(rename = "recoveryFabricId")] + pub recovery_fabric_id: String, + #[doc = "The failover deployment model."] + #[serde(rename = "failoverDeploymentModel", default, skip_serializing_if = "Option::is_none")] + pub failover_deployment_model: Option, + #[doc = "The recovery plan groups."] + pub groups: Vec, + #[doc = "The provider specific input."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_input: Vec, +} +impl CreateRecoveryPlanInputProperties { + pub fn new(primary_fabric_id: String, recovery_fabric_id: String, groups: Vec) -> Self { + Self { + primary_fabric_id, + recovery_fabric_id, + failover_deployment_model: None, + groups, + provider_specific_input: Vec::new(), + } + } +} +pub mod create_recovery_plan_input_properties { + use super::*; + #[doc = "The failover deployment model."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDeploymentModel { + NotApplicable, + Classic, + ResourceManager, + } +} +#[doc = "Current job details of the migration item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CurrentJobDetails { + #[doc = "The job name."] + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[doc = "The ARM Id of the job being executed."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The start time of the job."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +impl CurrentJobDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Current scenario details of the protected entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CurrentScenarioDetails { + #[doc = "Scenario name."] + #[serde(rename = "scenarioName", default, skip_serializing_if = "Option::is_none")] + pub scenario_name: Option, + #[doc = "ARM Id of the job being executed."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "Start time of the workflow."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, +} +impl CurrentScenarioDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The datastore details of the MT."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataStore { + #[doc = "The symbolic name of data store."] + #[serde(rename = "symbolicName", default, skip_serializing_if = "Option::is_none")] + pub symbolic_name: Option, + #[doc = "The uuid of data store."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "The capacity of data store in GBs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, + #[doc = "The free space of data store in GBs."] + #[serde(rename = "freeSpace", default, skip_serializing_if = "Option::is_none")] + pub free_space: Option, + #[doc = "The type of data store."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DataStore { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Disable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisableProtectionInput { + #[doc = "Disable protection input properties."] + pub properties: DisableProtectionInputProperties, +} +impl DisableProtectionInput { + pub fn new(properties: DisableProtectionInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Disable protection input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DisableProtectionInputProperties { + #[doc = "Disable protection reason. It can have values NotSpecified/MigrationComplete."] + #[serde(rename = "disableProtectionReason", default, skip_serializing_if = "Option::is_none")] + pub disable_protection_reason: Option, + #[doc = "Disable protection provider specific input."] + #[serde(rename = "replicationProviderInput", default, skip_serializing_if = "Option::is_none")] + pub replication_provider_input: Option, +} +impl DisableProtectionInputProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod disable_protection_input_properties { + use super::*; + #[doc = "Disable protection reason. It can have values NotSpecified/MigrationComplete."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DisableProtectionReason { + NotSpecified, + MigrationComplete, + } +} +#[doc = "Disable protection provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DisableProtectionProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl DisableProtectionProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Request to add a physical machine as a protectable item in a container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiscoverProtectableItemRequest { + #[doc = "Discover protectable item properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DiscoverProtectableItemRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Discover protectable item properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiscoverProtectableItemRequestProperties { + #[doc = "The friendly name of the physical machine."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The IP address of the physical machine to be discovered."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The OS type on the physical machine."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +impl DiscoverProtectableItemRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Onprem disk details data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskDetails { + #[doc = "The hard disk max size in MB."] + #[serde(rename = "maxSizeMB", default, skip_serializing_if = "Option::is_none")] + pub max_size_mb: Option, + #[doc = "The type of the volume."] + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[doc = "The VHD Id."] + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[doc = "The VHD name."] + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, +} +impl DiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery disk encryption info (BEK and KEK)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskEncryptionInfo { + #[doc = "Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows)."] + #[serde(rename = "diskEncryptionKeyInfo", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_key_info: Option, + #[doc = "Key Encryption Key (KEK) information."] + #[serde(rename = "keyEncryptionKeyInfo", default, skip_serializing_if = "Option::is_none")] + pub key_encryption_key_info: Option, +} +impl DiskEncryptionInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskEncryptionKeyInfo { + #[doc = "The secret url / identifier."] + #[serde(rename = "secretIdentifier", default, skip_serializing_if = "Option::is_none")] + pub secret_identifier: Option, + #[doc = "The KeyVault resource ARM id for secret."] + #[serde(rename = "keyVaultResourceArmId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_resource_arm_id: Option, +} +impl DiskEncryptionKeyInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Volume details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DiskVolumeDetails { + #[doc = "The volume label."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[doc = "The volume name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl DiskVolumeDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Display { + #[doc = "The provider. The localized friendly form of the resource provider name - it is expected to also include the publisher/company responsible. It should use Title Casing and begin with \"Microsoft\" for 1st party services. e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute.\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The resource. The localized friendly form of the resource related to this action/operation - it should match the public documentation for the resource provider. It should use Title Casing. This value should be unique for a particular URL type (e.g. nested types should *not* reuse their parent's display.resource field). e.g. \"Virtual Machines\" or \"Scheduler Job Collections\", or \"Virtual Machine VM Sizes\" or \"Scheduler Jobs\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The operation. The localized friendly name for the operation, as it should be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The description. The localized friendly description for the operation, as it should be shown to the user. It should be thorough, yet concise - it will be used in tool tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' 'ActionName' any 'display.resources'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl Display { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DRA details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DraDetails { + #[doc = "The DRA Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The DRA name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The DRA Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the DRA."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "The count of protected items which are protected in forward direction."] + #[serde(rename = "forwardProtectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub forward_protected_item_count: Option, + #[doc = "The count of protected items which are protected in reverse direction."] + #[serde(rename = "reverseProtectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub reverse_protected_item_count: Option, +} +impl DraDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod dra_details { + use super::*; + #[doc = "The health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Enable migration input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationInput { + #[doc = "Enable migration input properties."] + pub properties: EnableMigrationInputProperties, +} +impl EnableMigrationInput { + pub fn new(properties: EnableMigrationInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Enable migration input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationInputProperties { + #[doc = "The policy Id."] + #[serde(rename = "policyId")] + pub policy_id: String, + #[doc = "Enable migration provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: EnableMigrationProviderSpecificInput, +} +impl EnableMigrationInputProperties { + pub fn new(policy_id: String, provider_specific_details: EnableMigrationProviderSpecificInput) -> Self { + Self { + policy_id, + provider_specific_details, + } + } +} +#[doc = "Enable migration provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableMigrationProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl EnableMigrationProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EnableProtectionInput { + #[doc = "Enable protection input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EnableProtectionInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enable protection input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EnableProtectionInputProperties { + #[doc = "The Policy Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "The protectable item Id."] + #[serde(rename = "protectableItemId", default, skip_serializing_if = "Option::is_none")] + pub protectable_item_id: Option, + #[doc = "Enable protection provider specific input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl EnableProtectionInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enable protection provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnableProtectionProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl EnableProtectionProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Encryption details for the fabric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EncryptionDetails { + #[doc = "The key encryption key state for the Vmm."] + #[serde(rename = "kekState", default, skip_serializing_if = "Option::is_none")] + pub kek_state: Option, + #[doc = "The key encryption key certificate thumbprint."] + #[serde(rename = "kekCertThumbprint", default, skip_serializing_if = "Option::is_none")] + pub kek_cert_thumbprint: Option, + #[doc = "The key encryption key certificate expiry date."] + #[serde(rename = "kekCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub kek_cert_expiry_date: Option, +} +impl EncryptionDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Implements the Event class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Event { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The properties of a monitoring event."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Event { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of fabric details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EventCollection { + #[doc = "The list of events."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EventCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of a monitoring event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EventProperties { + #[doc = "The Id of the monitoring event."] + #[serde(rename = "eventCode", default, skip_serializing_if = "Option::is_none")] + pub event_code: Option, + #[doc = "The event name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The type of the event. for example: VM Health, Server Health, Job Failure etc."] + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[doc = "The friendly name of the source of the event on which it is raised (for example, VM, VMM etc)."] + #[serde(rename = "affectedObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub affected_object_friendly_name: Option, + #[doc = "The affected object correlationId for the event."] + #[serde(rename = "affectedObjectCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub affected_object_correlation_id: Option, + #[doc = "The severity of the event."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "The time of occurrence of the event."] + #[serde(rename = "timeOfOccurrence", default, skip_serializing_if = "Option::is_none")] + pub time_of_occurrence: Option, + #[doc = "The ARM ID of the fabric."] + #[serde(rename = "fabricId", default, skip_serializing_if = "Option::is_none")] + pub fabric_id: Option, + #[doc = "Model class for provider specific details for an event."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[doc = "Model class for event specific details for an event."] + #[serde(rename = "eventSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub event_specific_details: Option, + #[doc = "The list of errors / warnings capturing details associated with the issue(s)."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl EventProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Model class for provider specific details for an event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventProviderSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl EventProviderSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Implements the event query parameter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EventQueryParameter { + #[doc = "The source id of the events to be queried."] + #[serde(rename = "eventCode", default, skip_serializing_if = "Option::is_none")] + pub event_code: Option, + #[doc = "The severity of the events to be queried."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "The type of the events to be queried."] + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[doc = "The affected object server id of the events to be queried."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The affected object name of the events to be queried."] + #[serde(rename = "affectedObjectFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub affected_object_friendly_name: Option, + #[doc = "The affected object correlationId for the events to be queried."] + #[serde(rename = "affectedObjectCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub affected_object_correlation_id: Option, + #[doc = "The start time of the time range within which the events are to be queried."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time of the time range within which the events are to be queried."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, +} +impl EventQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Model class for event specific details for an event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl EventSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Existing storage account input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingProtectionProfile { + #[serde(flatten)] + pub protection_profile_custom_details: ProtectionProfileCustomDetails, + #[doc = "The protection profile Arm Id. Throw error, if resource does not exists."] + #[serde(rename = "protectionProfileId")] + pub protection_profile_id: String, +} +impl ExistingProtectionProfile { + pub fn new(protection_profile_custom_details: ProtectionProfileCustomDetails, protection_profile_id: String) -> Self { + Self { + protection_profile_custom_details, + protection_profile_id, + } + } +} +#[doc = "Existing recovery availability set input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryAvailabilitySet { + #[serde(flatten)] + pub recovery_availability_set_custom_details: RecoveryAvailabilitySetCustomDetails, + #[doc = "The recovery availability set Id. Will throw error, if resource does not exist."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, +} +impl ExistingRecoveryAvailabilitySet { + pub fn new(recovery_availability_set_custom_details: RecoveryAvailabilitySetCustomDetails) -> Self { + Self { + recovery_availability_set_custom_details, + recovery_availability_set_id: None, + } + } +} +#[doc = "Existing recovery proximity placement group input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryProximityPlacementGroup { + #[serde(flatten)] + pub recovery_proximity_placement_group_custom_details: RecoveryProximityPlacementGroupCustomDetails, + #[doc = "The recovery proximity placement group Id. Will throw error, if resource does not exist."] + #[serde(rename = "recoveryProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_proximity_placement_group_id: Option, +} +impl ExistingRecoveryProximityPlacementGroup { + pub fn new(recovery_proximity_placement_group_custom_details: RecoveryProximityPlacementGroupCustomDetails) -> Self { + Self { + recovery_proximity_placement_group_custom_details, + recovery_proximity_placement_group_id: None, + } + } +} +#[doc = "Existing recovery resource group input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryRecoveryResourceGroup { + #[serde(flatten)] + pub recovery_resource_group_custom_details: RecoveryResourceGroupCustomDetails, + #[doc = "The recovery resource group Id. Valid for V2 scenarios."] + #[serde(rename = "recoveryResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_resource_group_id: Option, +} +impl ExistingRecoveryRecoveryResourceGroup { + pub fn new(recovery_resource_group_custom_details: RecoveryResourceGroupCustomDetails) -> Self { + Self { + recovery_resource_group_custom_details, + recovery_resource_group_id: None, + } + } +} +#[doc = "Existing recovery virtual network input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingRecoveryVirtualNetwork { + #[serde(flatten)] + pub recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails, + #[doc = "The recovery virtual network Id. Will throw error, if resource does not exist."] + #[serde(rename = "recoveryVirtualNetworkId")] + pub recovery_virtual_network_id: String, + #[doc = "The recovery subnet name."] + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, +} +impl ExistingRecoveryVirtualNetwork { + pub fn new(recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails, recovery_virtual_network_id: String) -> Self { + Self { + recovery_virtual_network_custom_details, + recovery_virtual_network_id, + recovery_subnet_name: None, + } + } +} +#[doc = "Existing storage account input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExistingStorageAccount { + #[serde(flatten)] + pub storage_account_custom_details: StorageAccountCustomDetails, + #[doc = "The storage account Arm Id. Throw error, if resource does not exists."] + #[serde(rename = "azureStorageAccountId")] + pub azure_storage_account_id: String, +} +impl ExistingStorageAccount { + pub fn new(storage_account_custom_details: StorageAccountCustomDetails, azure_storage_account_id: String) -> Self { + Self { + storage_account_custom_details, + azure_storage_account_id, + } + } +} +#[doc = "This class represents details for export jobs workflow."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "BlobUri of the exported jobs."] + #[serde(rename = "blobUri", default, skip_serializing_if = "Option::is_none")] + pub blob_uri: Option, + #[doc = "The sas token to access blob."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, +} +impl ExportJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + blob_uri: None, + sas_token: None, + } + } +} +#[doc = "Extended location of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedLocation { + #[doc = "The name of the extended location."] + pub name: String, + #[doc = "The extended location type."] + #[serde(rename = "type")] + pub type_: extended_location::Type, +} +impl ExtendedLocation { + pub fn new(name: String, type_: extended_location::Type) -> Self { + Self { name, type_ } + } +} +pub mod extended_location { + use super::*; + #[doc = "The extended location type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + EdgeZone, + } +} +#[doc = "Fabric definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Fabric { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Fabric properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Fabric { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of fabric details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FabricCollection { + #[doc = "The fabric details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl FabricCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Site details provided during the time of site creation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FabricCreationInput { + #[doc = "Properties of site details provided during the time of site creation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl FabricCreationInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of site details provided during the time of site creation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FabricCreationInputProperties { + #[doc = "Fabric provider specific settings."] + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +impl FabricCreationInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Fabric properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FabricProperties { + #[doc = "Friendly name of the fabric."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Encryption details for the fabric."] + #[serde(rename = "encryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub encryption_details: Option, + #[doc = "Encryption details for the fabric."] + #[serde(rename = "rolloverEncryptionDetails", default, skip_serializing_if = "Option::is_none")] + pub rollover_encryption_details: Option, + #[doc = "Dra Registration Id."] + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[doc = "BCDR state of the fabric."] + #[serde(rename = "bcdrState", default, skip_serializing_if = "Option::is_none")] + pub bcdr_state: Option, + #[doc = "Fabric specific details."] + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, + #[doc = "Fabric health error details."] + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[doc = "Health of fabric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, +} +impl FabricProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameter to get fabric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FabricQueryParameter { + #[doc = "A value indicating whether the zone to zone mappings are to be returned."] + #[serde(rename = "zoneToZoneMappings", default, skip_serializing_if = "Option::is_none")] + pub zone_to_zone_mappings: Option, + #[doc = "A value indicating whether the agent details are to be fetched."] + #[serde(rename = "fetchAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub fetch_agent_details: Option, + #[doc = "The BIOS Id to be used for fetching agent details."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The FQDN to be used for fetching agent details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The type of the discovered machine to be used for fetching agent details."] + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[doc = "The OS type to be used for fetching agent details."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +impl FabricQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the fabric replication group task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricReplicationGroupTaskDetails { + #[serde(flatten)] + pub job_task_details: JobTaskDetails, + #[doc = "The skipped reason."] + #[serde(rename = "skippedReason", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason: Option, + #[doc = "The skipped reason string."] + #[serde(rename = "skippedReasonString", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason_string: Option, +} +impl FabricReplicationGroupTaskDetails { + pub fn new(job_task_details: JobTaskDetails) -> Self { + Self { + job_task_details, + skipped_reason: None, + skipped_reason_string: None, + } + } +} +#[doc = "Input details specific to fabrics during Network Mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificCreateNetworkMappingInput { + #[doc = "The instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl FabricSpecificCreateNetworkMappingInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Fabric provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificCreationInput { + #[doc = "Gets the class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl FabricSpecificCreationInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Fabric specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl FabricSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input details specific to fabrics during Network Mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FabricSpecificUpdateNetworkMappingInput { + #[doc = "The instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl FabricSpecificUpdateNetworkMappingInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "This class represents the details for a failover job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "The test VM details."] + #[serde(rename = "protectedItemDetails", default, skip_serializing_if = "Vec::is_empty")] + pub protected_item_details: Vec, +} +impl FailoverJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + protected_item_details: Vec::new(), + } + } +} +#[doc = "Request to failover a process server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FailoverProcessServerRequest { + #[doc = "The properties of the Failover Process Server request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl FailoverProcessServerRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the Failover Process Server request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FailoverProcessServerRequestProperties { + #[doc = "The container identifier."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The source process server."] + #[serde(rename = "sourceProcessServerId", default, skip_serializing_if = "Option::is_none")] + pub source_process_server_id: Option, + #[doc = "The new process server."] + #[serde(rename = "targetProcessServerId", default, skip_serializing_if = "Option::is_none")] + pub target_process_server_id: Option, + #[doc = "The VMS to migrate."] + #[serde(rename = "vmsToMigrate", default, skip_serializing_if = "Vec::is_empty")] + pub vms_to_migrate: Vec, + #[doc = "A value for failover type. It can be systemlevel/serverlevel."] + #[serde(rename = "updateType", default, skip_serializing_if = "Option::is_none")] + pub update_type: Option, +} +impl FailoverProcessServerRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Failover details for a replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FailoverReplicationProtectedItemDetails { + #[doc = "The name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The test Vm name."] + #[serde(rename = "testVmName", default, skip_serializing_if = "Option::is_none")] + pub test_vm_name: Option, + #[doc = "The test Vm friendly name."] + #[serde(rename = "testVmFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub test_vm_friendly_name: Option, + #[doc = "The network connection status."] + #[serde(rename = "networkConnectionStatus", default, skip_serializing_if = "Option::is_none")] + pub network_connection_status: Option, + #[doc = "The network friendly name."] + #[serde(rename = "networkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub network_friendly_name: Option, + #[doc = "The network subnet."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub subnet: Option, + #[doc = "The recovery point Id."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, + #[doc = "The recovery point time."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, +} +impl FailoverReplicationProtectedItemDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the group task details when parent child relationship exists in the drill down."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupTaskDetails { + #[doc = "The type of task details."] + #[serde(rename = "instanceType")] + pub instance_type: String, + #[doc = "The child tasks."] + #[serde(rename = "childTasks", default, skip_serializing_if = "Vec::is_empty")] + pub child_tasks: Vec, +} +impl GroupTaskDetails { + pub fn new(instance_type: String) -> Self { + Self { + instance_type, + child_tasks: Vec::new(), + } + } +} +#[doc = "Health Error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HealthError { + #[doc = "The inner health errors. HealthError having a list of HealthError as child errors is problematic. InnerHealthError is used because this will prevent an infinite loop of structures when Hydra tries to auto-generate the contract. We are exposing the related health errors as inner health errors and all API consumers can utilize this in the same fashion as Exception -> InnerException."] + #[serde(rename = "innerHealthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub inner_health_errors: Vec, + #[doc = "Source of error."] + #[serde(rename = "errorSource", default, skip_serializing_if = "Option::is_none")] + pub error_source: Option, + #[doc = "Type of error."] + #[serde(rename = "errorType", default, skip_serializing_if = "Option::is_none")] + pub error_type: Option, + #[doc = "Level of error."] + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[doc = "Category of error."] + #[serde(rename = "errorCategory", default, skip_serializing_if = "Option::is_none")] + pub error_category: Option, + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Summary message of the entity."] + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[doc = "Error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Possible causes of error."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "Recommended action to resolve error."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "Error creation time (UTC)."] + #[serde(rename = "creationTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[doc = "DRA error message."] + #[serde(rename = "recoveryProviderErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub recovery_provider_error_message: Option, + #[doc = "ID of the entity."] + #[serde(rename = "entityId", default, skip_serializing_if = "Option::is_none")] + pub entity_id: Option, + #[doc = "The health error unique id."] + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[doc = "Value indicating whether the health error is customer resolvable."] + #[serde(rename = "customerResolvability", default, skip_serializing_if = "Option::is_none")] + pub customer_resolvability: Option, +} +impl HealthError { + pub fn new() -> Self { + Self::default() + } +} +pub mod health_error { + use super::*; + #[doc = "Value indicating whether the health error is customer resolvable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolvability { + Allowed, + NotAllowed, + } +} +#[doc = "class to define the summary of the health error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HealthErrorSummary { + #[doc = "The code of the health error."] + #[serde(rename = "summaryCode", default, skip_serializing_if = "Option::is_none")] + pub summary_code: Option, + #[doc = "The category of the health error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "Severity of error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub severity: Option, + #[doc = "The summary message of the health error."] + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[doc = "The type of affected ARM resource."] + #[serde(rename = "affectedResourceType", default, skip_serializing_if = "Option::is_none")] + pub affected_resource_type: Option, + #[doc = "The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable."] + #[serde(rename = "affectedResourceSubtype", default, skip_serializing_if = "Option::is_none")] + pub affected_resource_subtype: Option, + #[doc = "The list of affected resource correlation Ids. This can be used to uniquely identify the count of items affected by a specific category and severity as well as count of item affected by an specific issue."] + #[serde(rename = "affectedResourceCorrelationIds", default, skip_serializing_if = "Vec::is_empty")] + pub affected_resource_correlation_ids: Vec, +} +impl HealthErrorSummary { + pub fn new() -> Self { + Self::default() + } +} +pub mod health_error_summary { + use super::*; + #[doc = "The category of the health error."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Category { + None, + Replication, + TestFailover, + Configuration, + FabricInfrastructure, + VersionExpiry, + AgentAutoUpdateInfra, + AgentAutoUpdateArtifactDeleted, + AgentAutoUpdateRunAsAccount, + AgentAutoUpdateRunAsAccountExpiry, + AgentAutoUpdateRunAsAccountExpired, + } + #[doc = "Severity of error."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Severity { + #[serde(rename = "NONE")] + None, + Warning, + Error, + Info, + } +} +#[doc = "Hyper-V host details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HyperVHostDetails { + #[doc = "The Hyper-V host Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The Hyper-V host name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Mars agent version."] + #[serde(rename = "marsAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version: Option, +} +impl HyperVHostDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Model class for event details of a HyperVReplica E2E event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplica2012EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The container friendly name."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The fabric friendly name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The remote container name."] + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[doc = "The remote fabric name."] + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +impl HyperVReplica2012EventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + container_name: None, + fabric_name: None, + remote_container_name: None, + remote_fabric_name: None, + } + } +} +#[doc = "Model class for event details of a HyperVReplica blue E2E event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplica2012R2EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The container friendly name."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The fabric friendly name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The remote container name."] + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[doc = "The remote fabric name."] + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +impl HyperVReplica2012R2EventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + container_name: None, + fabric_name: None, + remote_container_name: None, + remote_fabric_name: None, + } + } +} +#[doc = "ApplyRecoveryPoint input specific to HyperVReplicaAzure provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, + #[doc = "The primary kek certificate pfx."] + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[doc = "The secondary kek certificate pfx."] + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, +} +impl HyperVReplicaAzureApplyRecoveryPointInput { + pub fn new(apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput) -> Self { + Self { + apply_recovery_point_provider_specific_input, + primary_kek_certificate_pfx: None, + secondary_kek_certificate_pfx: None, + } + } +} +#[doc = "Disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HyperVReplicaAzureDiskInputDetails { + #[doc = "The DiskId."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The LogStorageAccountId."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The DiskType."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The DiskEncryptionSet ARM ID."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl HyperVReplicaAzureDiskInputDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod hyper_v_replica_azure_disk_input_details { + use super::*; + #[doc = "The DiskType."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "HyperVReplicaAzure specific enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The Hyper-V host VM Id."] + #[serde(rename = "hvHostVmId", default, skip_serializing_if = "Option::is_none")] + pub hv_host_vm_id: Option, + #[doc = "The VM Name."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "The OS type associated with VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The OS disk VHD id associated with VM."] + #[serde(rename = "vhdId", default, skip_serializing_if = "Option::is_none")] + pub vhd_id: Option, + #[doc = "The storage account Id."] + #[serde(rename = "targetStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_account_id: Option, + #[doc = "The selected target Azure network Id."] + #[serde(rename = "targetAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_network_id: Option, + #[doc = "The selected target Azure subnet Id."] + #[serde(rename = "targetAzureSubnetId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_subnet_id: Option, + #[doc = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum."] + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[doc = "The target azure VM Name."] + #[serde(rename = "targetAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub target_azure_vm_name: Option, + #[doc = "The storage account to be used for logging during replication."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The list of VHD Ids of disks to be protected."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[doc = "The Id of the target resource group (for classic deployment) in which the failover VM is to be created."] + #[serde(rename = "targetAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v1_resource_group_id: Option, + #[doc = "The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created."] + #[serde(rename = "targetAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v2_resource_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during failover."] + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[doc = "The target availability set ARM Id for resource manager deployment."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "License type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The proximity placement group ARM Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during replication."] + #[serde(rename = "useManagedDisksForReplication", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks_for_replication: Option, + #[doc = "The DiskType."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The disks to include list for managed disks."] + #[serde(rename = "disksToIncludeForManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include_for_managed_disks: Vec, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the seed managed disks."] + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +impl HyperVReplicaAzureEnableProtectionInput { + pub fn new(enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput) -> Self { + Self { + enable_protection_provider_specific_input, + hv_host_vm_id: None, + vm_name: None, + os_type: None, + vhd_id: None, + target_storage_account_id: None, + target_azure_network_id: None, + target_azure_subnet_id: None, + enable_rdp_on_target_option: None, + target_azure_vm_name: None, + log_storage_account_id: None, + disks_to_include: Vec::new(), + target_azure_v1_resource_group_id: None, + target_azure_v2_resource_group_id: None, + use_managed_disks: None, + target_availability_set_id: None, + target_availability_zone: None, + license_type: None, + sql_server_license_type: None, + target_vm_size: None, + target_proximity_placement_group_id: None, + use_managed_disks_for_replication: None, + disk_type: None, + disks_to_include_for_managed_disks: Vec::new(), + disk_encryption_set_id: None, + target_vm_tags: None, + seed_managed_disk_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + } + } +} +pub mod hyper_v_replica_azure_enable_protection_input { + use super::*; + #[doc = "License type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } + #[doc = "The DiskType."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "Model class for event details of a HyperVReplica E2A event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The container friendly name."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The fabric friendly name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The remote container name."] + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, +} +impl HyperVReplicaAzureEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + container_name: None, + fabric_name: None, + remote_container_name: None, + } + } +} +#[doc = "HyperVReplicaAzureFailback specific planned failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureFailbackProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[doc = "Data sync option."] + #[serde(rename = "dataSyncOption", default, skip_serializing_if = "Option::is_none")] + pub data_sync_option: Option, + #[doc = "ALR options to create alternate recovery."] + #[serde(rename = "recoveryVmCreationOption", default, skip_serializing_if = "Option::is_none")] + pub recovery_vm_creation_option: Option, + #[doc = "Provider Id for alternate location."] + #[serde(rename = "providerIdForAlternateRecovery", default, skip_serializing_if = "Option::is_none")] + pub provider_id_for_alternate_recovery: Option, +} +impl HyperVReplicaAzureFailbackProviderInput { + pub fn new(planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput) -> Self { + Self { + planned_failover_provider_specific_failover_input, + data_sync_option: None, + recovery_vm_creation_option: None, + provider_id_for_alternate_recovery: None, + } + } +} +#[doc = "Hyper-V Managed disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HyperVReplicaAzureManagedDiskDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "Seed managed disk Id."] + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[doc = "The replica disk type."] + #[serde(rename = "replicaDiskType", default, skip_serializing_if = "Option::is_none")] + pub replica_disk_type: Option, + #[doc = "The disk encryption set ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl HyperVReplicaAzureManagedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "HyperVReplicaAzure specific planned failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePlannedFailoverProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[doc = "Primary kek certificate pfx."] + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[doc = "Secondary kek certificate pfx."] + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl HyperVReplicaAzurePlannedFailoverProviderInput { + pub fn new(planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput) -> Self { + Self { + planned_failover_provider_specific_failover_input, + primary_kek_certificate_pfx: None, + secondary_kek_certificate_pfx: None, + recovery_point_id: None, + } + } +} +#[doc = "Hyper-V Replica Azure specific protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The duration (in hours) to which point the recovery history needs to be maintained."] + #[serde(rename = "recoveryPointHistoryDurationInHours", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_duration_in_hours: Option, + #[doc = "The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "The replication interval."] + #[serde(rename = "replicationInterval", default, skip_serializing_if = "Option::is_none")] + pub replication_interval: Option, + #[doc = "The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "A value indicating whether encryption is enabled for virtual machines in this cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "The active storage account Id."] + #[serde(rename = "activeStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub active_storage_account_id: Option, +} +impl HyperVReplicaAzurePolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_history_duration_in_hours: None, + application_consistent_snapshot_frequency_in_hours: None, + replication_interval: None, + online_replication_start_time: None, + encryption: None, + active_storage_account_id: None, + } + } +} +#[doc = "Hyper-V Replica Azure specific input for creating a protection profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzurePolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The duration (in hours) to which point the recovery history needs to be maintained."] + #[serde(rename = "recoveryPointHistoryDuration", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_duration: Option, + #[doc = "The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "The replication interval."] + #[serde(rename = "replicationInterval", default, skip_serializing_if = "Option::is_none")] + pub replication_interval: Option, + #[doc = "The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "The list of storage accounts to which the VMs in the primary cloud can replicate to."] + #[serde(rename = "storageAccounts", default, skip_serializing_if = "Vec::is_empty")] + pub storage_accounts: Vec, +} +impl HyperVReplicaAzurePolicyInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + recovery_point_history_duration: None, + application_consistent_snapshot_frequency_in_hours: None, + replication_interval: None, + online_replication_start_time: None, + storage_accounts: Vec::new(), + } + } +} +#[doc = "Hyper V Replica Azure provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "Azure VM Disk details."] + #[serde(rename = "azureVmDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub azure_vm_disk_details: Vec, + #[doc = "Recovery Azure given name."] + #[serde(rename = "recoveryAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[doc = "The Recovery Azure VM size."] + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[doc = "The recovery Azure storage account."] + #[serde(rename = "recoveryAzureStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account: Option, + #[doc = "The ARM id of the log storage account used for replication. This will be set to null if no log storage account was provided during enable protection."] + #[serde(rename = "recoveryAzureLogStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_log_storage_account_id: Option, + #[doc = "The Last replication time."] + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[doc = "Last RPO value."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "The last RPO calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "Initial replication details."] + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The selected recovery azure network Id."] + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[doc = "The selected source nic Id which will be used as the primary nic during failover."] + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[doc = "The encryption info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "Disk Details."] + #[serde(rename = "oSDetails", default, skip_serializing_if = "Option::is_none")] + pub o_s_details: Option, + #[doc = "The RAM size of the VM on the primary side."] + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[doc = "The CPU count of the VM on the primary side."] + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[doc = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum."] + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[doc = "The target resource group Id."] + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[doc = "The recovery availability set Id."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during failover."] + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[doc = "License Type of the VM to be used."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The last recovery point received time."] + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the seed managed disks."] + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[doc = "The list of protected managed disks."] + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, +} +impl HyperVReplicaAzureReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + azure_vm_disk_details: Vec::new(), + recovery_azure_vm_name: None, + recovery_azure_vm_size: None, + recovery_azure_storage_account: None, + recovery_azure_log_storage_account_id: None, + last_replicated_time: None, + rpo_in_seconds: None, + last_rpo_calculated_time: None, + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + initial_replication_details: None, + vm_nics: Vec::new(), + selected_recovery_azure_network_id: None, + selected_source_nic_id: None, + encryption: None, + o_s_details: None, + source_vm_ram_size_in_mb: None, + source_vm_cpu_count: None, + enable_rdp_on_target_option: None, + recovery_azure_resource_group_id: None, + recovery_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + use_managed_disks: None, + license_type: None, + sql_server_license_type: None, + last_recovery_point_received: None, + target_vm_tags: None, + seed_managed_disk_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + protected_managed_disks: Vec::new(), + } + } +} +#[doc = "Azure specific reprotect input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The Hyper-V host Vm Id."] + #[serde(rename = "hvHostVmId", default, skip_serializing_if = "Option::is_none")] + pub hv_host_vm_id: Option, + #[doc = "The Vm Name."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "The OS type associated with vm."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The OS disk VHD id associated with vm."] + #[serde(rename = "vHDId", default, skip_serializing_if = "Option::is_none")] + pub v_hd_id: Option, + #[doc = "The storage account name."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[doc = "The storage account to be used for logging during replication."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, +} +impl HyperVReplicaAzureReprotectInput { + pub fn new(reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput) -> Self { + Self { + reverse_replication_provider_specific_input, + hv_host_vm_id: None, + vm_name: None, + os_type: None, + v_hd_id: None, + storage_account_id: None, + log_storage_account_id: None, + } + } +} +#[doc = "HvrA provider specific input for test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[doc = "Primary kek certificate pfx."] + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[doc = "Secondary kek certificate pfx."] + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[doc = "The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl HyperVReplicaAzureTestFailoverInput { + pub fn new(test_failover_provider_specific_input: TestFailoverProviderSpecificInput) -> Self { + Self { + test_failover_provider_specific_input, + primary_kek_certificate_pfx: None, + secondary_kek_certificate_pfx: None, + recovery_point_id: None, + } + } +} +#[doc = "HvrA provider specific input for unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[doc = "Primary kek certificate pfx."] + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[doc = "Secondary kek certificate pfx."] + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl HyperVReplicaAzureUnplannedFailoverInput { + pub fn new(unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput) -> Self { + Self { + unplanned_failover_provider_specific_input, + primary_kek_certificate_pfx: None, + secondary_kek_certificate_pfx: None, + recovery_point_id: None, + } + } +} +#[doc = "HyperV replica Azure input to update replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaAzureUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[doc = "The recovery Azure resource group Id for classic deployment."] + #[serde(rename = "recoveryAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v1_resource_group_id: Option, + #[doc = "The recovery Azure resource group Id for resource manager deployment."] + #[serde(rename = "recoveryAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v2_resource_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during failover."] + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[doc = "The dictionary of disk resource Id to disk encryption set ARM Id."] + #[serde(rename = "diskIdToDiskEncryptionMap", default, skip_serializing_if = "Option::is_none")] + pub disk_id_to_disk_encryption_map: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The list of disk update properties."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, +} +impl HyperVReplicaAzureUpdateReplicationProtectedItemInput { + pub fn new(update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput) -> Self { + Self { + update_replication_protected_item_provider_input, + recovery_azure_v1_resource_group_id: None, + recovery_azure_v2_resource_group_id: None, + use_managed_disks: None, + disk_id_to_disk_encryption_map: None, + target_proximity_placement_group_id: None, + target_availability_zone: None, + target_vm_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + sql_server_license_type: None, + vm_disks: Vec::new(), + } + } +} +pub mod hyper_v_replica_azure_update_replication_protected_item_input { + use super::*; + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Abstract model class for event details of a HyperVReplica E2E event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBaseEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The container friendly name."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The fabric friendly name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The remote container name."] + #[serde(rename = "remoteContainerName", default, skip_serializing_if = "Option::is_none")] + pub remote_container_name: Option, + #[doc = "The remote fabric name."] + #[serde(rename = "remoteFabricName", default, skip_serializing_if = "Option::is_none")] + pub remote_fabric_name: Option, +} +impl HyperVReplicaBaseEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + container_name: None, + fabric_name: None, + remote_container_name: None, + remote_fabric_name: None, + } + } +} +#[doc = "Base class for HyperVReplica policy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBasePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "A value indicating the number of recovery points."] + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[doc = "A value indicating the application consistent frequency."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "A value indicating whether compression has to be enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[doc = "A value indicating whether IR is online."] + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[doc = "A value indicating the online IR start time."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "A value indicating the offline IR import path."] + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[doc = "A value indicating the offline IR export path."] + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[doc = "A value indicating the recovery HTTPS port."] + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[doc = "A value indicating the authentication type."] + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[doc = "A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud."] + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +impl HyperVReplicaBasePolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_points: None, + application_consistent_snapshot_frequency_in_hours: None, + compression: None, + initial_replication_method: None, + online_replication_start_time: None, + offline_replication_import_path: None, + offline_replication_export_path: None, + replication_port: None, + allowed_authentication_type: None, + replica_deletion_option: None, + } + } +} +#[doc = "Hyper V replica provider specific settings base class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBaseReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The Last replication time."] + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "Initial replication details."] + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[doc = "VM disk details."] + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +impl HyperVReplicaBaseReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + last_replicated_time: None, + vm_nics: Vec::new(), + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + initial_replication_details: None, + v_m_disk_details: Vec::new(), + } + } +} +#[doc = "Hyper-V Replica Blue specific protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBluePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "A value indicating the replication interval."] + #[serde(rename = "replicationFrequencyInSeconds", default, skip_serializing_if = "Option::is_none")] + pub replication_frequency_in_seconds: Option, + #[doc = "A value indicating the number of recovery points."] + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[doc = "A value indicating the application consistent frequency."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "A value indicating whether compression has to be enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[doc = "A value indicating whether IR is online."] + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[doc = "A value indicating the online IR start time."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "A value indicating the offline IR import path."] + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[doc = "A value indicating the offline IR export path."] + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[doc = "A value indicating the recovery HTTPS port."] + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[doc = "A value indicating the authentication type."] + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[doc = "A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud"] + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +impl HyperVReplicaBluePolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + replication_frequency_in_seconds: None, + recovery_points: None, + application_consistent_snapshot_frequency_in_hours: None, + compression: None, + initial_replication_method: None, + online_replication_start_time: None, + offline_replication_import_path: None, + offline_replication_export_path: None, + replication_port: None, + allowed_authentication_type: None, + replica_deletion_option: None, + } + } +} +#[doc = "HyperV Replica Blue policy input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBluePolicyInput { + #[serde(flatten)] + pub hyper_v_replica_policy_input: HyperVReplicaPolicyInput, + #[doc = "A value indicating the replication interval."] + #[serde(rename = "replicationFrequencyInSeconds", default, skip_serializing_if = "Option::is_none")] + pub replication_frequency_in_seconds: Option, +} +impl HyperVReplicaBluePolicyInput { + pub fn new(hyper_v_replica_policy_input: HyperVReplicaPolicyInput) -> Self { + Self { + hyper_v_replica_policy_input, + replication_frequency_in_seconds: None, + } + } +} +#[doc = "HyperV replica 2012 R2 (Blue) replication details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaBlueReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The Last replication time."] + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "Initial replication details."] + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[doc = "VM disk details."] + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +impl HyperVReplicaBlueReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + last_replicated_time: None, + vm_nics: Vec::new(), + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + initial_replication_details: None, + v_m_disk_details: Vec::new(), + } + } +} +#[doc = "Hyper-V Replica Blue specific protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "A value indicating the number of recovery points."] + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[doc = "A value indicating the application consistent frequency."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "A value indicating whether compression has to be enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[doc = "A value indicating whether IR is online."] + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[doc = "A value indicating the online IR start time."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "A value indicating the offline IR import path."] + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[doc = "A value indicating the offline IR export path."] + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[doc = "A value indicating the recovery HTTPS port."] + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[doc = "A value indicating the authentication type."] + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[doc = "A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud"] + #[serde(rename = "replicaDeletionOption", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion_option: Option, +} +impl HyperVReplicaPolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_points: None, + application_consistent_snapshot_frequency_in_hours: None, + compression: None, + initial_replication_method: None, + online_replication_start_time: None, + offline_replication_import_path: None, + offline_replication_export_path: None, + replication_port: None, + allowed_authentication_type: None, + replica_deletion_option: None, + } + } +} +#[doc = "Hyper-V Replica specific policy Input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaPolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "A value indicating the number of recovery points."] + #[serde(rename = "recoveryPoints", default, skip_serializing_if = "Option::is_none")] + pub recovery_points: Option, + #[doc = "A value indicating the application consistent frequency."] + #[serde( + rename = "applicationConsistentSnapshotFrequencyInHours", + default, + skip_serializing_if = "Option::is_none" + )] + pub application_consistent_snapshot_frequency_in_hours: Option, + #[doc = "A value indicating whether compression has to be enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[doc = "A value indicating whether IR is online."] + #[serde(rename = "initialReplicationMethod", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_method: Option, + #[doc = "A value indicating the online IR start time."] + #[serde(rename = "onlineReplicationStartTime", default, skip_serializing_if = "Option::is_none")] + pub online_replication_start_time: Option, + #[doc = "A value indicating the offline IR import path."] + #[serde(rename = "offlineReplicationImportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_import_path: Option, + #[doc = "A value indicating the offline IR export path."] + #[serde(rename = "offlineReplicationExportPath", default, skip_serializing_if = "Option::is_none")] + pub offline_replication_export_path: Option, + #[doc = "A value indicating the recovery HTTPS port."] + #[serde(rename = "replicationPort", default, skip_serializing_if = "Option::is_none")] + pub replication_port: Option, + #[doc = "A value indicating the authentication type."] + #[serde(rename = "allowedAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub allowed_authentication_type: Option, + #[doc = "A value indicating whether the VM has to be auto deleted."] + #[serde(rename = "replicaDeletion", default, skip_serializing_if = "Option::is_none")] + pub replica_deletion: Option, +} +impl HyperVReplicaPolicyInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + recovery_points: None, + application_consistent_snapshot_frequency_in_hours: None, + compression: None, + initial_replication_method: None, + online_replication_start_time: None, + offline_replication_import_path: None, + offline_replication_export_path: None, + replication_port: None, + allowed_authentication_type: None, + replica_deletion: None, + } + } +} +#[doc = "HyperV replica 2012 replication details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVReplicaReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The Last replication time."] + #[serde(rename = "lastReplicatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_replicated_time: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "Initial replication details."] + #[serde(rename = "initialReplicationDetails", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_details: Option, + #[doc = "VM disk details."] + #[serde(rename = "vMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub v_m_disk_details: Vec, +} +impl HyperVReplicaReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + last_replicated_time: None, + vm_nics: Vec::new(), + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + initial_replication_details: None, + v_m_disk_details: Vec::new(), + } + } +} +#[doc = "HyperVSite fabric specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVSiteDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[doc = "The list of Hyper-V hosts associated with the fabric."] + #[serde(rename = "hyperVHosts", default, skip_serializing_if = "Vec::is_empty")] + pub hyper_v_hosts: Vec, +} +impl HyperVSiteDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { + fabric_specific_details, + hyper_v_hosts: Vec::new(), + } + } +} +#[doc = "Single Host fabric provider specific VM settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HyperVVirtualMachineDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, + #[doc = "The source id of the object."] + #[serde(rename = "sourceItemId", default, skip_serializing_if = "Option::is_none")] + pub source_item_id: Option, + #[doc = "The id of the object in fabric."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub generation: Option, + #[doc = "Disk Details."] + #[serde(rename = "osDetails", default, skip_serializing_if = "Option::is_none")] + pub os_details: Option, + #[doc = "The Last successful failover time."] + #[serde(rename = "diskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub disk_details: Vec, + #[doc = "A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum."] + #[serde(rename = "hasPhysicalDisk", default, skip_serializing_if = "Option::is_none")] + pub has_physical_disk: Option, + #[doc = "A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus enum."] + #[serde(rename = "hasFibreChannelAdapter", default, skip_serializing_if = "Option::is_none")] + pub has_fibre_channel_adapter: Option, + #[doc = "A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum."] + #[serde(rename = "hasSharedVhd", default, skip_serializing_if = "Option::is_none")] + pub has_shared_vhd: Option, + #[doc = "The Id of the hyper-v host in fabric."] + #[serde(rename = "hyperVHostId", default, skip_serializing_if = "Option::is_none")] + pub hyper_v_host_id: Option, +} +impl HyperVVirtualMachineDetails { + pub fn new(configuration_settings: ConfigurationSettings) -> Self { + Self { + configuration_settings, + source_item_id: None, + generation: None, + os_details: None, + disk_details: Vec::new(), + has_physical_disk: None, + has_fibre_channel_adapter: None, + has_shared_vhd: None, + hyper_v_host_id: None, + } + } +} +pub mod hyper_v_virtual_machine_details { + use super::*; + #[doc = "A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasPhysicalDisk { + Unknown, + Present, + NotPresent, + } + #[doc = "A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus enum."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasFibreChannelAdapter { + Unknown, + Present, + NotPresent, + } + #[doc = "A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HasSharedVhd { + Unknown, + Present, + NotPresent, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigDetails { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isPrimary", default, skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + #[serde(rename = "subnetName", default, skip_serializing_if = "Option::is_none")] + pub subnet_name: Option, + #[serde(rename = "staticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub static_ip_address: Option, + #[serde(rename = "ipAddressType", default, skip_serializing_if = "Option::is_none")] + pub ip_address_type: Option, + #[serde(rename = "isSeletedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_seleted_for_failover: Option, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[serde(rename = "recoveryStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub recovery_static_ip_address: Option, + #[serde(rename = "recoveryIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub recovery_ip_address_type: Option, + #[serde(rename = "recoveryPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub recovery_public_ip_address_id: Option, + #[serde(rename = "recoveryLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_lb_backend_address_pool_ids: Vec, + #[serde(rename = "tfoSubnetName", default, skip_serializing_if = "Option::is_none")] + pub tfo_subnet_name: Option, + #[serde(rename = "tfoStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub tfo_static_ip_address: Option, + #[serde(rename = "tfoPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub tfo_public_ip_address_id: Option, + #[serde(rename = "tfoLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub tfo_lb_backend_address_pool_ids: Vec, +} +impl IpConfigDetails { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IpConfigInputDetails { + #[serde(rename = "ipConfigName", default, skip_serializing_if = "Option::is_none")] + pub ip_config_name: Option, + #[serde(rename = "isPrimary", default, skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + #[serde(rename = "isSeletedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_seleted_for_failover: Option, + #[serde(rename = "recoverySubnetName", default, skip_serializing_if = "Option::is_none")] + pub recovery_subnet_name: Option, + #[serde(rename = "recoveryStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub recovery_static_ip_address: Option, + #[serde(rename = "recoveryPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub recovery_public_ip_address_id: Option, + #[serde(rename = "recoveryLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub recovery_lb_backend_address_pool_ids: Vec, + #[serde(rename = "tfoSubnetName", default, skip_serializing_if = "Option::is_none")] + pub tfo_subnet_name: Option, + #[serde(rename = "tfoStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub tfo_static_ip_address: Option, + #[serde(rename = "tfoPublicIPAddressId", default, skip_serializing_if = "Option::is_none")] + pub tfo_public_ip_address_id: Option, + #[serde(rename = "tfoLBBackendAddressPoolIds", default, skip_serializing_if = "Vec::is_empty")] + pub tfo_lb_backend_address_pool_ids: Vec, +} +impl IpConfigInputDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IdentityProviderDetails { + #[doc = "The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "applicationId", default, skip_serializing_if = "Option::is_none")] + pub application_id: Option, + #[doc = "The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")] + pub object_id: Option, + #[doc = "The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[doc = "The base authority for Azure Active Directory authentication."] + #[serde(rename = "aadAuthority", default, skip_serializing_if = "Option::is_none")] + pub aad_authority: Option, +} +impl IdentityProviderDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Identity provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityProviderInput { + #[doc = "The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "tenantId")] + pub tenant_id: String, + #[doc = "The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "applicationId")] + pub application_id: String, + #[doc = "The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + #[serde(rename = "objectId")] + pub object_id: String, + #[doc = "The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services."] + pub audience: String, + #[doc = "The base authority for Azure Active Directory authentication."] + #[serde(rename = "aadAuthority")] + pub aad_authority: String, +} +impl IdentityProviderInput { + pub fn new(tenant_id: String, application_id: String, object_id: String, audience: String, aad_authority: String) -> Self { + Self { + tenant_id, + application_id, + object_id, + audience, + aad_authority, + } + } +} +#[doc = "The details of the InMage agent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAgentDetails { + #[doc = "The agent version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "A value indicating whether installed agent needs to be updated."] + #[serde(rename = "agentUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub agent_update_status: Option, + #[doc = "A value indicating whether reboot is required after update is applied."] + #[serde(rename = "postUpdateRebootStatus", default, skip_serializing_if = "Option::is_none")] + pub post_update_reboot_status: Option, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, +} +impl InMageAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ApplyRecoveryPoint input specific to InMageAzureV2 provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, +} +impl InMageAzureV2ApplyRecoveryPointInput { + pub fn new(apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput) -> Self { + Self { + apply_recovery_point_provider_specific_input, + } + } +} +#[doc = "Disk input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAzureV2DiskInputDetails { + #[doc = "The DiskId."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The LogStorageAccountId."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The DiskType."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The DiskEncryptionSet ARM ID."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl InMageAzureV2DiskInputDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod in_mage_azure_v2_disk_input_details { + use super::*; + #[doc = "The DiskType."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "VMware Azure specific enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2EnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The Master target Id."] + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[doc = "The Process Server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The storage account Id."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[doc = "The CS account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The multi VM group Id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "The multi VM group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[doc = "The selected target Azure network Id."] + #[serde(rename = "targetAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_network_id: Option, + #[doc = "The selected target Azure subnet Id."] + #[serde(rename = "targetAzureSubnetId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_subnet_id: Option, + #[doc = "The selected option to enable RDP\\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum."] + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[doc = "The target azure VM Name."] + #[serde(rename = "targetAzureVmName", default, skip_serializing_if = "Option::is_none")] + pub target_azure_vm_name: Option, + #[doc = "The storage account to be used for logging during replication."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The Id of the target resource group (for classic deployment) in which the failover VM is to be created."] + #[serde(rename = "targetAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v1_resource_group_id: Option, + #[doc = "The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created."] + #[serde(rename = "targetAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_azure_v2_resource_group_id: Option, + #[doc = "The DiskType."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The target availability set ARM Id for resource manager deployment."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The proximity placement group ARM Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "License type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the seed managed disks."] + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +impl InMageAzureV2EnableProtectionInput { + pub fn new(enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput) -> Self { + Self { + enable_protection_provider_specific_input, + master_target_id: None, + process_server_id: None, + storage_account_id: None, + run_as_account_id: None, + multi_vm_group_id: None, + multi_vm_group_name: None, + disks_to_include: Vec::new(), + target_azure_network_id: None, + target_azure_subnet_id: None, + enable_rdp_on_target_option: None, + target_azure_vm_name: None, + log_storage_account_id: None, + target_azure_v1_resource_group_id: None, + target_azure_v2_resource_group_id: None, + disk_type: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + license_type: None, + sql_server_license_type: None, + target_vm_size: None, + disk_encryption_set_id: None, + target_vm_tags: None, + seed_managed_disk_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + } + } +} +pub mod in_mage_azure_v2_enable_protection_input { + use super::*; + #[doc = "The DiskType."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } + #[doc = "License type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Model class for event details of a VMwareAzureV2 event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2EventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType."] + #[serde(rename = "eventType", default, skip_serializing_if = "Option::is_none")] + pub event_type: Option, + #[doc = "InMage Event Category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "InMage Event Component."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub component: Option, + #[doc = "Corrective Action string for the event."] + #[serde(rename = "correctiveAction", default, skip_serializing_if = "Option::is_none")] + pub corrective_action: Option, + #[doc = "InMage Event Details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub details: Option, + #[doc = "InMage Event Summary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[doc = "VMware Site name."] + #[serde(rename = "siteName", default, skip_serializing_if = "Option::is_none")] + pub site_name: Option, +} +impl InMageAzureV2EventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + event_type: None, + category: None, + component: None, + corrective_action: None, + details: None, + summary: None, + site_name: None, + } + } +} +#[doc = "InMageAzureV2 Managed disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAzureV2ManagedDiskDetails { + #[doc = "The disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "Seed managed disk Id."] + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[doc = "The replica disk type."] + #[serde(rename = "replicaDiskType", default, skip_serializing_if = "Option::is_none")] + pub replica_disk_type: Option, + #[doc = "The DiskEncryptionSet ARM ID."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The target disk name."] + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +impl InMageAzureV2ManagedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMage Azure v2 specific protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2PolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The crash consistent snapshot frequency in minutes."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +impl InMageAzureV2PolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + crash_consistent_frequency_in_minutes: None, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status: None, + } + } +} +#[doc = "VMWare Azure specific policy Input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2PolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: in_mage_azure_v2_policy_input::MultiVmSyncStatus, +} +impl InMageAzureV2PolicyInput { + pub fn new( + policy_provider_specific_input: PolicyProviderSpecificInput, + multi_vm_sync_status: in_mage_azure_v2_policy_input::MultiVmSyncStatus, + ) -> Self { + Self { + policy_provider_specific_input, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status, + } + } +} +pub mod in_mage_azure_v2_policy_input { + use super::*; + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[doc = "InMageAzureV2 protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAzureV2ProtectedDiskDetails { + #[doc = "The disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The protection stage."] + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[doc = "The health error code for the disk."] + #[serde(rename = "healthErrorCode", default, skip_serializing_if = "Option::is_none")] + pub health_error_code: Option, + #[doc = "The RPO in seconds."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "A value indicating whether resync is required for this disk."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The resync progress percentage."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The resync duration in seconds."] + #[serde(rename = "resyncDurationInSeconds", default, skip_serializing_if = "Option::is_none")] + pub resync_duration_in_seconds: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[doc = "The disk file system capacity in bytes."] + #[serde(rename = "fileSystemCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub file_system_capacity_in_bytes: Option, + #[doc = "The source data transit in MB."] + #[serde(rename = "sourceDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub source_data_in_mega_bytes: Option, + #[doc = "The PS data transit in MB."] + #[serde(rename = "psDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub ps_data_in_mega_bytes: Option, + #[doc = "The target data transit in MB."] + #[serde(rename = "targetDataInMegaBytes", default, skip_serializing_if = "Option::is_none")] + pub target_data_in_mega_bytes: Option, + #[doc = "A value indicating whether disk is resized."] + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[doc = "The last RPO calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The resync processed bytes."] + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[doc = "The resync total transferred bytes."] + #[serde(rename = "resyncTotalTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_total_transferred_bytes: Option, + #[doc = "The resync last 15 minutes transferred bytes."] + #[serde(rename = "resyncLast15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_last15_minutes_transferred_bytes: Option, + #[doc = "The last data transfer time in UTC."] + #[serde(rename = "resyncLastDataTransferTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub resync_last_data_transfer_time_utc: Option, + #[doc = "The resync start time."] + #[serde(rename = "resyncStartTime", default, skip_serializing_if = "Option::is_none")] + pub resync_start_time: Option, + #[doc = "The Progress Health."] + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[doc = "The Progress Status."] + #[serde(rename = "progressStatus", default, skip_serializing_if = "Option::is_none")] + pub progress_status: Option, + #[doc = "The seconds to take for switch provider."] + #[serde(rename = "secondsToTakeSwitchProvider", default, skip_serializing_if = "Option::is_none")] + pub seconds_to_take_switch_provider: Option, +} +impl InMageAzureV2ProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMage Azure V2 provider specific recovery point details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2RecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[doc = "A value indicating whether the recovery point is multi VM consistent."] + #[serde(rename = "isMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub is_multi_vm_sync_point: Option, +} +impl InMageAzureV2RecoveryPointDetails { + pub fn new(provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails) -> Self { + Self { + provider_specific_recovery_point_details, + is_multi_vm_sync_point: None, + } + } +} +#[doc = "InMageAzureV2 provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The infrastructure VM Id."] + #[serde(rename = "infrastructureVmId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_vm_id: Option, + #[doc = "The vCenter infrastructure Id."] + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[doc = "The protection stage."] + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "The resync progress percentage."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The RPO in seconds."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "The compressed data change rate in MB."] + #[serde(rename = "compressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub compressed_data_rate_in_mb: Option, + #[doc = "The uncompressed data change rate in MB."] + #[serde(rename = "uncompressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub uncompressed_data_rate_in_mb: Option, + #[doc = "The source IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The agent version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[doc = "A value indicating whether installed agent needs to be updated."] + #[serde(rename = "isAgentUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_agent_update_required: Option, + #[doc = "A value indicating whether the source server requires a restart after update."] + #[serde(rename = "isRebootAfterUpdateRequired", default, skip_serializing_if = "Option::is_none")] + pub is_reboot_after_update_required: Option, + #[doc = "The last heartbeat received from the source server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "The process server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The process server name."] + #[serde(rename = "processServerName", default, skip_serializing_if = "Option::is_none")] + pub process_server_name: Option, + #[doc = "The multi vm group Id."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "The multi vm group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "A value indicating whether multi vm sync is enabled or disabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "A value indicating whether any disk is resized for this VM."] + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[doc = "The master target Id."] + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[doc = "The CPU count of the VM on the primary side."] + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[doc = "The RAM size of the VM on the primary side."] + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[doc = "The type of the OS on the VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The OS disk VHD name."] + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, + #[doc = "The id of the disk containing the OS."] + #[serde(rename = "osDiskId", default, skip_serializing_if = "Option::is_none")] + pub os_disk_id: Option, + #[doc = "Azure VM Disk details."] + #[serde(rename = "azureVMDiskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub azure_vm_disk_details: Vec, + #[doc = "Recovery Azure given name."] + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[doc = "The Recovery Azure VM size."] + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[doc = "The recovery Azure storage account."] + #[serde(rename = "recoveryAzureStorageAccount", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_storage_account: Option, + #[doc = "The ARM id of the log storage account used for replication. This will be set to null if no log storage account was provided during enable protection."] + #[serde(rename = "recoveryAzureLogStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_log_storage_account_id: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The selected recovery azure network Id."] + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[doc = "The test failover virtual network."] + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[doc = "The selected source nic Id which will be used as the primary nic during failover."] + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[doc = "A value indicating the discovery type of the machine. Value can be vCenter or physical."] + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[doc = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum."] + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[doc = "The datastores of the on-premise machine. Value can be list of strings that contain datastore names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[doc = "The ARM Id of the target Azure VM. This value will be null until the VM is failed over. Only after failure it will be populated with the ARM Id of the Azure VM."] + #[serde(rename = "targetVmId", default, skip_serializing_if = "Option::is_none")] + pub target_vm_id: Option, + #[doc = "The target resource group Id."] + #[serde(rename = "recoveryAzureResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_resource_group_id: Option, + #[doc = "The recovery availability set Id."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during failover."] + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[doc = "License Type of the VM to be used."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The validation errors of the on-premise machine Value can be list of validation errors."] + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[doc = "The last RPO calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The last update time received from on-prem components."] + #[serde(rename = "lastUpdateReceivedTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_received_time: Option, + #[doc = "The replica id of the protected item."] + #[serde(rename = "replicaId", default, skip_serializing_if = "Option::is_none")] + pub replica_id: Option, + #[doc = "The OS Version of the protected item."] + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[doc = "The list of protected managed disks."] + #[serde(rename = "protectedManagedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_managed_disks: Vec, + #[doc = "The last recovery point received time."] + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[doc = "The firmware type of this protected item."] + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[doc = "The target generation for this protected item."] + #[serde(rename = "azureVmGeneration", default, skip_serializing_if = "Option::is_none")] + pub azure_vm_generation: Option, + #[doc = "A value indicating whether additional IR stats are available or not."] + #[serde(rename = "isAdditionalStatsAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_additional_stats_available: Option, + #[doc = "The total transferred data in bytes."] + #[serde(rename = "totalDataTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_data_transferred: Option, + #[doc = "The progress health."] + #[serde(rename = "totalProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub total_progress_health: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the seed managed disks."] + #[serde(rename = "seedManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[doc = "The switch provider blocking error information."] + #[serde(rename = "switchProviderBlockingErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub switch_provider_blocking_error_details: Vec, + #[doc = "InMageAzureV2 switch provider details."] + #[serde(rename = "switchProviderDetails", default, skip_serializing_if = "Option::is_none")] + pub switch_provider_details: Option, +} +impl InMageAzureV2ReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + infrastructure_vm_id: None, + v_center_infrastructure_id: None, + protection_stage: None, + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + resync_progress_percentage: None, + rpo_in_seconds: None, + compressed_data_rate_in_mb: None, + uncompressed_data_rate_in_mb: None, + ip_address: None, + agent_version: None, + agent_expiry_date: None, + is_agent_update_required: None, + is_reboot_after_update_required: None, + last_heartbeat: None, + process_server_id: None, + process_server_name: None, + multi_vm_group_id: None, + multi_vm_group_name: None, + multi_vm_sync_status: None, + protected_disks: Vec::new(), + disk_resized: None, + master_target_id: None, + source_vm_cpu_count: None, + source_vm_ram_size_in_mb: None, + os_type: None, + vhd_name: None, + os_disk_id: None, + azure_vm_disk_details: Vec::new(), + recovery_azure_vm_name: None, + recovery_azure_vm_size: None, + recovery_azure_storage_account: None, + recovery_azure_log_storage_account_id: None, + vm_nics: Vec::new(), + selected_recovery_azure_network_id: None, + selected_tfo_azure_network_id: None, + selected_source_nic_id: None, + discovery_type: None, + enable_rdp_on_target_option: None, + datastores: Vec::new(), + target_vm_id: None, + recovery_azure_resource_group_id: None, + recovery_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + use_managed_disks: None, + license_type: None, + sql_server_license_type: None, + validation_errors: Vec::new(), + last_rpo_calculated_time: None, + last_update_received_time: None, + replica_id: None, + os_version: None, + protected_managed_disks: Vec::new(), + last_recovery_point_received: None, + firmware_type: None, + azure_vm_generation: None, + is_additional_stats_available: None, + total_data_transferred: None, + total_progress_health: None, + target_vm_tags: None, + seed_managed_disk_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + switch_provider_blocking_error_details: Vec::new(), + switch_provider_details: None, + } + } +} +#[doc = "InMageAzureV2 specific provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2ReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The Master target Id."] + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[doc = "The Process Server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The storage account id."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[doc = "The CS account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The Policy Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "The storage account to be used for logging during replication."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +impl InMageAzureV2ReprotectInput { + pub fn new(reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput) -> Self { + Self { + reverse_replication_provider_specific_input, + master_target_id: None, + process_server_id: None, + storage_account_id: None, + run_as_account_id: None, + policy_id: None, + log_storage_account_id: None, + disks_to_include: Vec::new(), + } + } +} +#[doc = "InMageAzureV2 switch provider blocking error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAzureV2SwitchProviderBlockingErrorDetails { + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error message parameters."] + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[doc = "The error tags."] + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +impl InMageAzureV2SwitchProviderBlockingErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageAzureV2 switch provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageAzureV2SwitchProviderDetails { + #[doc = "The target vault Id."] + #[serde(rename = "targetVaultId", default, skip_serializing_if = "Option::is_none")] + pub target_vault_id: Option, + #[doc = "The target resource Id."] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + #[doc = "The target fabric Id."] + #[serde(rename = "targetFabricId", default, skip_serializing_if = "Option::is_none")] + pub target_fabric_id: Option, + #[doc = "The target appliance Id."] + #[serde(rename = "targetApplianceId", default, skip_serializing_if = "Option::is_none")] + pub target_appliance_id: Option, +} +impl InMageAzureV2SwitchProviderDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific input for InMageAzureV2 switch provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2SwitchProviderProviderInput { + #[serde(flatten)] + pub switch_provider_provider_specific_input: SwitchProviderProviderSpecificInput, + #[doc = "The target vault Id."] + #[serde(rename = "targetVaultID")] + pub target_vault_id: String, + #[doc = "The target fabric Id."] + #[serde(rename = "targetFabricID")] + pub target_fabric_id: String, + #[doc = "The target appliance Id."] + #[serde(rename = "targetApplianceID")] + pub target_appliance_id: String, +} +impl InMageAzureV2SwitchProviderProviderInput { + pub fn new( + switch_provider_provider_specific_input: SwitchProviderProviderSpecificInput, + target_vault_id: String, + target_fabric_id: String, + target_appliance_id: String, + ) -> Self { + Self { + switch_provider_provider_specific_input, + target_vault_id, + target_fabric_id, + target_appliance_id, + } + } +} +#[doc = "InMageAzureV2 provider specific input for test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2TestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[doc = "The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageAzureV2TestFailoverInput { + pub fn new(test_failover_provider_specific_input: TestFailoverProviderSpecificInput) -> Self { + Self { + test_failover_provider_specific_input, + recovery_point_id: None, + } + } +} +#[doc = "InMageAzureV2 provider specific input for unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2UnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageAzureV2UnplannedFailoverInput { + pub fn new(unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput) -> Self { + Self { + unplanned_failover_provider_specific_input, + recovery_point_id: None, + } + } +} +#[doc = "InMage Azure V2 input to update replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageAzureV2UpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[doc = "The recovery Azure resource group Id for classic deployment."] + #[serde(rename = "recoveryAzureV1ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v1_resource_group_id: Option, + #[doc = "The recovery Azure resource group Id for resource manager deployment."] + #[serde(rename = "recoveryAzureV2ResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_v2_resource_group_id: Option, + #[doc = "A value indicating whether managed disks should be used during failover."] + #[serde(rename = "useManagedDisks", default, skip_serializing_if = "Option::is_none")] + pub use_managed_disks: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the target managed disks."] + #[serde(rename = "targetManagedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The list of disk update properties."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, +} +impl InMageAzureV2UpdateReplicationProtectedItemInput { + pub fn new(update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput) -> Self { + Self { + update_replication_protected_item_provider_input, + recovery_azure_v1_resource_group_id: None, + recovery_azure_v2_resource_group_id: None, + use_managed_disks: None, + target_proximity_placement_group_id: None, + target_availability_zone: None, + target_vm_tags: None, + target_managed_disk_tags: None, + target_nic_tags: None, + sql_server_license_type: None, + vm_disks: Vec::new(), + } + } +} +pub mod in_mage_azure_v2_update_replication_protected_item_input { + use super::*; + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Base class for the policies of providers using InMage replication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageBasePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +impl InMageBasePolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status: None, + } + } +} +#[doc = "InMage disable protection provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageDisableProtectionProviderSpecificInput { + #[serde(flatten)] + pub disable_protection_provider_specific_input: DisableProtectionProviderSpecificInput, + #[doc = "A value indicating whether the replica VM should be destroyed or retained. Values from Delete and Retain."] + #[serde(rename = "replicaVmDeletionStatus", default, skip_serializing_if = "Option::is_none")] + pub replica_vm_deletion_status: Option, +} +impl InMageDisableProtectionProviderSpecificInput { + pub fn new(disable_protection_provider_specific_input: DisableProtectionProviderSpecificInput) -> Self { + Self { + disable_protection_provider_specific_input, + replica_vm_deletion_status: None, + } + } +} +#[doc = "VMware/Physical specific Disk Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageDiskDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The disk size in MB."] + #[serde(rename = "diskSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_in_mb: Option, + #[doc = "Whether disk is system disk or data disk."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "Whether disk is dynamic disk or basic disk."] + #[serde(rename = "diskConfiguration", default, skip_serializing_if = "Option::is_none")] + pub disk_configuration: Option, + #[doc = "Volumes of the disk."] + #[serde(rename = "volumeList", default, skip_serializing_if = "Vec::is_empty")] + pub volume_list: Vec, +} +impl InMageDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DiskExclusionInput when doing enable protection of virtual machine in InMage provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageDiskExclusionInput { + #[doc = "The volume label based option for disk exclusion."] + #[serde(rename = "volumeOptions", default, skip_serializing_if = "Vec::is_empty")] + pub volume_options: Vec, + #[doc = "The guest disk signature based option for disk exclusion."] + #[serde(rename = "diskSignatureOptions", default, skip_serializing_if = "Vec::is_empty")] + pub disk_signature_options: Vec, +} +impl InMageDiskExclusionInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageDiskSignatureExclusionOptions { + #[doc = "The guest signature of disk to be excluded from replication."] + #[serde(rename = "diskSignature", default, skip_serializing_if = "Option::is_none")] + pub disk_signature: Option, +} +impl InMageDiskSignatureExclusionOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VMware Azure specific enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The VM Name."] + #[serde(rename = "vmFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub vm_friendly_name: Option, + #[doc = "The Master Target Id."] + #[serde(rename = "masterTargetId")] + pub master_target_id: String, + #[doc = "The Process Server Id."] + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[doc = "The retention drive to use on the MT."] + #[serde(rename = "retentionDrive")] + pub retention_drive: String, + #[doc = "The CS account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The multi VM group Id."] + #[serde(rename = "multiVmGroupId")] + pub multi_vm_group_id: String, + #[doc = "The multi VM group name."] + #[serde(rename = "multiVmGroupName")] + pub multi_vm_group_name: String, + #[doc = "The target datastore name."] + #[serde(rename = "datastoreName", default, skip_serializing_if = "Option::is_none")] + pub datastore_name: Option, + #[doc = "DiskExclusionInput when doing enable protection of virtual machine in InMage provider."] + #[serde(rename = "diskExclusionInput", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_input: Option, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +impl InMageEnableProtectionInput { + pub fn new( + enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + master_target_id: String, + process_server_id: String, + retention_drive: String, + multi_vm_group_id: String, + multi_vm_group_name: String, + ) -> Self { + Self { + enable_protection_provider_specific_input, + vm_friendly_name: None, + master_target_id, + process_server_id, + retention_drive, + run_as_account_id: None, + multi_vm_group_id, + multi_vm_group_name, + datastore_name: None, + disk_exclusion_input: None, + disks_to_include: Vec::new(), + } + } +} +#[doc = "InMageFabric switch provider blocking error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageFabricSwitchProviderBlockingErrorDetails { + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error message parameters."] + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[doc = "The error tags."] + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +impl InMageFabricSwitchProviderBlockingErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMage specific protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMagePolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, +} +impl InMagePolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status: None, + } + } +} +#[doc = "VMWare Azure specific protection profile Input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMagePolicyInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The recovery point threshold in minutes."] + #[serde(rename = "recoveryPointThresholdInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_threshold_in_minutes: Option, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: in_mage_policy_input::MultiVmSyncStatus, +} +impl InMagePolicyInput { + pub fn new( + policy_provider_specific_input: PolicyProviderSpecificInput, + multi_vm_sync_status: in_mage_policy_input::MultiVmSyncStatus, + ) -> Self { + Self { + policy_provider_specific_input, + recovery_point_threshold_in_minutes: None, + recovery_point_history: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status, + } + } +} +pub mod in_mage_policy_input { + use super::*; + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[doc = "InMage protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageProtectedDiskDetails { + #[doc = "The disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The protection stage."] + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[doc = "The health error code for the disk."] + #[serde(rename = "healthErrorCode", default, skip_serializing_if = "Option::is_none")] + pub health_error_code: Option, + #[doc = "The RPO in seconds."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "A value indicating whether resync is required for this disk."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The resync progress percentage."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The resync duration in seconds."] + #[serde(rename = "resyncDurationInSeconds", default, skip_serializing_if = "Option::is_none")] + pub resync_duration_in_seconds: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "diskCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub disk_capacity_in_bytes: Option, + #[doc = "The file system capacity in bytes."] + #[serde(rename = "fileSystemCapacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub file_system_capacity_in_bytes: Option, + #[doc = "The source data transit in MB."] + #[serde(rename = "sourceDataInMB", default, skip_serializing_if = "Option::is_none")] + pub source_data_in_mb: Option, + #[doc = "The PS data transit in MB."] + #[serde(rename = "psDataInMB", default, skip_serializing_if = "Option::is_none")] + pub ps_data_in_mb: Option, + #[doc = "The target data transit in MB."] + #[serde(rename = "targetDataInMB", default, skip_serializing_if = "Option::is_none")] + pub target_data_in_mb: Option, + #[doc = "A value indicating whether disk is resized."] + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[doc = "The last RPO calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The resync processed bytes."] + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[doc = "The resync total transferred bytes."] + #[serde(rename = "resyncTotalTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_total_transferred_bytes: Option, + #[doc = "The resync last 15 minutes transferred bytes."] + #[serde(rename = "resyncLast15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_last15_minutes_transferred_bytes: Option, + #[doc = "The last data transfer time in UTC."] + #[serde(rename = "resyncLastDataTransferTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub resync_last_data_transfer_time_utc: Option, + #[doc = "The resync start time."] + #[serde(rename = "resyncStartTime", default, skip_serializing_if = "Option::is_none")] + pub resync_start_time: Option, + #[doc = "The Progress Health."] + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[doc = "The Progress Status."] + #[serde(rename = "progressStatus", default, skip_serializing_if = "Option::is_none")] + pub progress_status: Option, +} +impl InMageProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm source agent upgrade blocking error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmAgentUpgradeBlockingErrorDetails { + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error message parameters."] + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[doc = "The error tags."] + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +impl InMageRcmAgentUpgradeBlockingErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm appliance details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmApplianceDetails { + #[doc = "The appliance Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The appliance name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The fabric ARM Id."] + #[serde(rename = "fabricArmId", default, skip_serializing_if = "Option::is_none")] + pub fabric_arm_id: Option, + #[doc = "Process server details."] + #[serde(rename = "processServer", default, skip_serializing_if = "Option::is_none")] + pub process_server: Option, + #[doc = "RCM proxy details."] + #[serde(rename = "rcmProxy", default, skip_serializing_if = "Option::is_none")] + pub rcm_proxy: Option, + #[doc = "Push installer details."] + #[serde(rename = "pushInstaller", default, skip_serializing_if = "Option::is_none")] + pub push_installer: Option, + #[doc = "Replication agent details."] + #[serde(rename = "replicationAgent", default, skip_serializing_if = "Option::is_none")] + pub replication_agent: Option, + #[doc = "Reprotect agent details."] + #[serde(rename = "reprotectAgent", default, skip_serializing_if = "Option::is_none")] + pub reprotect_agent: Option, + #[doc = "Mars agent details."] + #[serde(rename = "marsAgent", default, skip_serializing_if = "Option::is_none")] + pub mars_agent: Option, + #[doc = "DRA details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dra: Option, + #[doc = "The switch provider blocking error information."] + #[serde(rename = "switchProviderBlockingErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub switch_provider_blocking_error_details: Vec, +} +impl InMageRcmApplianceDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm appliance specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmApplianceSpecificDetails { + #[serde(flatten)] + pub appliance_specific_details: ApplianceSpecificDetails, + #[doc = "The list of appliances."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub appliances: Vec, +} +impl InMageRcmApplianceSpecificDetails { + pub fn new(appliance_specific_details: ApplianceSpecificDetails) -> Self { + Self { + appliance_specific_details, + appliances: Vec::new(), + } + } +} +#[doc = "ApplyRecoveryPoint input specific to InMageRcm provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmApplyRecoveryPointInput { + #[serde(flatten)] + pub apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, + #[doc = "The recovery point Id."] + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, +} +impl InMageRcmApplyRecoveryPointInput { + pub fn new(apply_recovery_point_provider_specific_input: ApplyRecoveryPointProviderSpecificInput, recovery_point_id: String) -> Self { + Self { + apply_recovery_point_provider_specific_input, + recovery_point_id, + } + } +} +#[doc = "InMageRcm discovered protected VM details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmDiscoveredProtectedVmDetails { + #[doc = "The VCenter Id."] + #[serde(rename = "vCenterId", default, skip_serializing_if = "Option::is_none")] + pub v_center_id: Option, + #[doc = "The VCenter fqdn."] + #[serde(rename = "vCenterFqdn", default, skip_serializing_if = "Option::is_none")] + pub v_center_fqdn: Option, + #[doc = "The list of datastores."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[doc = "The list of IP addresses."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "The VMware tools status."] + #[serde(rename = "vmwareToolsStatus", default, skip_serializing_if = "Option::is_none")] + pub vmware_tools_status: Option, + #[doc = "The VM power status."] + #[serde(rename = "powerStatus", default, skip_serializing_if = "Option::is_none")] + pub power_status: Option, + #[doc = "The VM fqdn."] + #[serde(rename = "vmFqdn", default, skip_serializing_if = "Option::is_none")] + pub vm_fqdn: Option, + #[doc = "The VM's OS name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "The SDS created timestamp."] + #[serde(rename = "createdTimestamp", default, skip_serializing_if = "Option::is_none")] + pub created_timestamp: Option, + #[doc = "The SDS updated timestamp."] + #[serde(rename = "updatedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub updated_timestamp: Option, + #[doc = "A value indicating whether the VM is deleted."] + #[serde(rename = "isDeleted", default, skip_serializing_if = "Option::is_none")] + pub is_deleted: Option, + #[doc = "The last time when SDS information discovered in SRS."] + #[serde(rename = "lastDiscoveryTimeInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_time_in_utc: Option, +} +impl InMageRcmDiscoveredProtectedVmDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm disk input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmDiskInput { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[doc = "The disk type."] + #[serde(rename = "diskType")] + pub disk_type: in_mage_rcm_disk_input::DiskType, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl InMageRcmDiskInput { + pub fn new(disk_id: String, log_storage_account_id: String, disk_type: in_mage_rcm_disk_input::DiskType) -> Self { + Self { + disk_id, + log_storage_account_id, + disk_type, + disk_encryption_set_id: None, + } + } +} +pub mod in_mage_rcm_disk_input { + use super::*; + #[doc = "The disk type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "InMageRcm disk input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmDisksDefaultInput { + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[doc = "The disk type."] + #[serde(rename = "diskType")] + pub disk_type: in_mage_rcm_disks_default_input::DiskType, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl InMageRcmDisksDefaultInput { + pub fn new(log_storage_account_id: String, disk_type: in_mage_rcm_disks_default_input::DiskType) -> Self { + Self { + log_storage_account_id, + disk_type, + disk_encryption_set_id: None, + } + } +} +pub mod in_mage_rcm_disks_default_input { + use super::*; + #[doc = "The disk type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "InMageRcm specific enable protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmEnableProtectionInput { + #[serde(flatten)] + pub enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + #[doc = "The ARM Id of discovered machine."] + #[serde(rename = "fabricDiscoveryMachineId")] + pub fabric_discovery_machine_id: String, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, + #[doc = "InMageRcm disk input."] + #[serde(rename = "disksDefault", default, skip_serializing_if = "Option::is_none")] + pub disks_default: Option, + #[doc = "The target resource group ARM Id."] + #[serde(rename = "targetResourceGroupId")] + pub target_resource_group_id: String, + #[doc = "The selected target network ARM Id."] + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[doc = "The selected test network ARM Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "The selected target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "The selected test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The license type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The target availability set ARM Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "The run-as account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The process server Id."] + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[doc = "The multi VM group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, +} +impl InMageRcmEnableProtectionInput { + pub fn new( + enable_protection_provider_specific_input: EnableProtectionProviderSpecificInput, + fabric_discovery_machine_id: String, + target_resource_group_id: String, + process_server_id: String, + ) -> Self { + Self { + enable_protection_provider_specific_input, + fabric_discovery_machine_id, + disks_to_include: Vec::new(), + disks_default: None, + target_resource_group_id, + target_network_id: None, + test_network_id: None, + target_subnet_name: None, + test_subnet_name: None, + target_vm_name: None, + target_vm_size: None, + license_type: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + run_as_account_id: None, + process_server_id, + multi_vm_group_name: None, + } + } +} +pub mod in_mage_rcm_enable_protection_input { + use super::*; + #[doc = "The license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[doc = "Event details for InMageRcm provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The protected item name."] + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[doc = "The protected item name."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "The latest agent version."] + #[serde(rename = "latestAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_agent_version: Option, + #[doc = "The job Id."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The fabric name."] + #[serde(rename = "fabricName", default, skip_serializing_if = "Option::is_none")] + pub fabric_name: Option, + #[doc = "The appliance name."] + #[serde(rename = "applianceName", default, skip_serializing_if = "Option::is_none")] + pub appliance_name: Option, + #[doc = "The server type."] + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[doc = "The component display name."] + #[serde(rename = "componentDisplayName", default, skip_serializing_if = "Option::is_none")] + pub component_display_name: Option, +} +impl InMageRcmEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + protected_item_name: None, + vm_name: None, + latest_agent_version: None, + job_id: None, + fabric_name: None, + appliance_name: None, + server_type: None, + component_display_name: None, + } + } +} +#[doc = "InMageRcm fabric provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[doc = "The ARM Id of the VMware site."] + #[serde(rename = "vmwareSiteId")] + pub vmware_site_id: String, + #[doc = "The ARM Id of the physical site."] + #[serde(rename = "physicalSiteId")] + pub physical_site_id: String, + #[doc = "Identity provider input."] + #[serde(rename = "sourceAgentIdentity")] + pub source_agent_identity: IdentityProviderInput, +} +impl InMageRcmFabricCreationInput { + pub fn new( + fabric_specific_creation_input: FabricSpecificCreationInput, + vmware_site_id: String, + physical_site_id: String, + source_agent_identity: IdentityProviderInput, + ) -> Self { + Self { + fabric_specific_creation_input, + vmware_site_id, + physical_site_id, + source_agent_identity, + } + } +} +#[doc = "InMageRcm fabric specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[doc = "The ARM Id of the VMware site."] + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[doc = "The ARM Id of the physical site."] + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[doc = "The service endpoint."] + #[serde(rename = "serviceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_endpoint: Option, + #[doc = "The service resource Id."] + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, + #[doc = "The service container Id."] + #[serde(rename = "serviceContainerId", default, skip_serializing_if = "Option::is_none")] + pub service_container_id: Option, + #[doc = "The data plane Uri."] + #[serde(rename = "dataPlaneUri", default, skip_serializing_if = "Option::is_none")] + pub data_plane_uri: Option, + #[doc = "The control plane Uri."] + #[serde(rename = "controlPlaneUri", default, skip_serializing_if = "Option::is_none")] + pub control_plane_uri: Option, + #[doc = "Identity provider details."] + #[serde(rename = "sourceAgentIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub source_agent_identity_details: Option, + #[doc = "The list of process servers."] + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, + #[doc = "The list of RCM proxies."] + #[serde(rename = "rcmProxies", default, skip_serializing_if = "Vec::is_empty")] + pub rcm_proxies: Vec, + #[doc = "The list of push installers."] + #[serde(rename = "pushInstallers", default, skip_serializing_if = "Vec::is_empty")] + pub push_installers: Vec, + #[doc = "The list of replication agents."] + #[serde(rename = "replicationAgents", default, skip_serializing_if = "Vec::is_empty")] + pub replication_agents: Vec, + #[doc = "The list of reprotect agents."] + #[serde(rename = "reprotectAgents", default, skip_serializing_if = "Vec::is_empty")] + pub reprotect_agents: Vec, + #[doc = "The list of Mars agents."] + #[serde(rename = "marsAgents", default, skip_serializing_if = "Vec::is_empty")] + pub mars_agents: Vec, + #[doc = "The list of DRAs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub dras: Vec, + #[doc = "The list of agent details."] + #[serde(rename = "agentDetails", default, skip_serializing_if = "Vec::is_empty")] + pub agent_details: Vec, +} +impl InMageRcmFabricSpecificDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { + fabric_specific_details, + vmware_site_id: None, + physical_site_id: None, + service_endpoint: None, + service_resource_id: None, + service_container_id: None, + data_plane_uri: None, + control_plane_uri: None, + source_agent_identity_details: None, + process_servers: Vec::new(), + rcm_proxies: Vec::new(), + push_installers: Vec::new(), + replication_agents: Vec::new(), + reprotect_agents: Vec::new(), + mars_agents: Vec::new(), + dras: Vec::new(), + agent_details: Vec::new(), + } + } +} +#[doc = "InMageRcmFabric switch provider blocking error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFabricSwitchProviderBlockingErrorDetails { + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error message parameters."] + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[doc = "The error tags."] + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +impl InMageRcmFabricSwitchProviderBlockingErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcmFailback discovered VM details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFailbackDiscoveredProtectedVmDetails { + #[doc = "The VCenter Id."] + #[serde(rename = "vCenterId", default, skip_serializing_if = "Option::is_none")] + pub v_center_id: Option, + #[doc = "The VCenter fqdn."] + #[serde(rename = "vCenterFqdn", default, skip_serializing_if = "Option::is_none")] + pub v_center_fqdn: Option, + #[doc = "The list of datastores."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[doc = "The list of IP addresses."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "The VMware tools status."] + #[serde(rename = "vmwareToolsStatus", default, skip_serializing_if = "Option::is_none")] + pub vmware_tools_status: Option, + #[doc = "The VM power status."] + #[serde(rename = "powerStatus", default, skip_serializing_if = "Option::is_none")] + pub power_status: Option, + #[doc = "The VM fqdn."] + #[serde(rename = "vmFqdn", default, skip_serializing_if = "Option::is_none")] + pub vm_fqdn: Option, + #[doc = "The VM's OS name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "The SDS created timestamp."] + #[serde(rename = "createdTimestamp", default, skip_serializing_if = "Option::is_none")] + pub created_timestamp: Option, + #[doc = "The SDS updated timestamp."] + #[serde(rename = "updatedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub updated_timestamp: Option, + #[doc = "A value indicating whether the VM is deleted."] + #[serde(rename = "isDeleted", default, skip_serializing_if = "Option::is_none")] + pub is_deleted: Option, + #[doc = "The last time when SDS information discovered in SRS."] + #[serde(rename = "lastDiscoveryTimeInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_time_in_utc: Option, +} +impl InMageRcmFailbackDiscoveredProtectedVmDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Event details for InMageRcmFailback provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The protected item name."] + #[serde(rename = "protectedItemName", default, skip_serializing_if = "Option::is_none")] + pub protected_item_name: Option, + #[doc = "The protected item name."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "The appliance name."] + #[serde(rename = "applianceName", default, skip_serializing_if = "Option::is_none")] + pub appliance_name: Option, + #[doc = "The server type."] + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[doc = "The component display name."] + #[serde(rename = "componentDisplayName", default, skip_serializing_if = "Option::is_none")] + pub component_display_name: Option, +} +impl InMageRcmFailbackEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + protected_item_name: None, + vm_name: None, + appliance_name: None, + server_type: None, + component_display_name: None, + } + } +} +#[doc = "InMageRcmFailback mobility agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFailbackMobilityAgentDetails { + #[doc = "The agent version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The latest agent version available."] + #[serde(rename = "latestVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_version: Option, + #[doc = "The driver version."] + #[serde(rename = "driverVersion", default, skip_serializing_if = "Option::is_none")] + pub driver_version: Option, + #[doc = "The latest upgradeable version available without reboot."] + #[serde(rename = "latestUpgradableVersionWithoutReboot", default, skip_serializing_if = "Option::is_none")] + pub latest_upgradable_version_without_reboot: Option, + #[doc = "The agent version expiry date."] + #[serde(rename = "agentVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_version_expiry_date: Option, + #[doc = "The driver version expiry date."] + #[serde(rename = "driverVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub driver_version_expiry_date: Option, + #[doc = "The time of the last heartbeat received from the agent."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The whether update is possible or not."] + #[serde(rename = "reasonsBlockingUpgrade", default, skip_serializing_if = "Vec::is_empty")] + pub reasons_blocking_upgrade: Vec, + #[doc = "A value indicating whether agent is upgradeable or not."] + #[serde(rename = "isUpgradeable", default, skip_serializing_if = "Option::is_none")] + pub is_upgradeable: Option, +} +impl InMageRcmFailbackMobilityAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcmFailback NIC details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFailbackNicDetails { + #[doc = "The mac address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[doc = "The network name."] + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[doc = "The adapter type."] + #[serde(rename = "adapterType", default, skip_serializing_if = "Option::is_none")] + pub adapter_type: Option, + #[doc = "The IP address."] + #[serde(rename = "sourceIpAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, +} +impl InMageRcmFailbackNicDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific input for InMageRcmFailback failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPlannedFailoverProviderInput { + #[serde(flatten)] + pub planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: in_mage_rcm_failback_planned_failover_provider_input::RecoveryPointType, +} +impl InMageRcmFailbackPlannedFailoverProviderInput { + pub fn new( + planned_failover_provider_specific_failover_input: PlannedFailoverProviderSpecificFailoverInput, + recovery_point_type: in_mage_rcm_failback_planned_failover_provider_input::RecoveryPointType, + ) -> Self { + Self { + planned_failover_provider_specific_failover_input, + recovery_point_type, + } + } +} +pub mod in_mage_rcm_failback_planned_failover_provider_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + ApplicationConsistent, + CrashConsistent, + } +} +#[doc = "InMageRcmFailback policy creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, +} +impl InMageRcmFailbackPolicyCreationInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + } + } +} +#[doc = "InMageRcm failback specific policy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "The crash consistent snapshot frequency in minutes."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} +impl InMageRcmFailbackPolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + app_consistent_frequency_in_minutes: None, + crash_consistent_frequency_in_minutes: None, + } + } +} +#[doc = "InMageRcmFailback protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFailbackProtectedDiskDetails { + #[doc = "The disk Id (reported by source agent)."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[doc = "The disk Uuid (reported by vCenter)."] + #[serde(rename = "diskUuid", default, skip_serializing_if = "Option::is_none")] + pub disk_uuid: Option, + #[doc = "The data pending in log data store in MB."] + #[serde(rename = "dataPendingInLogDataStoreInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_in_log_data_store_in_mb: Option, + #[doc = "The data pending at source agent in MB."] + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[doc = "A value indicating whether initial replication is complete or not."] + #[serde(rename = "isInitialReplicationComplete", default, skip_serializing_if = "Option::is_none")] + pub is_initial_replication_complete: Option, + #[doc = "InMageRcmFailback disk level sync details."] + #[serde(rename = "irDetails", default, skip_serializing_if = "Option::is_none")] + pub ir_details: Option, + #[doc = "InMageRcmFailback disk level sync details."] + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, + #[doc = "The last sync time."] + #[serde(rename = "lastSyncTime", default, skip_serializing_if = "Option::is_none")] + pub last_sync_time: Option, +} +impl InMageRcmFailbackProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcmFailback provider specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The virtual machine internal identifier."] + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[doc = "The ARM Id of the azure VM."] + #[serde(rename = "azureVirtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub azure_virtual_machine_id: Option, + #[doc = "The multi VM group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The reprotect agent Id."] + #[serde(rename = "reprotectAgentId", default, skip_serializing_if = "Option::is_none")] + pub reprotect_agent_id: Option, + #[doc = "The reprotect agent name."] + #[serde(rename = "reprotectAgentName", default, skip_serializing_if = "Option::is_none")] + pub reprotect_agent_name: Option, + #[doc = "The type of the OS on the VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The target vCenter Id."] + #[serde(rename = "targetvCenterId", default, skip_serializing_if = "Option::is_none")] + pub targetv_center_id: Option, + #[doc = "The target datastore name."] + #[serde(rename = "targetDataStoreName", default, skip_serializing_if = "Option::is_none")] + pub target_data_store_name: Option, + #[doc = "The target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The initial replication progress percentage."] + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, + #[doc = "The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM."] + #[serde(rename = "initialReplicationProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_processed_bytes: Option, + #[doc = "The initial replication transferred bytes from source VM to target for all selected disks on source VM."] + #[serde(rename = "initialReplicationTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_transferred_bytes: Option, + #[doc = "The initial replication progress health."] + #[serde(rename = "initialReplicationProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_health: Option, + #[doc = "The resync progress percentage."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM."] + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[doc = "The resync transferred bytes from source VM to target for all selected disks on source VM."] + #[serde(rename = "resyncTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_transferred_bytes: Option, + #[doc = "The resync progress health."] + #[serde(rename = "resyncProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_health: Option, + #[doc = "A value indicating whether resync is required."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The resync state."] + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "InMageRcmFailback mobility agent details."] + #[serde(rename = "mobilityAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub mobility_agent_details: Option, + #[doc = "The network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The last planned failover start time."] + #[serde(rename = "lastPlannedFailoverStartTime", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_start_time: Option, + #[doc = "The last planned failover status."] + #[serde(rename = "lastPlannedFailoverStatus", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_status: Option, + #[doc = "InMageRcmFailback discovered VM details."] + #[serde(rename = "discoveredVmDetails", default, skip_serializing_if = "Option::is_none")] + pub discovered_vm_details: Option, + #[doc = "The policy Id used by the forward replication."] + #[serde(rename = "lastUsedPolicyId", default, skip_serializing_if = "Option::is_none")] + pub last_used_policy_id: Option, + #[doc = "The policy friendly name used by the forward replication."] + #[serde(rename = "lastUsedPolicyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub last_used_policy_friendly_name: Option, + #[doc = "A value indicating whether agent registration was successful after failover."] + #[serde( + rename = "isAgentRegistrationSuccessfulAfterFailover", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_agent_registration_successful_after_failover: Option, +} +impl InMageRcmFailbackReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + internal_identifier: None, + azure_virtual_machine_id: None, + multi_vm_group_name: None, + reprotect_agent_id: None, + reprotect_agent_name: None, + os_type: None, + log_storage_account_id: None, + targetv_center_id: None, + target_data_store_name: None, + target_vm_name: None, + initial_replication_progress_percentage: None, + initial_replication_processed_bytes: None, + initial_replication_transferred_bytes: None, + initial_replication_progress_health: None, + resync_progress_percentage: None, + resync_processed_bytes: None, + resync_transferred_bytes: None, + resync_progress_health: None, + resync_required: None, + resync_state: None, + protected_disks: Vec::new(), + mobility_agent_details: None, + vm_nics: Vec::new(), + last_planned_failover_start_time: None, + last_planned_failover_status: None, + discovered_vm_details: None, + last_used_policy_id: None, + last_used_policy_friendly_name: None, + is_agent_registration_successful_after_failover: None, + } + } +} +pub mod in_mage_rcm_failback_replication_details { + use super::*; + #[doc = "The initial replication progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InitialReplicationProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[doc = "The resync progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[doc = "The resync state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } + #[doc = "The last planned failover status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastPlannedFailoverStatus { + Succeeded, + Failed, + Cancelled, + Unknown, + } +} +#[doc = "InMageRcmFailback specific provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmFailbackReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The process server Id."] + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[doc = "The run as account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The Policy Id."] + #[serde(rename = "policyId")] + pub policy_id: String, +} +impl InMageRcmFailbackReprotectInput { + pub fn new( + reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + process_server_id: String, + policy_id: String, + ) -> Self { + Self { + reverse_replication_provider_specific_input, + process_server_id, + run_as_account_id: None, + policy_id, + } + } +} +#[doc = "InMageRcmFailback disk level sync details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmFailbackSyncDetails { + #[doc = "The progress health."] + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[doc = "The transferred bytes from source VM to azure for the disk."] + #[serde(rename = "transferredBytes", default, skip_serializing_if = "Option::is_none")] + pub transferred_bytes: Option, + #[doc = "The bytes transferred in last 15 minutes from source VM to target."] + #[serde(rename = "last15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub last15_minutes_transferred_bytes: Option, + #[doc = "The time of the last data transfer from source VM to target."] + #[serde(rename = "lastDataTransferTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_data_transfer_time_utc: Option, + #[doc = "The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes."] + #[serde(rename = "processedBytes", default, skip_serializing_if = "Option::is_none")] + pub processed_bytes: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The last refresh time."] + #[serde(rename = "lastRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub last_refresh_time: Option, + #[doc = "Progress in percentage. Progress percentage is calculated based on processed bytes."] + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, +} +impl InMageRcmFailbackSyncDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod in_mage_rcm_failback_sync_details { + use super::*; + #[doc = "The progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + Queued, + } +} +#[doc = "InMageRcm last source agent upgrade error details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmLastAgentUpgradeErrorDetails { + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error message parameters."] + #[serde(rename = "errorMessageParameters", default, skip_serializing_if = "Option::is_none")] + pub error_message_parameters: Option, + #[doc = "The error tags."] + #[serde(rename = "errorTags", default, skip_serializing_if = "Option::is_none")] + pub error_tags: Option, +} +impl InMageRcmLastAgentUpgradeErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm mobility agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmMobilityAgentDetails { + #[doc = "The agent version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The latest agent version available."] + #[serde(rename = "latestVersion", default, skip_serializing_if = "Option::is_none")] + pub latest_version: Option, + #[doc = "The latest agent version release date."] + #[serde(rename = "latestAgentReleaseDate", default, skip_serializing_if = "Option::is_none")] + pub latest_agent_release_date: Option, + #[doc = "The driver version."] + #[serde(rename = "driverVersion", default, skip_serializing_if = "Option::is_none")] + pub driver_version: Option, + #[doc = "The latest upgradeable version available without reboot."] + #[serde(rename = "latestUpgradableVersionWithoutReboot", default, skip_serializing_if = "Option::is_none")] + pub latest_upgradable_version_without_reboot: Option, + #[doc = "The agent version expiry date."] + #[serde(rename = "agentVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_version_expiry_date: Option, + #[doc = "The driver version expiry date."] + #[serde(rename = "driverVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub driver_version_expiry_date: Option, + #[doc = "The time of the last heartbeat received from the agent."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The whether update is possible or not."] + #[serde(rename = "reasonsBlockingUpgrade", default, skip_serializing_if = "Vec::is_empty")] + pub reasons_blocking_upgrade: Vec, + #[doc = "A value indicating whether agent is upgradeable or not."] + #[serde(rename = "isUpgradeable", default, skip_serializing_if = "Option::is_none")] + pub is_upgradeable: Option, +} +impl InMageRcmMobilityAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "InMageRcm NIC details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmNicDetails { + #[doc = "The NIC Id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[doc = "A value indicating whether this is the primary NIC."] + #[serde(rename = "isPrimaryNic", default, skip_serializing_if = "Option::is_none")] + pub is_primary_nic: Option, + #[doc = "A value indicating whether this NIC is selected for failover."] + #[serde(rename = "isSelectedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_failover: Option, + #[doc = "The source IP address."] + #[serde(rename = "sourceIPAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, + #[doc = "The source IP address type."] + #[serde(rename = "sourceIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address_type: Option, + #[doc = "Source network Id."] + #[serde(rename = "sourceNetworkId", default, skip_serializing_if = "Option::is_none")] + pub source_network_id: Option, + #[doc = "Source subnet name."] + #[serde(rename = "sourceSubnetName", default, skip_serializing_if = "Option::is_none")] + pub source_subnet_name: Option, + #[doc = "The target IP address."] + #[serde(rename = "targetIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address: Option, + #[doc = "The target IP address type."] + #[serde(rename = "targetIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address_type: Option, + #[doc = "Target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "Test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The test IP address."] + #[serde(rename = "testIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address: Option, + #[doc = "The test IP address type."] + #[serde(rename = "testIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address_type: Option, +} +impl InMageRcmNicDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod in_mage_rcm_nic_details { + use super::*; + #[doc = "The source IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceIpAddressType { + Dynamic, + Static, + } + #[doc = "The target IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetIpAddressType { + Dynamic, + Static, + } + #[doc = "The test IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TestIpAddressType { + Dynamic, + Static, + } +} +#[doc = "InMageRcm NIC input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmNicInput { + #[doc = "The NIC Id."] + #[serde(rename = "nicId")] + pub nic_id: String, + #[doc = "A value indicating whether this is the primary NIC."] + #[serde(rename = "isPrimaryNic")] + pub is_primary_nic: String, + #[doc = "A value indicating whether this NIC is selected for failover."] + #[serde(rename = "isSelectedForFailover", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_failover: Option, + #[doc = "Target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "The target static IP address."] + #[serde(rename = "targetStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_static_ip_address: Option, + #[doc = "The test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The test static IP address."] + #[serde(rename = "testStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_static_ip_address: Option, +} +impl InMageRcmNicInput { + pub fn new(nic_id: String, is_primary_nic: String) -> Self { + Self { + nic_id, + is_primary_nic, + is_selected_for_failover: None, + target_subnet_name: None, + target_static_ip_address: None, + test_subnet_name: None, + test_static_ip_address: None, + } + } +} +#[doc = "InMageRcm policy creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "enableMultiVmSync", default, skip_serializing_if = "Option::is_none")] + pub enable_multi_vm_sync: Option, +} +impl InMageRcmPolicyCreationInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + recovery_point_history_in_minutes: None, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + enable_multi_vm_sync: None, + } + } +} +#[doc = "InMageRcm specific policy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "The crash consistent snapshot frequency in minutes."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled."] + #[serde(rename = "enableMultiVmSync", default, skip_serializing_if = "Option::is_none")] + pub enable_multi_vm_sync: Option, +} +impl InMageRcmPolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_history_in_minutes: None, + app_consistent_frequency_in_minutes: None, + crash_consistent_frequency_in_minutes: None, + enable_multi_vm_sync: None, + } + } +} +#[doc = "InMageRcm protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmProtectedDiskDetails { + #[doc = "The disk Id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The ARM Id of the seed managed disk."] + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[doc = "The ARM Id of the target managed disk."] + #[serde(rename = "targetManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_id: Option, + #[doc = "The disk type."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The data pending in log data store in MB."] + #[serde(rename = "dataPendingInLogDataStoreInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_in_log_data_store_in_mb: Option, + #[doc = "The data pending at source agent in MB."] + #[serde(rename = "dataPendingAtSourceAgentInMB", default, skip_serializing_if = "Option::is_none")] + pub data_pending_at_source_agent_in_mb: Option, + #[doc = "A value indicating whether initial replication is complete or not."] + #[serde(rename = "isInitialReplicationComplete", default, skip_serializing_if = "Option::is_none")] + pub is_initial_replication_complete: Option, + #[doc = "InMageRcm disk level sync details."] + #[serde(rename = "irDetails", default, skip_serializing_if = "Option::is_none")] + pub ir_details: Option, + #[doc = "InMageRcm disk level sync details."] + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, +} +impl InMageRcmProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod in_mage_rcm_protected_disk_details { + use super::*; + #[doc = "The disk type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "InMageRcm provider specific container mapping details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[doc = "A value indicating whether the flag for enable agent auto upgrade."] + #[serde(rename = "enableAgentAutoUpgrade", default, skip_serializing_if = "Option::is_none")] + pub enable_agent_auto_upgrade: Option, +} +impl InMageRcmProtectionContainerMappingDetails { + pub fn new(protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails) -> Self { + Self { + protection_container_mapping_provider_specific_details, + enable_agent_auto_upgrade: None, + } + } +} +#[doc = "InMageRcm provider specific recovery point details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmRecoveryPointDetails { + #[serde(flatten)] + pub provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails, + #[doc = "A value indicating whether the recovery point is multi VM consistent."] + #[serde(rename = "isMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub is_multi_vm_sync_point: Option, +} +impl InMageRcmRecoveryPointDetails { + pub fn new(provider_specific_recovery_point_details: ProviderSpecificRecoveryPointDetails) -> Self { + Self { + provider_specific_recovery_point_details, + is_multi_vm_sync_point: None, + } + } +} +#[doc = "InMageRcm provider specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The virtual machine internal identifier."] + #[serde(rename = "internalIdentifier", default, skip_serializing_if = "Option::is_none")] + pub internal_identifier: Option, + #[doc = "The ARM Id of the discovered VM."] + #[serde(rename = "fabricDiscoveryMachineId", default, skip_serializing_if = "Option::is_none")] + pub fabric_discovery_machine_id: Option, + #[doc = "The multi VM group name."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "The type of the discovered VM."] + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[doc = "The process server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The processor core count."] + #[serde(rename = "processorCoreCount", default, skip_serializing_if = "Option::is_none")] + pub processor_core_count: Option, + #[doc = "The allocated memory in MB."] + #[serde(rename = "allocatedMemoryInMB", default, skip_serializing_if = "Option::is_none")] + pub allocated_memory_in_mb: Option, + #[doc = "The process server name."] + #[serde(rename = "processServerName", default, skip_serializing_if = "Option::is_none")] + pub process_server_name: Option, + #[doc = "The run-as account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The type of the OS on the VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The firmware type."] + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[doc = "The IP address of the primary network interface."] + #[serde(rename = "primaryNicIpAddress", default, skip_serializing_if = "Option::is_none")] + pub primary_nic_ip_address: Option, + #[doc = "The target generation."] + #[serde(rename = "targetGeneration", default, skip_serializing_if = "Option::is_none")] + pub target_generation: Option, + #[doc = "License Type of the VM to be used."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "Target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The target resource group Id."] + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[doc = "The target location."] + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, + #[doc = "The target availability set Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "The target network Id."] + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[doc = "The test network Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "The recovery point Id to which the VM was failed over."] + #[serde(rename = "failoverRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub failover_recovery_point_id: Option, + #[doc = "The last recovery point received time."] + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[doc = "The last recovery point objective value."] + #[serde(rename = "lastRpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_in_seconds: Option, + #[doc = "The last recovery point objective calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The last recovery point Id."] + #[serde(rename = "lastRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_id: Option, + #[doc = "The initial replication progress percentage. This is calculated based on total bytes processed for all disks in the source VM."] + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, + #[doc = "The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM."] + #[serde(rename = "initialReplicationProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_processed_bytes: Option, + #[doc = "The initial replication transferred bytes from source VM to azure for all selected disks on source VM."] + #[serde(rename = "initialReplicationTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_transferred_bytes: Option, + #[doc = "The initial replication progress health."] + #[serde(rename = "initialReplicationProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_health: Option, + #[doc = "The resync progress percentage. This is calculated based on total bytes processed for all disks in the source VM."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM."] + #[serde(rename = "resyncProcessedBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_processed_bytes: Option, + #[doc = "The resync transferred bytes from source VM to azure for all selected disks on source VM."] + #[serde(rename = "resyncTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub resync_transferred_bytes: Option, + #[doc = "The resync progress health."] + #[serde(rename = "resyncProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_health: Option, + #[doc = "A value indicating whether resync is required."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The resync state."] + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[doc = "The agent auto upgrade state."] + #[serde(rename = "agentUpgradeState", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_state: Option, + #[doc = "The last agent upgrade type."] + #[serde(rename = "lastAgentUpgradeType", default, skip_serializing_if = "Option::is_none")] + pub last_agent_upgrade_type: Option, + #[doc = "The agent upgrade job Id."] + #[serde(rename = "agentUpgradeJobId", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_job_id: Option, + #[doc = "The agent version to which last agent upgrade was attempted."] + #[serde(rename = "agentUpgradeAttemptToVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_upgrade_attempt_to_version: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "A value indicating whether last agent upgrade was successful or not."] + #[serde(rename = "isLastUpgradeSuccessful", default, skip_serializing_if = "Option::is_none")] + pub is_last_upgrade_successful: Option, + #[doc = "A value indicating whether agent registration was successful after failover."] + #[serde( + rename = "isAgentRegistrationSuccessfulAfterFailover", + default, + skip_serializing_if = "Option::is_none" + )] + pub is_agent_registration_successful_after_failover: Option, + #[doc = "InMageRcm mobility agent details."] + #[serde(rename = "mobilityAgentDetails", default, skip_serializing_if = "Option::is_none")] + pub mobility_agent_details: Option, + #[doc = "The last agent upgrade error information."] + #[serde(rename = "lastAgentUpgradeErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub last_agent_upgrade_error_details: Vec, + #[doc = "The agent upgrade blocking error information."] + #[serde(rename = "agentUpgradeBlockingErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub agent_upgrade_blocking_error_details: Vec, + #[doc = "The network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "InMageRcm discovered protected VM details."] + #[serde(rename = "discoveredVmDetails", default, skip_serializing_if = "Option::is_none")] + pub discovered_vm_details: Option, +} +impl InMageRcmReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + internal_identifier: None, + fabric_discovery_machine_id: None, + multi_vm_group_name: None, + discovery_type: None, + process_server_id: None, + processor_core_count: None, + allocated_memory_in_mb: None, + process_server_name: None, + run_as_account_id: None, + os_type: None, + firmware_type: None, + primary_nic_ip_address: None, + target_generation: None, + license_type: None, + target_vm_name: None, + target_vm_size: None, + target_resource_group_id: None, + target_location: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + target_network_id: None, + test_network_id: None, + failover_recovery_point_id: None, + last_recovery_point_received: None, + last_rpo_in_seconds: None, + last_rpo_calculated_time: None, + last_recovery_point_id: None, + initial_replication_progress_percentage: None, + initial_replication_processed_bytes: None, + initial_replication_transferred_bytes: None, + initial_replication_progress_health: None, + resync_progress_percentage: None, + resync_processed_bytes: None, + resync_transferred_bytes: None, + resync_progress_health: None, + resync_required: None, + resync_state: None, + agent_upgrade_state: None, + last_agent_upgrade_type: None, + agent_upgrade_job_id: None, + agent_upgrade_attempt_to_version: None, + protected_disks: Vec::new(), + is_last_upgrade_successful: None, + is_agent_registration_successful_after_failover: None, + mobility_agent_details: None, + last_agent_upgrade_error_details: Vec::new(), + agent_upgrade_blocking_error_details: Vec::new(), + vm_nics: Vec::new(), + discovered_vm_details: None, + } + } +} +pub mod in_mage_rcm_replication_details { + use super::*; + #[doc = "The initial replication progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum InitialReplicationProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[doc = "The resync progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + } + #[doc = "The resync state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } + #[doc = "The agent auto upgrade state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AgentUpgradeState { + None, + Started, + Completed, + Commit, + } +} +#[doc = "InMageRcm specific provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The reprotect agent Id."] + #[serde(rename = "reprotectAgentId")] + pub reprotect_agent_id: String, + #[doc = "The target datastore name."] + #[serde(rename = "datastoreName")] + pub datastore_name: String, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[doc = "The Policy Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +impl InMageRcmReprotectInput { + pub fn new( + reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + reprotect_agent_id: String, + datastore_name: String, + log_storage_account_id: String, + ) -> Self { + Self { + reverse_replication_provider_specific_input, + reprotect_agent_id, + datastore_name, + log_storage_account_id, + policy_id: None, + } + } +} +#[doc = "InMageRcm disk level sync details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageRcmSyncDetails { + #[doc = "The progress health."] + #[serde(rename = "progressHealth", default, skip_serializing_if = "Option::is_none")] + pub progress_health: Option, + #[doc = "The transferred bytes from source VM to azure for the disk."] + #[serde(rename = "transferredBytes", default, skip_serializing_if = "Option::is_none")] + pub transferred_bytes: Option, + #[doc = "The bytes transferred in last 15 minutes from source VM to azure."] + #[serde(rename = "last15MinutesTransferredBytes", default, skip_serializing_if = "Option::is_none")] + pub last15_minutes_transferred_bytes: Option, + #[doc = "The time of the last data transfer from source VM to azure."] + #[serde(rename = "lastDataTransferTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub last_data_transfer_time_utc: Option, + #[doc = "The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes."] + #[serde(rename = "processedBytes", default, skip_serializing_if = "Option::is_none")] + pub processed_bytes: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The last refresh time."] + #[serde(rename = "lastRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub last_refresh_time: Option, + #[doc = "Progress in percentage. Progress percentage is calculated based on processed bytes."] + #[serde(rename = "progressPercentage", default, skip_serializing_if = "Option::is_none")] + pub progress_percentage: Option, +} +impl InMageRcmSyncDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod in_mage_rcm_sync_details { + use super::*; + #[doc = "The progress health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProgressHealth { + None, + InProgress, + SlowProgress, + NoProgress, + Queued, + } +} +#[doc = "InMageRcm provider specific input for test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[doc = "The test network Id."] + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[doc = "The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageRcmTestFailoverInput { + pub fn new(test_failover_provider_specific_input: TestFailoverProviderSpecificInput) -> Self { + Self { + test_failover_provider_specific_input, + network_id: None, + recovery_point_id: None, + } + } +} +#[doc = "InMageRcm provider specific input for unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[doc = "A value indicating whether VM is to be shutdown."] + #[serde(rename = "performShutdown")] + pub perform_shutdown: String, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageRcmUnplannedFailoverInput { + pub fn new(unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, perform_shutdown: String) -> Self { + Self { + unplanned_failover_provider_specific_input, + perform_shutdown, + recovery_point_id: None, + } + } +} +#[doc = "InMageRcm provider specific input to update appliance for replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateApplianceForReplicationProtectedItemInput { + #[serde(flatten)] + pub update_appliance_for_replication_protected_item_provider_specific_input: + UpdateApplianceForReplicationProtectedItemProviderSpecificInput, + #[doc = "The run as account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +impl InMageRcmUpdateApplianceForReplicationProtectedItemInput { + pub fn new( + update_appliance_for_replication_protected_item_provider_specific_input : UpdateApplianceForReplicationProtectedItemProviderSpecificInput, + ) -> Self { + Self { + update_appliance_for_replication_protected_item_provider_specific_input, + run_as_account_id: None, + } + } +} +#[doc = "InMageRcm update protection container mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + #[doc = "A value indicating whether agent auto upgrade has to be enabled."] + #[serde(rename = "enableAgentAutoUpgrade")] + pub enable_agent_auto_upgrade: String, +} +impl InMageRcmUpdateContainerMappingInput { + pub fn new( + replication_provider_specific_update_container_mapping_input: ReplicationProviderSpecificUpdateContainerMappingInput, + enable_agent_auto_upgrade: String, + ) -> Self { + Self { + replication_provider_specific_update_container_mapping_input, + enable_agent_auto_upgrade, + } + } +} +#[doc = "InMageRcm provider specific input to update replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageRcmUpdateReplicationProtectedItemInput { + #[serde(flatten)] + pub update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput, + #[doc = "The target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The target resource group ARM Id."] + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[doc = "The target availability set ARM Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "The target network ARM Id."] + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[doc = "The test network ARM Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "The list of NIC details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The license type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, +} +impl InMageRcmUpdateReplicationProtectedItemInput { + pub fn new(update_replication_protected_item_provider_input: UpdateReplicationProtectedItemProviderInput) -> Self { + Self { + update_replication_protected_item_provider_input, + target_vm_name: None, + target_vm_size: None, + target_resource_group_id: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + target_network_id: None, + test_network_id: None, + vm_nics: Vec::new(), + license_type: None, + } + } +} +pub mod in_mage_rcm_update_replication_protected_item_input { + use super::*; + #[doc = "The license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[doc = "InMage provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageReplicationDetails { + #[serde(flatten)] + pub replication_provider_specific_settings: ReplicationProviderSpecificSettings, + #[doc = "The active location of the VM. If the VM is being protected from Azure, this field will take values from { Azure, OnPrem }. If the VM is being protected between two data-centers, this field will be OnPrem always."] + #[serde(rename = "activeSiteType", default, skip_serializing_if = "Option::is_none")] + pub active_site_type: Option, + #[doc = "The CPU count of the VM on the primary side."] + #[serde(rename = "sourceVmCpuCount", default, skip_serializing_if = "Option::is_none")] + pub source_vm_cpu_count: Option, + #[doc = "The RAM size of the VM on the primary side."] + #[serde(rename = "sourceVmRamSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub source_vm_ram_size_in_mb: Option, + #[doc = "Details of the OS Disk."] + #[serde(rename = "osDetails", default, skip_serializing_if = "Option::is_none")] + pub os_details: Option, + #[doc = "The protection stage."] + #[serde(rename = "protectionStage", default, skip_serializing_if = "Option::is_none")] + pub protection_stage: Option, + #[doc = "The virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "The protection state for the vm."] + #[serde(rename = "vmProtectionState", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state: Option, + #[doc = "The protection state description for the vm."] + #[serde(rename = "vmProtectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub vm_protection_state_description: Option, + #[doc = "Initial replication details."] + #[serde(rename = "resyncDetails", default, skip_serializing_if = "Option::is_none")] + pub resync_details: Option, + #[doc = "The retention window start time."] + #[serde(rename = "retentionWindowStart", default, skip_serializing_if = "Option::is_none")] + pub retention_window_start: Option, + #[doc = "The retention window end time."] + #[serde(rename = "retentionWindowEnd", default, skip_serializing_if = "Option::is_none")] + pub retention_window_end: Option, + #[doc = "The compressed data change rate in MB."] + #[serde(rename = "compressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub compressed_data_rate_in_mb: Option, + #[doc = "The uncompressed data change rate in MB."] + #[serde(rename = "uncompressedDataRateInMB", default, skip_serializing_if = "Option::is_none")] + pub uncompressed_data_rate_in_mb: Option, + #[doc = "The RPO in seconds."] + #[serde(rename = "rpoInSeconds", default, skip_serializing_if = "Option::is_none")] + pub rpo_in_seconds: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "The source IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The last heartbeat received from the source server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "The process server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The master target Id."] + #[serde(rename = "masterTargetId", default, skip_serializing_if = "Option::is_none")] + pub master_target_id: Option, + #[doc = "The collection of Consistency points."] + #[serde(rename = "consistencyPoints", default, skip_serializing_if = "Option::is_none")] + pub consistency_points: Option, + #[doc = "A value indicating whether any disk is resized for this VM."] + #[serde(rename = "diskResized", default, skip_serializing_if = "Option::is_none")] + pub disk_resized: Option, + #[doc = "A value indicating whether the source server requires a restart after update."] + #[serde(rename = "rebootAfterUpdateStatus", default, skip_serializing_if = "Option::is_none")] + pub reboot_after_update_status: Option, + #[doc = "The multi vm group Id, if any."] + #[serde(rename = "multiVmGroupId", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_id: Option, + #[doc = "The multi vm group name, if any."] + #[serde(rename = "multiVmGroupName", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_name: Option, + #[doc = "A value indicating whether the multi vm sync is enabled or disabled."] + #[serde(rename = "multiVmSyncStatus", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_status: Option, + #[doc = "The details of the InMage agent."] + #[serde(rename = "agentDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_details: Option, + #[doc = "The vCenter infrastructure Id."] + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[doc = "The infrastructure VM Id."] + #[serde(rename = "infrastructureVmId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_vm_id: Option, + #[doc = "The PE Network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "A value indicating the discovery type of the machine."] + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[doc = "A value indicating the underlying Azure storage account. If the VM is not running in Azure, this value shall be set to null."] + #[serde(rename = "azureStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub azure_storage_account_id: Option, + #[doc = "The datastores of the on-premise machine Value can be list of strings that contain datastore names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datastores: Vec, + #[doc = "The validation errors of the on-premise machine Value can be list of validation errors."] + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[doc = "The last RPO calculated time."] + #[serde(rename = "lastRpoCalculatedTime", default, skip_serializing_if = "Option::is_none")] + pub last_rpo_calculated_time: Option, + #[doc = "The last update time received from on-prem components."] + #[serde(rename = "lastUpdateReceivedTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_received_time: Option, + #[doc = "The replica id of the protected item."] + #[serde(rename = "replicaId", default, skip_serializing_if = "Option::is_none")] + pub replica_id: Option, + #[doc = "The OS Version of the protected item."] + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[doc = "A value indicating whether additional IR stats are available or not."] + #[serde(rename = "isAdditionalStatsAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_additional_stats_available: Option, + #[doc = "The total transferred data in bytes."] + #[serde(rename = "totalDataTransferred", default, skip_serializing_if = "Option::is_none")] + pub total_data_transferred: Option, + #[doc = "The progress health."] + #[serde(rename = "totalProgressHealth", default, skip_serializing_if = "Option::is_none")] + pub total_progress_health: Option, +} +impl InMageReplicationDetails { + pub fn new(replication_provider_specific_settings: ReplicationProviderSpecificSettings) -> Self { + Self { + replication_provider_specific_settings, + active_site_type: None, + source_vm_cpu_count: None, + source_vm_ram_size_in_mb: None, + os_details: None, + protection_stage: None, + vm_id: None, + vm_protection_state: None, + vm_protection_state_description: None, + resync_details: None, + retention_window_start: None, + retention_window_end: None, + compressed_data_rate_in_mb: None, + uncompressed_data_rate_in_mb: None, + rpo_in_seconds: None, + protected_disks: Vec::new(), + ip_address: None, + last_heartbeat: None, + process_server_id: None, + master_target_id: None, + consistency_points: None, + disk_resized: None, + reboot_after_update_status: None, + multi_vm_group_id: None, + multi_vm_group_name: None, + multi_vm_sync_status: None, + agent_details: None, + v_center_infrastructure_id: None, + infrastructure_vm_id: None, + vm_nics: Vec::new(), + discovery_type: None, + azure_storage_account_id: None, + datastores: Vec::new(), + validation_errors: Vec::new(), + last_rpo_calculated_time: None, + last_update_received_time: None, + replica_id: None, + os_version: None, + is_additional_stats_available: None, + total_data_transferred: None, + total_progress_health: None, + } + } +} +#[doc = "InMageAzureV2 specific provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageReprotectInput { + #[serde(flatten)] + pub reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + #[doc = "The Master Target Id."] + #[serde(rename = "masterTargetId")] + pub master_target_id: String, + #[doc = "The Process Server Id."] + #[serde(rename = "processServerId")] + pub process_server_id: String, + #[doc = "The retention drive to use on the MT."] + #[serde(rename = "retentionDrive")] + pub retention_drive: String, + #[doc = "The CS account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The target datastore name."] + #[serde(rename = "datastoreName", default, skip_serializing_if = "Option::is_none")] + pub datastore_name: Option, + #[doc = "DiskExclusionInput when doing enable protection of virtual machine in InMage provider."] + #[serde(rename = "diskExclusionInput", default, skip_serializing_if = "Option::is_none")] + pub disk_exclusion_input: Option, + #[doc = "The Policy Id."] + #[serde(rename = "profileId")] + pub profile_id: String, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude", default, skip_serializing_if = "Vec::is_empty")] + pub disks_to_include: Vec, +} +impl InMageReprotectInput { + pub fn new( + reverse_replication_provider_specific_input: ReverseReplicationProviderSpecificInput, + master_target_id: String, + process_server_id: String, + retention_drive: String, + profile_id: String, + ) -> Self { + Self { + reverse_replication_provider_specific_input, + master_target_id, + process_server_id, + retention_drive, + run_as_account_id: None, + datastore_name: None, + disk_exclusion_input: None, + profile_id, + disks_to_include: Vec::new(), + } + } +} +#[doc = "Provider specific input for InMage test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageTestFailoverInput { + #[serde(flatten)] + pub test_failover_provider_specific_input: TestFailoverProviderSpecificInput, + #[doc = "The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery point id will be ignored."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "The recovery point id to be passed to test failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageTestFailoverInput { + pub fn new(test_failover_provider_specific_input: TestFailoverProviderSpecificInput) -> Self { + Self { + test_failover_provider_specific_input, + recovery_point_type: None, + recovery_point_id: None, + } + } +} +pub mod in_mage_test_failover_input { + use super::*; + #[doc = "The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery point id will be ignored."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[doc = "Provider specific input for InMage unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InMageUnplannedFailoverInput { + #[serde(flatten)] + pub unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput, + #[doc = "The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery point id will be ignored."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed."] + #[serde(rename = "recoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_id: Option, +} +impl InMageUnplannedFailoverInput { + pub fn new(unplanned_failover_provider_specific_input: UnplannedFailoverProviderSpecificInput) -> Self { + Self { + unplanned_failover_provider_specific_input, + recovery_point_type: None, + recovery_point_id: None, + } + } +} +pub mod in_mage_unplanned_failover_input { + use super::*; + #[doc = "The recovery point type. Values from LatestTime, LatestTag or Custom. In the case of custom, the recovery point provided by RecoveryPointId will be used. In the other two cases, recovery point id will be ignored."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[doc = "Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InMageVolumeExclusionOptions { + #[doc = "The volume label. The disk having any volume with this label will be excluded from replication."] + #[serde(rename = "volumeLabel", default, skip_serializing_if = "Option::is_none")] + pub volume_label: Option, + #[doc = "The value indicating whether to exclude multi volume disk or not. If a disk has multiple volumes and one of the volume has label matching with VolumeLabel this disk will be excluded from replication if OnlyExcludeIfSingleVolume is false."] + #[serde(rename = "onlyExcludeIfSingleVolume", default, skip_serializing_if = "Option::is_none")] + pub only_exclude_if_single_volume: Option, +} +impl InMageVolumeExclusionOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class stores the monitoring details for consistency check of inconsistent Protected Entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InconsistentVmDetails { + #[doc = "The Vm name."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "The Cloud name."] + #[serde(rename = "cloudName", default, skip_serializing_if = "Option::is_none")] + pub cloud_name: Option, + #[doc = "The list of details regarding state of the Protected Entity in SRS and On prem."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The list of error ids."] + #[serde(rename = "errorIds", default, skip_serializing_if = "Vec::is_empty")] + pub error_ids: Vec, +} +impl InconsistentVmDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Initial replication details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InitialReplicationDetails { + #[doc = "Initial replication type."] + #[serde(rename = "initialReplicationType", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_type: Option, + #[doc = "The initial replication progress percentage."] + #[serde(rename = "initialReplicationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_replication_progress_percentage: Option, +} +impl InitialReplicationDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the inline workflow task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InlineWorkflowTaskDetails { + #[serde(flatten)] + pub group_task_details: GroupTaskDetails, + #[doc = "The list of child workflow ids."] + #[serde(rename = "workflowIds", default, skip_serializing_if = "Vec::is_empty")] + pub workflow_ids: Vec, +} +impl InlineWorkflowTaskDetails { + pub fn new(group_task_details: GroupTaskDetails) -> Self { + Self { + group_task_details, + workflow_ids: Vec::new(), + } + } +} +#[doc = "Implements InnerHealthError class. HealthError object has a list of InnerHealthErrors as child errors. InnerHealthError is used because this will prevent an infinite loop of structures when Hydra tries to auto-generate the contract. We are exposing the related health errors as inner health errors and all API consumers can utilize this in the same fashion as Exception -> InnerException."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InnerHealthError { + #[doc = "Source of error."] + #[serde(rename = "errorSource", default, skip_serializing_if = "Option::is_none")] + pub error_source: Option, + #[doc = "Type of error."] + #[serde(rename = "errorType", default, skip_serializing_if = "Option::is_none")] + pub error_type: Option, + #[doc = "Level of error."] + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[doc = "Category of error."] + #[serde(rename = "errorCategory", default, skip_serializing_if = "Option::is_none")] + pub error_category: Option, + #[doc = "Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Summary message of the entity."] + #[serde(rename = "summaryMessage", default, skip_serializing_if = "Option::is_none")] + pub summary_message: Option, + #[doc = "Error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Possible causes of error."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "Recommended action to resolve error."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "Error creation time (UTC)."] + #[serde(rename = "creationTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[doc = "DRA error message."] + #[serde(rename = "recoveryProviderErrorMessage", default, skip_serializing_if = "Option::is_none")] + pub recovery_provider_error_message: Option, + #[doc = "ID of the entity."] + #[serde(rename = "entityId", default, skip_serializing_if = "Option::is_none")] + pub entity_id: Option, + #[doc = "The health error unique id."] + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[doc = "Value indicating whether the health error is customer resolvable."] + #[serde(rename = "customerResolvability", default, skip_serializing_if = "Option::is_none")] + pub customer_resolvability: Option, +} +impl InnerHealthError { + pub fn new() -> Self { + Self::default() + } +} +pub mod inner_health_error { + use super::*; + #[doc = "Value indicating whether the health error is customer resolvable."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CustomerResolvability { + Allowed, + NotAllowed, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InputEndpoint { + #[serde(rename = "endpointName", default, skip_serializing_if = "Option::is_none")] + pub endpoint_name: Option, + #[serde(rename = "privatePort", default, skip_serializing_if = "Option::is_none")] + pub private_port: Option, + #[serde(rename = "publicPort", default, skip_serializing_if = "Option::is_none")] + pub public_port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub protocol: Option, +} +impl InputEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Job { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Job custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Job { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobCollection { + #[doc = "The list of jobs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl JobCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job details based on specific job type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobDetails { + #[doc = "Gets the type of job details (see JobDetailsTypes enum for possible values)."] + #[serde(rename = "instanceType")] + pub instance_type: String, + #[doc = "The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details."] + #[serde(rename = "affectedObjectDetails", default, skip_serializing_if = "Option::is_none")] + pub affected_object_details: Option, +} +impl JobDetails { + pub fn new(instance_type: String) -> Self { + Self { + instance_type, + affected_object_details: None, + } + } +} +#[doc = "This class contains the minimal job details required to navigate to the desired drill down."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobEntity { + #[doc = "The job id."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The job display name."] + #[serde(rename = "jobFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub job_friendly_name: Option, + #[doc = "The object id."] + #[serde(rename = "targetObjectId", default, skip_serializing_if = "Option::is_none")] + pub target_object_id: Option, + #[doc = "The object name."] + #[serde(rename = "targetObjectName", default, skip_serializing_if = "Option::is_none")] + pub target_object_name: Option, + #[doc = "The workflow affected object type."] + #[serde(rename = "targetInstanceType", default, skip_serializing_if = "Option::is_none")] + pub target_instance_type: Option, + #[doc = "The job name. Enum type ScenarioName."] + #[serde(rename = "jobScenarioName", default, skip_serializing_if = "Option::is_none")] + pub job_scenario_name: Option, +} +impl JobEntity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class contains the error details per object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobErrorDetails { + #[doc = "ASR error model."] + #[serde(rename = "serviceErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub service_error_details: Option, + #[doc = "This class contains the error details per object."] + #[serde(rename = "providerErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_error_details: Option, + #[doc = "Error level of error."] + #[serde(rename = "errorLevel", default, skip_serializing_if = "Option::is_none")] + pub error_level: Option, + #[doc = "The creation time of job error."] + #[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")] + pub creation_time: Option, + #[doc = "The Id of the task."] + #[serde(rename = "taskId", default, skip_serializing_if = "Option::is_none")] + pub task_id: Option, +} +impl JobErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Job custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobProperties { + #[doc = "The activity id."] + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, + #[doc = "The ScenarioName."] + #[serde(rename = "scenarioName", default, skip_serializing_if = "Option::is_none")] + pub scenario_name: Option, + #[doc = "The DisplayName."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped."] + #[serde(rename = "stateDescription", default, skip_serializing_if = "Option::is_none")] + pub state_description: Option, + #[doc = "The tasks."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tasks: Vec, + #[doc = "The errors."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The Allowed action the job."] + #[serde(rename = "allowedActions", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_actions: Vec, + #[doc = "The affected Object Id."] + #[serde(rename = "targetObjectId", default, skip_serializing_if = "Option::is_none")] + pub target_object_id: Option, + #[doc = "The name of the affected object."] + #[serde(rename = "targetObjectName", default, skip_serializing_if = "Option::is_none")] + pub target_object_name: Option, + #[doc = "The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class."] + #[serde(rename = "targetInstanceType", default, skip_serializing_if = "Option::is_none")] + pub target_instance_type: Option, + #[doc = "Job details based on specific job type."] + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +impl JobProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameter to enumerate jobs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobQueryParameter { + #[doc = "Date time to get jobs from."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Date time to get jobs upto."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The Id of the fabric to search jobs under."] + #[serde(rename = "fabricId", default, skip_serializing_if = "Option::is_none")] + pub fabric_id: Option, + #[doc = "The type of objects."] + #[serde(rename = "affectedObjectTypes", default, skip_serializing_if = "Option::is_none")] + pub affected_object_types: Option, + #[doc = "The states of the job to be filtered can be in."] + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[doc = "The output type of the jobs."] + #[serde(rename = "jobOutputType", default, skip_serializing_if = "Option::is_none")] + pub job_output_type: Option, + #[doc = "The job Name."] + #[serde(rename = "jobName", default, skip_serializing_if = "Option::is_none")] + pub job_name: Option, + #[doc = "The timezone offset for the location of the request (in minutes)."] + #[serde(rename = "timezoneOffset", default, skip_serializing_if = "Option::is_none")] + pub timezone_offset: Option, +} +impl JobQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +pub mod job_query_parameter { + use super::*; + #[doc = "The output type of the jobs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobOutputType { + Json, + Xml, + Excel, + } +} +#[doc = "Model class for event details of a job status event."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobStatusEventDetails { + #[serde(flatten)] + pub event_specific_details: EventSpecificDetails, + #[doc = "Job arm id for the event."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "JobName for the Event."] + #[serde(rename = "jobFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub job_friendly_name: Option, + #[doc = "JobStatus for the Event."] + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[doc = "AffectedObjectType for the event."] + #[serde(rename = "affectedObjectType", default, skip_serializing_if = "Option::is_none")] + pub affected_object_type: Option, +} +impl JobStatusEventDetails { + pub fn new(event_specific_details: EventSpecificDetails) -> Self { + Self { + event_specific_details, + job_id: None, + job_friendly_name: None, + job_status: None, + affected_object_type: None, + } + } +} +#[doc = "This class represents a task which is actually a workflow so that one can navigate to its individual drill down."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "This class contains the minimal job details required to navigate to the desired drill down."] + #[serde(rename = "jobTask", default, skip_serializing_if = "Option::is_none")] + pub job_task: Option, +} +impl JobTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + job_task: None, + } + } +} +#[doc = "Key Encryption Key (KEK) information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyEncryptionKeyInfo { + #[doc = "The key URL / identifier."] + #[serde(rename = "keyIdentifier", default, skip_serializing_if = "Option::is_none")] + pub key_identifier: Option, + #[doc = "The KeyVault resource ARM Id for key."] + #[serde(rename = "keyVaultResourceArmId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_resource_arm_id: Option, +} +impl KeyEncryptionKeyInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Logical network data model."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LogicalNetwork { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Logical Network Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LogicalNetwork { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of logical networks."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LogicalNetworkCollection { + #[doc = "The Logical Networks list details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LogicalNetworkCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Logical Network Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LogicalNetworkProperties { + #[doc = "The Friendly Name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "A value indicating whether Network Virtualization is enabled for the logical network."] + #[serde(rename = "networkVirtualizationStatus", default, skip_serializing_if = "Option::is_none")] + pub network_virtualization_status: Option, + #[doc = "A value indicating whether logical network is used as private test network by test failover."] + #[serde(rename = "logicalNetworkUsage", default, skip_serializing_if = "Option::is_none")] + pub logical_network_usage: Option, + #[doc = "A value indicating whether logical network definitions are isolated."] + #[serde(rename = "logicalNetworkDefinitionsStatus", default, skip_serializing_if = "Option::is_none")] + pub logical_network_definitions_status: Option, +} +impl LogicalNetworkProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the manual action task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManualActionTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "The name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The instructions."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instructions: Option, + #[doc = "The observation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub observation: Option, +} +impl ManualActionTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + name: None, + instructions: None, + observation: None, + } + } +} +#[doc = "Mars agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MarsAgentDetails { + #[doc = "The Mars agent Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The Mars agent name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Mars agent Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The Mars agent Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the Mars agent."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health of the Mars agent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl MarsAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod mars_agent_details { + use super::*; + #[doc = "The health of the Mars agent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Details of a Master Target Server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MasterTargetServer { + #[doc = "The server Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The IP address of the server."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The server name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The OS type of the server."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The version of the scout component on the server."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "The last heartbeat received from the server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "Version status."] + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[doc = "The retention volumes of Master target Server."] + #[serde(rename = "retentionVolumes", default, skip_serializing_if = "Vec::is_empty")] + pub retention_volumes: Vec, + #[doc = "The list of data stores in the fabric."] + #[serde(rename = "dataStores", default, skip_serializing_if = "Vec::is_empty")] + pub data_stores: Vec, + #[doc = "Validation errors."] + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, + #[doc = "Health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "Disk count of the master target."] + #[serde(rename = "diskCount", default, skip_serializing_if = "Option::is_none")] + pub disk_count: Option, + #[doc = "OS Version of the master target."] + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[doc = "MARS agent version."] + #[serde(rename = "marsAgentVersion", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version: Option, + #[doc = "MARS agent expiry date."] + #[serde(rename = "marsAgentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_expiry_date: Option, + #[doc = "Version related details."] + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, + #[doc = "Version related details."] + #[serde(rename = "marsAgentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub mars_agent_version_details: Option, +} +impl MasterTargetServer { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input for migrate."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateInput { + #[doc = "Migrate input properties."] + pub properties: MigrateInputProperties, +} +impl MigrateInput { + pub fn new(properties: MigrateInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Migrate input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateInputProperties { + #[doc = "Migrate provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: MigrateProviderSpecificInput, +} +impl MigrateInputProperties { + pub fn new(provider_specific_details: MigrateProviderSpecificInput) -> Self { + Self { provider_specific_details } + } +} +#[doc = "Migrate provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrateProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl MigrateProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Migration item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationItem { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Migration item properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MigrationItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Migration item collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationItemCollection { + #[doc = "The list of migration items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MigrationItemCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Migration item properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationItemProperties { + #[doc = "The on-premise virtual machine name."] + #[serde(rename = "machineName", default, skip_serializing_if = "Option::is_none")] + pub machine_name: Option, + #[doc = "The ARM Id of policy governing this item."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "The name of policy governing this item."] + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, + #[doc = "The migration status."] + #[serde(rename = "migrationState", default, skip_serializing_if = "Option::is_none")] + pub migration_state: Option, + #[doc = "The migration state description."] + #[serde(rename = "migrationStateDescription", default, skip_serializing_if = "Option::is_none")] + pub migration_state_description: Option, + #[doc = "The last test migration time."] + #[serde(rename = "lastTestMigrationTime", default, skip_serializing_if = "Option::is_none")] + pub last_test_migration_time: Option, + #[doc = "The status of the last test migration."] + #[serde(rename = "lastTestMigrationStatus", default, skip_serializing_if = "Option::is_none")] + pub last_test_migration_status: Option, + #[doc = "The test migrate state."] + #[serde(rename = "testMigrateState", default, skip_serializing_if = "Option::is_none")] + pub test_migrate_state: Option, + #[doc = "The test migrate state description."] + #[serde(rename = "testMigrateStateDescription", default, skip_serializing_if = "Option::is_none")] + pub test_migrate_state_description: Option, + #[doc = "The consolidated health."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The list of health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "The allowed operations on the migration item based on the current migration state of the item."] + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[doc = "Current job details of the migration item."] + #[serde(rename = "currentJob", default, skip_serializing_if = "Option::is_none")] + pub current_job: Option, + #[doc = "The correlation Id for events associated with this migration item."] + #[serde(rename = "eventCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub event_correlation_id: Option, + #[doc = "Migration provider specific settings."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl MigrationItemProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod migration_item_properties { + use super::*; + #[doc = "The migration status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MigrationState { + None, + EnableMigrationInProgress, + EnableMigrationFailed, + DisableMigrationInProgress, + DisableMigrationFailed, + InitialSeedingInProgress, + InitialSeedingFailed, + Replicating, + MigrationInProgress, + MigrationSucceeded, + MigrationFailed, + } + #[doc = "The test migrate state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TestMigrateState { + None, + TestMigrationInProgress, + TestMigrationSucceeded, + TestMigrationFailed, + TestMigrationCleanupInProgress, + } + #[doc = "The consolidated health."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Query parameter to enumerate migration items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationItemsQueryParameter { + #[doc = "The source fabric name filter."] + #[serde(rename = "sourceFabricName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_name: Option, + #[doc = "The source container name filter."] + #[serde(rename = "sourceContainerName", default, skip_serializing_if = "Option::is_none")] + pub source_container_name: Option, + #[doc = "The replication provider type."] + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +impl MigrationItemsQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Migration provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MigrationProviderSpecificSettings { + #[doc = "Gets the instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl MigrationProviderSpecificSettings { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Recovery point for a migration item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationRecoveryPoint { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Migration item recovery point properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl MigrationRecoveryPoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of migration recovery points."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationRecoveryPointCollection { + #[doc = "The migration recovery point details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl MigrationRecoveryPointCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Migration item recovery point properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MigrationRecoveryPointProperties { + #[doc = "The recovery point time."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, +} +impl MigrationRecoveryPointProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod migration_recovery_point_properties { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + NotSpecified, + ApplicationConsistent, + CrashConsistent, + } +} +#[doc = "The Mobility Service update details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MobilityServiceUpdate { + #[doc = "The version of the latest update."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The reboot status of the update - whether it is required or not."] + #[serde(rename = "rebootStatus", default, skip_serializing_if = "Option::is_none")] + pub reboot_status: Option, + #[doc = "The OS type."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, +} +impl MobilityServiceUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network model."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Network { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Network Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Network { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of networks."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkCollection { + #[doc = "The Networks list details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Mapping model. Ideally it should have been possible to inherit this class from prev version in InheritedModels as long as there is no difference in structure or method signature. Since there were no base Models for certain fields and methods viz NetworkMappingProperties and Load with required return type, the class has been introduced in its entirety with references to base models to facilitate extensions in subsequent versions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkMapping { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Network Mapping Properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl NetworkMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of network mappings. As with NetworkMapping, it should be possible to reuse a prev version of this class. It doesn't seem likely this class could be anything more than a slightly bespoke collection of NetworkMapping. Hence it makes sense to override Load with Base.NetworkMapping instead of existing CurrentVersion.NetworkMapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkMappingCollection { + #[doc = "The Network Mappings list."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NetworkMappingCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Mapping fabric specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetworkMappingFabricSpecificSettings { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl NetworkMappingFabricSpecificSettings { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Network Mapping Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkMappingProperties { + #[doc = "The pairing state for network mapping."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The primary network friendly name."] + #[serde(rename = "primaryNetworkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_network_friendly_name: Option, + #[doc = "The primary network id for network mapping."] + #[serde(rename = "primaryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub primary_network_id: Option, + #[doc = "The primary fabric friendly name."] + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[doc = "The recovery network friendly name."] + #[serde(rename = "recoveryNetworkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_friendly_name: Option, + #[doc = "The recovery network id for network mapping."] + #[serde(rename = "recoveryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_id: Option, + #[doc = "The recovery fabric ARM id."] + #[serde(rename = "recoveryFabricArmId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_arm_id: Option, + #[doc = "The recovery fabric friendly name."] + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[doc = "Network Mapping fabric specific settings."] + #[serde(rename = "fabricSpecificSettings", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_settings: Option, +} +impl NetworkMappingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProperties { + #[doc = "The Fabric Type."] + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[doc = "The List of subnets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub subnets: Vec, + #[doc = "The Friendly Name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The Network Type."] + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, +} +impl NetworkProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "New Protection profile input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewProtectionProfile { + #[serde(flatten)] + pub protection_profile_custom_details: ProtectionProfileCustomDetails, + #[doc = "The protection profile input."] + #[serde(rename = "policyName")] + pub policy_name: String, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistory", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history: Option, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[serde(rename = "multiVmSyncStatus")] + pub multi_vm_sync_status: new_protection_profile::MultiVmSyncStatus, +} +impl NewProtectionProfile { + pub fn new( + protection_profile_custom_details: ProtectionProfileCustomDetails, + policy_name: String, + multi_vm_sync_status: new_protection_profile::MultiVmSyncStatus, + ) -> Self { + Self { + protection_profile_custom_details, + policy_name, + recovery_point_history: None, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + multi_vm_sync_status, + } + } +} +pub mod new_protection_profile { + use super::*; + #[doc = "A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncStatus { + Enable, + Disable, + } +} +#[doc = "Recovery virtual network input to create new virtual network from given source network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NewRecoveryVirtualNetwork { + #[serde(flatten)] + pub recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails, + #[doc = "The name of the resource group to be used to create the recovery virtual network. If absent, target network would be created in the same resource group as target VM."] + #[serde( + rename = "recoveryVirtualNetworkResourceGroupName", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_virtual_network_resource_group_name: Option, + #[doc = "The recovery virtual network name."] + #[serde(rename = "recoveryVirtualNetworkName", default, skip_serializing_if = "Option::is_none")] + pub recovery_virtual_network_name: Option, +} +impl NewRecoveryVirtualNetwork { + pub fn new(recovery_virtual_network_custom_details: RecoveryVirtualNetworkCustomDetails) -> Self { + Self { + recovery_virtual_network_custom_details, + recovery_virtual_network_resource_group_name: None, + recovery_virtual_network_name: None, + } + } +} +#[doc = "Disk Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OsDetails { + #[doc = "VM Disk details."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Product type."] + #[serde(rename = "productType", default, skip_serializing_if = "Option::is_none")] + pub product_type: Option, + #[doc = "The OSEdition."] + #[serde(rename = "osEdition", default, skip_serializing_if = "Option::is_none")] + pub os_edition: Option, + #[doc = "The OS Version."] + #[serde(rename = "oSVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_version: Option, + #[doc = "The OS Major Version."] + #[serde(rename = "oSMajorVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_major_version: Option, + #[doc = "The OS Minor Version."] + #[serde(rename = "oSMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub o_s_minor_version: Option, +} +impl OsDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Details of the OS Disk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OsDiskDetails { + #[doc = "The id of the disk containing the OS."] + #[serde(rename = "osVhdId", default, skip_serializing_if = "Option::is_none")] + pub os_vhd_id: Option, + #[doc = "The type of the OS on the VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The OS disk VHD name."] + #[serde(rename = "vhdName", default, skip_serializing_if = "Option::is_none")] + pub vhd_name: Option, +} +impl OsDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Wrapper model for OSVersion to include version and service pack info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OsVersionWrapper { + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The service pack."] + #[serde(rename = "servicePack", default, skip_serializing_if = "Option::is_none")] + pub service_pack: Option, +} +impl OsVersionWrapper { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operations discovery class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationsDiscovery { + #[doc = "Name of the API. The name of the operation being performed on this particular object. It should match the action name that appears in RBAC / the event service. Examples of operations include: * Microsoft.Compute/virtualMachine/capture/action * Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be used. If it is a POST, Action should be used. As a note: all resource providers would need to include the \"{Resource Provider Namespace}/register/action\" operation in their response. This API is used to register for their service, and should include details about the operation (e.g. a localized name for the resource provider + any special considerations like PII release)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for the event service; and (3) audit history / records for management operations."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Origin. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value is \"user,system\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "ClientDiscovery properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OperationsDiscovery { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of ClientDiscovery details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationsDiscoveryCollection { + #[doc = "The ClientDiscovery details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationsDiscoveryCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ClientDiscovery properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationsDiscoveryProperties {} +impl OperationsDiscoveryProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input definition for planned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PlannedFailoverInput { + #[doc = "Input definition for planned failover input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PlannedFailoverInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input definition for planned failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PlannedFailoverInputProperties { + #[doc = "Failover direction."] + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[doc = "Provider specific failover input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl PlannedFailoverInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PlannedFailoverProviderSpecificFailoverInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl PlannedFailoverProviderSpecificFailoverInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Protection profile details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Policy { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Protection profile custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Policy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection Profile Collection details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyCollection { + #[doc = "The policy details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PolicyCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection profile custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolicyProperties { + #[doc = "The FriendlyName."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "Base class for Provider specific details for policies."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl PolicyProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for Provider specific details for policies."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyProviderSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl PolicyProviderSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Base class for provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PolicyProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl PolicyProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Details of the Process Server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProcessServer { + #[doc = "The Process Server's friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The Process Server Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The IP address of the server."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The OS type of the server."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The version of the scout component on the server."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "The last heartbeat received from the server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "Version status."] + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[doc = "The list of the mobility service updates available on the Process Server."] + #[serde(rename = "mobilityServiceUpdates", default, skip_serializing_if = "Vec::is_empty")] + pub mobility_service_updates: Vec, + #[doc = "The agent generated Id."] + #[serde(rename = "hostId", default, skip_serializing_if = "Option::is_none")] + pub host_id: Option, + #[doc = "The servers configured with this PS."] + #[serde(rename = "machineCount", default, skip_serializing_if = "Option::is_none")] + pub machine_count: Option, + #[doc = "The number of replication pairs configured in this PS."] + #[serde(rename = "replicationPairCount", default, skip_serializing_if = "Option::is_none")] + pub replication_pair_count: Option, + #[doc = "The percentage of the system load."] + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[doc = "The system load status."] + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[doc = "The percentage of the CPU load."] + #[serde(rename = "cpuLoad", default, skip_serializing_if = "Option::is_none")] + pub cpu_load: Option, + #[doc = "The CPU load status."] + #[serde(rename = "cpuLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub cpu_load_status: Option, + #[doc = "The total memory."] + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[doc = "The available memory."] + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[doc = "The memory usage status."] + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[doc = "The total space."] + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[doc = "The available space."] + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[doc = "The space usage status."] + #[serde(rename = "spaceUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub space_usage_status: Option, + #[doc = "The PS service status."] + #[serde(rename = "psServiceStatus", default, skip_serializing_if = "Option::is_none")] + pub ps_service_status: Option, + #[doc = "The PS SSL cert expiry date."] + #[serde(rename = "sslCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_date: Option, + #[doc = "CS SSL cert expiry date."] + #[serde(rename = "sslCertExpiryRemainingDays", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_remaining_days: Option, + #[doc = "OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0."] + #[serde(rename = "osVersion", default, skip_serializing_if = "Option::is_none")] + pub os_version: Option, + #[doc = "Health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[doc = "Version related details."] + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, + #[doc = "The health of Process Server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The process server stats refresh time."] + #[serde(rename = "psStatsRefreshTime", default, skip_serializing_if = "Option::is_none")] + pub ps_stats_refresh_time: Option, + #[doc = "The uploading pending data in bytes."] + #[serde(rename = "throughputUploadPendingDataInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_upload_pending_data_in_bytes: Option, + #[doc = "The throughput in MBps."] + #[serde(rename = "throughputInMBps", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_m_bps: Option, + #[doc = "The throughput in bytes."] + #[serde(rename = "throughputInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_bytes: Option, + #[doc = "The throughput status."] + #[serde(rename = "throughputStatus", default, skip_serializing_if = "Option::is_none")] + pub throughput_status: Option, + #[doc = "The MARS communication status."] + #[serde(rename = "marsCommunicationStatus", default, skip_serializing_if = "Option::is_none")] + pub mars_communication_status: Option, + #[doc = "The MARS registration status."] + #[serde(rename = "marsRegistrationStatus", default, skip_serializing_if = "Option::is_none")] + pub mars_registration_status: Option, +} +impl ProcessServer { + pub fn new() -> Self { + Self::default() + } +} +pub mod process_server { + use super::*; + #[doc = "The health of Process Server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Process server details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProcessServerDetails { + #[doc = "The process server Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The process server name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The process server Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The process server Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The list of IP addresses for communicating with the RCM component."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the process server."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The total memory."] + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[doc = "The available memory."] + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[doc = "The used memory."] + #[serde(rename = "usedMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub used_memory_in_bytes: Option, + #[doc = "The memory usage percentage."] + #[serde(rename = "memoryUsagePercentage", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_percentage: Option, + #[doc = "The total disk space."] + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[doc = "The available disk space."] + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[doc = "The used disk space."] + #[serde(rename = "usedSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub used_space_in_bytes: Option, + #[doc = "The free disk space percentage."] + #[serde(rename = "freeSpacePercentage", default, skip_serializing_if = "Option::is_none")] + pub free_space_percentage: Option, + #[doc = "The uploading pending data in bytes."] + #[serde(rename = "throughputUploadPendingDataInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_upload_pending_data_in_bytes: Option, + #[doc = "The throughput in bytes."] + #[serde(rename = "throughputInBytes", default, skip_serializing_if = "Option::is_none")] + pub throughput_in_bytes: Option, + #[doc = "The processor usage percentage."] + #[serde(rename = "processorUsagePercentage", default, skip_serializing_if = "Option::is_none")] + pub processor_usage_percentage: Option, + #[doc = "The throughput status."] + #[serde(rename = "throughputStatus", default, skip_serializing_if = "Option::is_none")] + pub throughput_status: Option, + #[doc = "The system load."] + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[doc = "The system load status."] + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[doc = "The disk usage status."] + #[serde(rename = "diskUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub disk_usage_status: Option, + #[doc = "The memory usage status."] + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[doc = "The processor usage status."] + #[serde(rename = "processorUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub processor_usage_status: Option, + #[doc = "The health of the process server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "The protected item count."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "The historic health of the process server based on the health in last 24 hours."] + #[serde(rename = "historicHealth", default, skip_serializing_if = "Option::is_none")] + pub historic_health: Option, +} +impl ProcessServerDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod process_server_details { + use super::*; + #[doc = "The throughput status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ThroughputStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[doc = "The system load status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SystemLoadStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[doc = "The disk usage status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[doc = "The memory usage status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MemoryUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[doc = "The processor usage status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProcessorUsageStatus { + Healthy, + Warning, + Critical, + Unknown, + } + #[doc = "The health of the process server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } + #[doc = "The historic health of the process server based on the health in last 24 hours."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum HistoricHealth { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableItem { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Replication protected item custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectableItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protectable item collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableItemCollection { + #[doc = "The Protectable item details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ProtectableItemCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protected item custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableItemProperties { + #[doc = "The name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The protection status."] + #[serde(rename = "protectionStatus", default, skip_serializing_if = "Option::is_none")] + pub protection_status: Option, + #[doc = "The ARM resource of protected items."] + #[serde(rename = "replicationProtectedItemId", default, skip_serializing_if = "Option::is_none")] + pub replication_protected_item_id: Option, + #[doc = "The recovery provider ARM Id."] + #[serde(rename = "recoveryServicesProviderId", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_id: Option, + #[doc = "The Current protection readiness errors."] + #[serde(rename = "protectionReadinessErrors", default, skip_serializing_if = "Vec::is_empty")] + pub protection_readiness_errors: Vec, + #[doc = "The list of replication providers supported for the protectable item."] + #[serde(rename = "supportedReplicationProviders", default, skip_serializing_if = "Vec::is_empty")] + pub supported_replication_providers: Vec, + #[doc = "Replication provider specific settings."] + #[serde(rename = "customDetails", default, skip_serializing_if = "Option::is_none")] + pub custom_details: Option, +} +impl ProtectableItemProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameter to enumerate Protectable items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectableItemQueryParameter { + #[doc = "State of the Protectable item query filter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, +} +impl ProtectableItemQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameter to enumerate protected items."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectedItemsQueryParameter { + #[doc = "The source fabric name filter."] + #[serde(rename = "sourceFabricName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_name: Option, + #[doc = "The recovery plan filter."] + #[serde(rename = "recoveryPlanName", default, skip_serializing_if = "Option::is_none")] + pub recovery_plan_name: Option, + #[doc = "The source fabric location filter."] + #[serde(rename = "sourceFabricLocation", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_location: Option, + #[doc = "The fabric object Id filter."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The vCenter name filter."] + #[serde(rename = "vCenterName", default, skip_serializing_if = "Option::is_none")] + pub v_center_name: Option, + #[doc = "The replication provider type."] + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[doc = "Whether Multi VM group is auto created or specified by user."] + #[serde(rename = "multiVmGroupCreateOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_group_create_option: Option, + #[doc = "The process server Id filter."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, +} +impl ProtectedItemsQueryParameter { + pub fn new() -> Self { + Self::default() + } +} +pub mod protected_items_query_parameter { + use super::*; + #[doc = "Whether Multi VM group is auto created or specified by user."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmGroupCreateOption { + AutoCreated, + UserSpecified, + } +} +#[doc = "Protection container details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainer { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Protection profile custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectionContainer { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection Container collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerCollection { + #[doc = "The Protection Container details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ProtectionContainerCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class for fabric specific details of container."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerFabricSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +impl ProtectionContainerFabricSpecificDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection container mapping object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerMapping { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Protection container mapping properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ProtectionContainerMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection container mapping collection class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerMappingCollection { + #[doc = "List of container mappings."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to fetch rest of the data."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ProtectionContainerMappingCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection container mapping properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerMappingProperties { + #[doc = "Paired protection container ARM ID."] + #[serde(rename = "targetProtectionContainerId", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_id: Option, + #[doc = "Friendly name of paired container."] + #[serde(rename = "targetProtectionContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub target_protection_container_friendly_name: Option, + #[doc = "Container mapping provider specific details."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[doc = "Health of pairing."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "Health error."] + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[doc = "Policy ARM Id."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "Association Status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "Friendly name of source protection container."] + #[serde(rename = "sourceProtectionContainerFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub source_protection_container_friendly_name: Option, + #[doc = "Friendly name of source fabric."] + #[serde(rename = "sourceFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub source_fabric_friendly_name: Option, + #[doc = "Friendly name of target fabric."] + #[serde(rename = "targetFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub target_fabric_friendly_name: Option, + #[doc = "Friendly name of replication policy."] + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, +} +impl ProtectionContainerMappingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container mapping provider specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionContainerMappingProviderSpecificDetails { + #[doc = "Gets the class type. Overridden in derived classes."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ProtectionContainerMappingProviderSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Protection profile custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProtectionContainerProperties { + #[doc = "Fabric friendly name."] + #[serde(rename = "fabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub fabric_friendly_name: Option, + #[doc = "The name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The fabric type."] + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[doc = "Number of protected PEs."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "The pairing status of this cloud."] + #[serde(rename = "pairingStatus", default, skip_serializing_if = "Option::is_none")] + pub pairing_status: Option, + #[doc = "The role of this cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub role: Option, + #[doc = "Base class for fabric specific details of container."] + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +impl ProtectionContainerProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Protection Profile custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProtectionProfileCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl ProtectionProfileCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "This class contains the error details per object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProviderError { + #[doc = "The Error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The Error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The Provider error Id."] + #[serde(rename = "errorId", default, skip_serializing_if = "Option::is_none")] + pub error_id: Option, + #[doc = "The possible causes for the error."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action to resolve the error."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, +} +impl ProviderError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication provider specific recovery point details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProviderSpecificRecoveryPointDetails { + #[doc = "Gets the provider type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ProviderSpecificRecoveryPointDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Push installer details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PushInstallerDetails { + #[doc = "The push installer Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The push installer name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The push installer Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The push installer Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the push installer."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health of the push installer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl PushInstallerDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod push_installer_details { + use super::*; + #[doc = "The health of the push installer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "RCM proxy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RcmProxyDetails { + #[doc = "The RCM proxy Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The RCM proxy name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The RCM proxy Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The RCM proxy Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The client authentication type."] + #[serde(rename = "clientAuthenticationType", default, skip_serializing_if = "Option::is_none")] + pub client_authentication_type: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the RCM proxy."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health of the RCM proxy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl RcmProxyDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod rcm_proxy_details { + use super::*; + #[doc = "The health of the RCM proxy."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Recovery Availability Set custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryAvailabilitySetCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl RecoveryAvailabilitySetCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "Recovery plan details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPlan { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Recovery plan properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecoveryPlan { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan A2A specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aDetails { + #[serde(flatten)] + pub recovery_plan_provider_specific_details: RecoveryPlanProviderSpecificDetails, + #[doc = "The primary zone."] + #[serde(rename = "primaryZone", default, skip_serializing_if = "Option::is_none")] + pub primary_zone: Option, + #[doc = "The recovery zone."] + #[serde(rename = "recoveryZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_zone: Option, +} +impl RecoveryPlanA2aDetails { + pub fn new(recovery_plan_provider_specific_details: RecoveryPlanProviderSpecificDetails) -> Self { + Self { + recovery_plan_provider_specific_details, + primary_zone: None, + recovery_zone: None, + } + } +} +#[doc = "Recovery plan A2A failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_a2a_failover_input::RecoveryPointType, + #[doc = "A value indicating whether to use recovery cloud service for TFO or not."] + #[serde(rename = "cloudServiceCreationOption", default, skip_serializing_if = "Option::is_none")] + pub cloud_service_creation_option: Option, + #[doc = "A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover."] + #[serde(rename = "multiVmSyncPointOption", default, skip_serializing_if = "Option::is_none")] + pub multi_vm_sync_point_option: Option, +} +impl RecoveryPlanA2aFailoverInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + recovery_point_type: recovery_plan_a2a_failover_input::RecoveryPointType, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + recovery_point_type, + cloud_service_creation_option: None, + multi_vm_sync_point_option: None, + } + } +} +pub mod recovery_plan_a2a_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } + #[doc = "A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum MultiVmSyncPointOption { + UseMultiVmSyncRecoveryPoint, + UsePerVmRecoveryPoint, + } +} +#[doc = "Recovery plan A2A input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanA2aInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_input: RecoveryPlanProviderSpecificInput, + #[doc = "The primary zone."] + #[serde(rename = "primaryZone", default, skip_serializing_if = "Option::is_none")] + pub primary_zone: Option, + #[doc = "The recovery zone."] + #[serde(rename = "recoveryZone", default, skip_serializing_if = "Option::is_none")] + pub recovery_zone: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "primaryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub primary_extended_location: Option, + #[doc = "Extended location of the resource."] + #[serde(rename = "recoveryExtendedLocation", default, skip_serializing_if = "Option::is_none")] + pub recovery_extended_location: Option, +} +impl RecoveryPlanA2aInput { + pub fn new(recovery_plan_provider_specific_input: RecoveryPlanProviderSpecificInput) -> Self { + Self { + recovery_plan_provider_specific_input, + primary_zone: None, + recovery_zone: None, + primary_extended_location: None, + recovery_extended_location: None, + } + } +} +#[doc = "Recovery plan action details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanAction { + #[doc = "The action name."] + #[serde(rename = "actionName")] + pub action_name: String, + #[doc = "The list of failover types."] + #[serde(rename = "failoverTypes")] + pub failover_types: Vec, + #[doc = "The list of failover directions."] + #[serde(rename = "failoverDirections")] + pub failover_directions: Vec, + #[doc = "Recovery plan action custom details."] + #[serde(rename = "customDetails")] + pub custom_details: RecoveryPlanActionDetails, +} +impl RecoveryPlanAction { + pub fn new( + action_name: String, + failover_types: Vec, + failover_directions: Vec, + custom_details: RecoveryPlanActionDetails, + ) -> Self { + Self { + action_name, + failover_types, + failover_directions, + custom_details, + } + } +} +#[doc = "Recovery plan action custom details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanActionDetails { + #[doc = "Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values)."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl RecoveryPlanActionDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Recovery plan Automation runbook action details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanAutomationRunbookActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + #[doc = "The runbook ARM Id."] + #[serde(rename = "runbookId", default, skip_serializing_if = "Option::is_none")] + pub runbook_id: Option, + #[doc = "The runbook timeout."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "The fabric location."] + #[serde(rename = "fabricLocation")] + pub fabric_location: recovery_plan_automation_runbook_action_details::FabricLocation, +} +impl RecoveryPlanAutomationRunbookActionDetails { + pub fn new( + recovery_plan_action_details: RecoveryPlanActionDetails, + fabric_location: recovery_plan_automation_runbook_action_details::FabricLocation, + ) -> Self { + Self { + recovery_plan_action_details, + runbook_id: None, + timeout: None, + fabric_location, + } + } +} +pub mod recovery_plan_automation_runbook_action_details { + use super::*; + #[doc = "The fabric location."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricLocation { + Primary, + Recovery, + } +} +#[doc = "Recovery plan collection details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPlanCollection { + #[doc = "The list of recovery plans."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RecoveryPlanCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan group details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanGroup { + #[doc = "The group type."] + #[serde(rename = "groupType")] + pub group_type: recovery_plan_group::GroupType, + #[doc = "The list of protected items."] + #[serde(rename = "replicationProtectedItems", default, skip_serializing_if = "Vec::is_empty")] + pub replication_protected_items: Vec, + #[doc = "The start group actions."] + #[serde(rename = "startGroupActions", default, skip_serializing_if = "Vec::is_empty")] + pub start_group_actions: Vec, + #[doc = "The end group actions."] + #[serde(rename = "endGroupActions", default, skip_serializing_if = "Vec::is_empty")] + pub end_group_actions: Vec, +} +impl RecoveryPlanGroup { + pub fn new(group_type: recovery_plan_group::GroupType) -> Self { + Self { + group_type, + replication_protected_items: Vec::new(), + start_group_actions: Vec::new(), + end_group_actions: Vec::new(), + } + } +} +pub mod recovery_plan_group { + use super::*; + #[doc = "The group type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum GroupType { + Shutdown, + Boot, + Failover, + } +} +#[doc = "This class represents the recovery plan group task."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanGroupTaskDetails { + #[serde(flatten)] + pub group_task_details: GroupTaskDetails, + #[doc = "The name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The group identifier."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The group type."] + #[serde(rename = "rpGroupType", default, skip_serializing_if = "Option::is_none")] + pub rp_group_type: Option, +} +impl RecoveryPlanGroupTaskDetails { + pub fn new(group_task_details: GroupTaskDetails) -> Self { + Self { + group_task_details, + name: None, + group_id: None, + rp_group_type: None, + } + } +} +#[doc = "Recovery plan HVR Azure failback input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanHyperVReplicaAzureFailbackInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The data sync option."] + #[serde(rename = "dataSyncOption")] + pub data_sync_option: recovery_plan_hyper_v_replica_azure_failback_input::DataSyncOption, + #[doc = "The ALR option."] + #[serde(rename = "recoveryVmCreationOption")] + pub recovery_vm_creation_option: recovery_plan_hyper_v_replica_azure_failback_input::RecoveryVmCreationOption, +} +impl RecoveryPlanHyperVReplicaAzureFailbackInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + data_sync_option: recovery_plan_hyper_v_replica_azure_failback_input::DataSyncOption, + recovery_vm_creation_option: recovery_plan_hyper_v_replica_azure_failback_input::RecoveryVmCreationOption, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + data_sync_option, + recovery_vm_creation_option, + } + } +} +pub mod recovery_plan_hyper_v_replica_azure_failback_input { + use super::*; + #[doc = "The data sync option."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataSyncOption { + ForDownTime, + ForSynchronization, + } + #[doc = "The ALR option."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryVmCreationOption { + CreateVmIfNotFound, + NoAction, + } +} +#[doc = "Recovery plan HVR Azure failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanHyperVReplicaAzureFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The primary KEK certificate PFX."] + #[serde(rename = "primaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub primary_kek_certificate_pfx: Option, + #[doc = "The secondary KEK certificate PFX."] + #[serde(rename = "secondaryKekCertificatePfx", default, skip_serializing_if = "Option::is_none")] + pub secondary_kek_certificate_pfx: Option, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, +} +impl RecoveryPlanHyperVReplicaAzureFailoverInput { + pub fn new(recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + primary_kek_certificate_pfx: None, + secondary_kek_certificate_pfx: None, + recovery_point_type: None, + } + } +} +pub mod recovery_plan_hyper_v_replica_azure_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestProcessed, + } +} +#[doc = "Recovery plan InMageAzureV2 failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageAzureV2FailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_azure_v2_failover_input::RecoveryPointType, + #[doc = "A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover."] + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +impl RecoveryPlanInMageAzureV2FailoverInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + recovery_point_type: recovery_plan_in_mage_azure_v2_failover_input::RecoveryPointType, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + recovery_point_type, + use_multi_vm_sync_point: None, + } + } +} +pub mod recovery_plan_in_mage_azure_v2_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } +} +#[doc = "Recovery plan InMage failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_failover_input::RecoveryPointType, +} +impl RecoveryPlanInMageFailoverInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + recovery_point_type: recovery_plan_in_mage_failover_input::RecoveryPointType, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + recovery_point_type, + } + } +} +pub mod recovery_plan_in_mage_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + LatestTime, + LatestTag, + Custom, + } +} +#[doc = "Recovery plan InMageRcmFailback failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageRcmFailbackFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_rcm_failback_failover_input::RecoveryPointType, + #[doc = "A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover."] + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +impl RecoveryPlanInMageRcmFailbackFailoverInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + recovery_point_type: recovery_plan_in_mage_rcm_failback_failover_input::RecoveryPointType, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + recovery_point_type, + use_multi_vm_sync_point: None, + } + } +} +pub mod recovery_plan_in_mage_rcm_failback_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + ApplicationConsistent, + CrashConsistent, + } +} +#[doc = "Recovery plan InMageRcm failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanInMageRcmFailoverInput { + #[serde(flatten)] + pub recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + #[doc = "The recovery point type."] + #[serde(rename = "recoveryPointType")] + pub recovery_point_type: recovery_plan_in_mage_rcm_failover_input::RecoveryPointType, + #[doc = "A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover."] + #[serde(rename = "useMultiVmSyncPoint", default, skip_serializing_if = "Option::is_none")] + pub use_multi_vm_sync_point: Option, +} +impl RecoveryPlanInMageRcmFailoverInput { + pub fn new( + recovery_plan_provider_specific_failover_input: RecoveryPlanProviderSpecificFailoverInput, + recovery_point_type: recovery_plan_in_mage_rcm_failover_input::RecoveryPointType, + ) -> Self { + Self { + recovery_plan_provider_specific_failover_input, + recovery_point_type, + use_multi_vm_sync_point: None, + } + } +} +pub mod recovery_plan_in_mage_rcm_failover_input { + use super::*; + #[doc = "The recovery point type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RecoveryPointType { + Latest, + LatestApplicationConsistent, + LatestCrashConsistent, + LatestProcessed, + } +} +#[doc = "Recovery plan manual action details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanManualActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + #[doc = "The manual action description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl RecoveryPlanManualActionDetails { + pub fn new(recovery_plan_action_details: RecoveryPlanActionDetails) -> Self { + Self { + recovery_plan_action_details, + description: None, + } + } +} +#[doc = "Recovery plan planned failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanPlannedFailoverInput { + #[doc = "Recovery plan planned failover input properties."] + pub properties: RecoveryPlanPlannedFailoverInputProperties, +} +impl RecoveryPlanPlannedFailoverInput { + pub fn new(properties: RecoveryPlanPlannedFailoverInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Recovery plan planned failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanPlannedFailoverInputProperties { + #[doc = "The failover direction."] + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_planned_failover_input_properties::FailoverDirection, + #[doc = "The provider specific properties."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +impl RecoveryPlanPlannedFailoverInputProperties { + pub fn new(failover_direction: recovery_plan_planned_failover_input_properties::FailoverDirection) -> Self { + Self { + failover_direction, + provider_specific_details: Vec::new(), + } + } +} +pub mod recovery_plan_planned_failover_input_properties { + use super::*; + #[doc = "The failover direction."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } +} +#[doc = "Recovery plan properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPlanProperties { + #[doc = "The friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The primary fabric Id."] + #[serde(rename = "primaryFabricId", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_id: Option, + #[doc = "The primary fabric friendly name."] + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[doc = "The recovery fabric Id."] + #[serde(rename = "recoveryFabricId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_id: Option, + #[doc = "The recovery fabric friendly name."] + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[doc = "The failover deployment model."] + #[serde(rename = "failoverDeploymentModel", default, skip_serializing_if = "Option::is_none")] + pub failover_deployment_model: Option, + #[doc = "The list of replication providers."] + #[serde(rename = "replicationProviders", default, skip_serializing_if = "Vec::is_empty")] + pub replication_providers: Vec, + #[doc = "The list of allowed operations."] + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[doc = "The start time of the last planned failover."] + #[serde(rename = "lastPlannedFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_planned_failover_time: Option, + #[doc = "The start time of the last unplanned failover."] + #[serde(rename = "lastUnplannedFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_unplanned_failover_time: Option, + #[doc = "The start time of the last test failover."] + #[serde(rename = "lastTestFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_test_failover_time: Option, + #[doc = "Current scenario details of the protected entity."] + #[serde(rename = "currentScenario", default, skip_serializing_if = "Option::is_none")] + pub current_scenario: Option, + #[doc = "The recovery plan status."] + #[serde(rename = "currentScenarioStatus", default, skip_serializing_if = "Option::is_none")] + pub current_scenario_status: Option, + #[doc = "The recovery plan status description."] + #[serde(rename = "currentScenarioStatusDescription", default, skip_serializing_if = "Option::is_none")] + pub current_scenario_status_description: Option, + #[doc = "The recovery plan groups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, + #[doc = "The provider id and provider specific details."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +impl RecoveryPlanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPlanProtectedItem { + #[doc = "The ARM Id of the recovery plan protected item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The virtual machine Id."] + #[serde(rename = "virtualMachineId", default, skip_serializing_if = "Option::is_none")] + pub virtual_machine_id: Option, +} +impl RecoveryPlanProtectedItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan provider specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificDetails { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl RecoveryPlanProviderSpecificDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Recovery plan provider specific failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificFailoverInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl RecoveryPlanProviderSpecificFailoverInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Recovery plan provider specific input base class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanProviderSpecificInput { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl RecoveryPlanProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Recovery plan script action details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanScriptActionDetails { + #[serde(flatten)] + pub recovery_plan_action_details: RecoveryPlanActionDetails, + #[doc = "The script path."] + pub path: String, + #[doc = "The script timeout."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "The fabric location."] + #[serde(rename = "fabricLocation")] + pub fabric_location: recovery_plan_script_action_details::FabricLocation, +} +impl RecoveryPlanScriptActionDetails { + pub fn new( + recovery_plan_action_details: RecoveryPlanActionDetails, + path: String, + fabric_location: recovery_plan_script_action_details::FabricLocation, + ) -> Self { + Self { + recovery_plan_action_details, + path, + timeout: None, + fabric_location, + } + } +} +pub mod recovery_plan_script_action_details { + use super::*; + #[doc = "The fabric location."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FabricLocation { + Primary, + Recovery, + } +} +#[doc = "This class represents the recovery plan shutdown group task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanShutdownGroupTaskDetails { + #[serde(flatten)] + pub recovery_plan_group_task_details: RecoveryPlanGroupTaskDetails, +} +impl RecoveryPlanShutdownGroupTaskDetails { + pub fn new(recovery_plan_group_task_details: RecoveryPlanGroupTaskDetails) -> Self { + Self { + recovery_plan_group_task_details, + } + } +} +#[doc = "Recovery plan test failover cleanup input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverCleanupInput { + #[doc = "Recovery plan test failover cleanup input properties."] + pub properties: RecoveryPlanTestFailoverCleanupInputProperties, +} +impl RecoveryPlanTestFailoverCleanupInput { + pub fn new(properties: RecoveryPlanTestFailoverCleanupInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Recovery plan test failover cleanup input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPlanTestFailoverCleanupInputProperties { + #[doc = "The test failover cleanup comments."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +impl RecoveryPlanTestFailoverCleanupInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan test failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverInput { + #[doc = "Recovery plan test failover input properties."] + pub properties: RecoveryPlanTestFailoverInputProperties, +} +impl RecoveryPlanTestFailoverInput { + pub fn new(properties: RecoveryPlanTestFailoverInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Recovery plan test failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanTestFailoverInputProperties { + #[doc = "The failover direction."] + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_test_failover_input_properties::FailoverDirection, + #[doc = "The network type to be used for test failover."] + #[serde(rename = "networkType")] + pub network_type: String, + #[doc = "The Id of the network to be used for test failover."] + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[doc = "The provider specific properties."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +impl RecoveryPlanTestFailoverInputProperties { + pub fn new(failover_direction: recovery_plan_test_failover_input_properties::FailoverDirection, network_type: String) -> Self { + Self { + failover_direction, + network_type, + network_id: None, + provider_specific_details: Vec::new(), + } + } +} +pub mod recovery_plan_test_failover_input_properties { + use super::*; + #[doc = "The failover direction."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } +} +#[doc = "Recovery plan unplanned failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanUnplannedFailoverInput { + #[doc = "Recovery plan unplanned failover input properties."] + pub properties: RecoveryPlanUnplannedFailoverInputProperties, +} +impl RecoveryPlanUnplannedFailoverInput { + pub fn new(properties: RecoveryPlanUnplannedFailoverInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Recovery plan unplanned failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryPlanUnplannedFailoverInputProperties { + #[doc = "The failover direction."] + #[serde(rename = "failoverDirection")] + pub failover_direction: recovery_plan_unplanned_failover_input_properties::FailoverDirection, + #[doc = "A value indicating whether source site operations are required."] + #[serde(rename = "sourceSiteOperations")] + pub source_site_operations: recovery_plan_unplanned_failover_input_properties::SourceSiteOperations, + #[doc = "The provider specific properties."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Vec::is_empty")] + pub provider_specific_details: Vec, +} +impl RecoveryPlanUnplannedFailoverInputProperties { + pub fn new( + failover_direction: recovery_plan_unplanned_failover_input_properties::FailoverDirection, + source_site_operations: recovery_plan_unplanned_failover_input_properties::SourceSiteOperations, + ) -> Self { + Self { + failover_direction, + source_site_operations, + provider_specific_details: Vec::new(), + } + } +} +pub mod recovery_plan_unplanned_failover_input_properties { + use super::*; + #[doc = "The failover direction."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum FailoverDirection { + PrimaryToRecovery, + RecoveryToPrimary, + } + #[doc = "A value indicating whether source site operations are required."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceSiteOperations { + Required, + NotRequired, + } +} +#[doc = "Recovery point."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPoint { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Recovery point properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecoveryPoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of recovery point details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointCollection { + #[doc = "The recovery point details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RecoveryPointCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery point properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryPointProperties { + #[doc = "The recovery point time."] + #[serde(rename = "recoveryPointTime", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_time: Option, + #[doc = "The recovery point type: ApplicationConsistent, CrashConsistent."] + #[serde(rename = "recoveryPointType", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_type: Option, + #[doc = "Replication provider specific recovery point details."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl RecoveryPointProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery Proximity placement group custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryProximityPlacementGroupCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl RecoveryProximityPlacementGroupCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "Recovery Resource Group custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryResourceGroupCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl RecoveryResourceGroupCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "Provider details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryServicesProvider { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Recovery services provider properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RecoveryServicesProvider { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of providers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryServicesProviderCollection { + #[doc = "The Servers details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RecoveryServicesProviderCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery services provider properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecoveryServicesProviderProperties { + #[doc = "Type of the site."] + #[serde(rename = "fabricType", default, skip_serializing_if = "Option::is_none")] + pub fabric_type: Option, + #[doc = "Friendly name of the DRA."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The provider version."] + #[serde(rename = "providerVersion", default, skip_serializing_if = "Option::is_none")] + pub provider_version: Option, + #[doc = "The fabric provider."] + #[serde(rename = "serverVersion", default, skip_serializing_if = "Option::is_none")] + pub server_version: Option, + #[doc = "DRA version status."] + #[serde(rename = "providerVersionState", default, skip_serializing_if = "Option::is_none")] + pub provider_version_state: Option, + #[doc = "Expiry date of the version."] + #[serde(rename = "providerVersionExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub provider_version_expiry_date: Option, + #[doc = "The fabric friendly name."] + #[serde(rename = "fabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub fabric_friendly_name: Option, + #[doc = "Time when last heartbeat was sent by the DRA."] + #[serde(rename = "lastHeartBeat", default, skip_serializing_if = "Option::is_none")] + pub last_heart_beat: Option, + #[doc = "A value indicating whether DRA is responsive."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Number of protected VMs currently managed by the DRA."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "The scenarios allowed on this provider."] + #[serde(rename = "allowedScenarios", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_scenarios: Vec, + #[doc = "The recovery services provider health error details."] + #[serde(rename = "healthErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub health_error_details: Vec, + #[doc = "The DRA Id."] + #[serde(rename = "draIdentifier", default, skip_serializing_if = "Option::is_none")] + pub dra_identifier: Option, + #[doc = "The machine Id."] + #[serde(rename = "machineId", default, skip_serializing_if = "Option::is_none")] + pub machine_id: Option, + #[doc = "The machine name."] + #[serde(rename = "machineName", default, skip_serializing_if = "Option::is_none")] + pub machine_name: Option, + #[doc = "The Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "Identity provider details."] + #[serde(rename = "authenticationIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub authentication_identity_details: Option, + #[doc = "Identity provider details."] + #[serde(rename = "resourceAccessIdentityDetails", default, skip_serializing_if = "Option::is_none")] + pub resource_access_identity_details: Option, + #[doc = "Identity provider details."] + #[serde( + rename = "dataPlaneAuthenticationIdentityDetails", + default, + skip_serializing_if = "Option::is_none" + )] + pub data_plane_authentication_identity_details: Option, + #[doc = "Version related details."] + #[serde(rename = "providerVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_version_details: Option, +} +impl RecoveryServicesProviderProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery Virtual network custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecoveryVirtualNetworkCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl RecoveryVirtualNetworkCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "Input for remove disk(s) operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemoveDisksInput { + #[doc = "Remove Disk input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RemoveDisksInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Remove Disk input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemoveDisksInputProperties { + #[doc = "Remove Disk provider specific input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl RemoveDisksInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Remove Disk provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RemoveDisksProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl RemoveDisksProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Container unpairing input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemoveProtectionContainerMappingInput { + #[doc = "Unpairing input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RemoveProtectionContainerMappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Unpairing input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RemoveProtectionContainerMappingInputProperties { + #[doc = "Provider specific input for unpairing operations."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +impl RemoveProtectionContainerMappingInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Certificate renewal input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RenewCertificateInput { + #[doc = "Renew Certificate input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RenewCertificateInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Renew Certificate input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RenewCertificateInputProperties { + #[doc = "Renew certificate type."] + #[serde(rename = "renewCertificateType", default, skip_serializing_if = "Option::is_none")] + pub renew_certificate_type: Option, +} +impl RenewCertificateInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationAgentDetails { + #[doc = "The replication agent Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The replication agent name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The replication agent Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The replication agent Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the replication agent."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health of the replication agent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl ReplicationAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod replication_agent_details { + use super::*; + #[doc = "The health of the replication agent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Replication appliance definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationAppliance { + #[doc = "Replication appliance properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ReplicationAppliance { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication appliance properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationApplianceProperties { + #[doc = "Appliance specific details."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl ReplicationApplianceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication eligibility results response model."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationEligibilityResults { + #[doc = "Gets the name of this object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets the object type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets Unique ARM identifier for this object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Properties model for replication eligibility results API."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ReplicationEligibilityResults { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication eligibility results collection response model."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationEligibilityResultsCollection { + #[doc = "The replication eligibility results details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ReplicationEligibilityResultsCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error model that can be exposed to the user."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationEligibilityResultsErrorInfo { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The possible causes."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "The recommended action."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "The error status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl ReplicationEligibilityResultsErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties model for replication eligibility results API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationEligibilityResultsProperties { + #[doc = "The client request Id."] + #[serde(rename = "clientRequestId", default, skip_serializing_if = "Option::is_none")] + pub client_request_id: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, +} +impl ReplicationEligibilityResultsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication group details. This will be used in case of San."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationGroupDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, +} +impl ReplicationGroupDetails { + pub fn new(configuration_settings: ConfigurationSettings) -> Self { + Self { configuration_settings } + } +} +#[doc = "Replication protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectedItem { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Replication protected item custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ReplicationProtectedItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protected item collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectedItemCollection { + #[doc = "The Replication protected item details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ReplicationProtectedItemCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protected item custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectedItemProperties { + #[doc = "The name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The type of protected item type."] + #[serde(rename = "protectedItemType", default, skip_serializing_if = "Option::is_none")] + pub protected_item_type: Option, + #[doc = "The protected item ARM Id."] + #[serde(rename = "protectableItemId", default, skip_serializing_if = "Option::is_none")] + pub protectable_item_id: Option, + #[doc = "The recovery provider ARM Id."] + #[serde(rename = "recoveryServicesProviderId", default, skip_serializing_if = "Option::is_none")] + pub recovery_services_provider_id: Option, + #[doc = "The friendly name of the primary fabric."] + #[serde(rename = "primaryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_friendly_name: Option, + #[doc = "The fabric provider of the primary fabric."] + #[serde(rename = "primaryFabricProvider", default, skip_serializing_if = "Option::is_none")] + pub primary_fabric_provider: Option, + #[doc = "The friendly name of recovery fabric."] + #[serde(rename = "recoveryFabricFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_friendly_name: Option, + #[doc = "The Arm Id of recovery fabric."] + #[serde(rename = "recoveryFabricId", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_id: Option, + #[doc = "The name of primary protection container friendly name."] + #[serde( + rename = "primaryProtectionContainerFriendlyName", + default, + skip_serializing_if = "Option::is_none" + )] + pub primary_protection_container_friendly_name: Option, + #[doc = "The name of recovery container friendly name."] + #[serde( + rename = "recoveryProtectionContainerFriendlyName", + default, + skip_serializing_if = "Option::is_none" + )] + pub recovery_protection_container_friendly_name: Option, + #[doc = "The protection status."] + #[serde(rename = "protectionState", default, skip_serializing_if = "Option::is_none")] + pub protection_state: Option, + #[doc = "The protection state description."] + #[serde(rename = "protectionStateDescription", default, skip_serializing_if = "Option::is_none")] + pub protection_state_description: Option, + #[doc = "The Current active location of the PE."] + #[serde(rename = "activeLocation", default, skip_serializing_if = "Option::is_none")] + pub active_location: Option, + #[doc = "The Test failover state."] + #[serde(rename = "testFailoverState", default, skip_serializing_if = "Option::is_none")] + pub test_failover_state: Option, + #[doc = "The Test failover state description."] + #[serde(rename = "testFailoverStateDescription", default, skip_serializing_if = "Option::is_none")] + pub test_failover_state_description: Option, + #[doc = "The switch provider state."] + #[serde(rename = "switchProviderState", default, skip_serializing_if = "Option::is_none")] + pub switch_provider_state: Option, + #[doc = "The switch provider state description."] + #[serde(rename = "switchProviderStateDescription", default, skip_serializing_if = "Option::is_none")] + pub switch_provider_state_description: Option, + #[doc = "The allowed operations on the Replication protected item."] + #[serde(rename = "allowedOperations", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_operations: Vec, + #[doc = "The consolidated protection health for the VM taking any issues with SRS as well as all the replication units associated with the VM's replication group into account. This is a string representation of the ProtectionHealth enumeration."] + #[serde(rename = "replicationHealth", default, skip_serializing_if = "Option::is_none")] + pub replication_health: Option, + #[doc = "The consolidated failover health for the VM."] + #[serde(rename = "failoverHealth", default, skip_serializing_if = "Option::is_none")] + pub failover_health: Option, + #[doc = "List of health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "The ID of Policy governing this PE."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, + #[doc = "The name of Policy governing this PE."] + #[serde(rename = "policyFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub policy_friendly_name: Option, + #[doc = "The Last successful failover time."] + #[serde(rename = "lastSuccessfulFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_failover_time: Option, + #[doc = "The Last successful test failover time."] + #[serde(rename = "lastSuccessfulTestFailoverTime", default, skip_serializing_if = "Option::is_none")] + pub last_successful_test_failover_time: Option, + #[doc = "Current scenario details of the protected entity."] + #[serde(rename = "currentScenario", default, skip_serializing_if = "Option::is_none")] + pub current_scenario: Option, + #[doc = "The recovery point ARM Id to which the Vm was failed over."] + #[serde(rename = "failoverRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub failover_recovery_point_id: Option, + #[doc = "Replication provider specific settings."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, + #[doc = "The recovery container Id."] + #[serde(rename = "recoveryContainerId", default, skip_serializing_if = "Option::is_none")] + pub recovery_container_id: Option, + #[doc = "The correlation Id for events associated with this protected item."] + #[serde(rename = "eventCorrelationId", default, skip_serializing_if = "Option::is_none")] + pub event_correlation_id: Option, +} +impl ReplicationProtectedItemProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protection intent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectionIntent { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Replication protection intent custom data details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ReplicationProtectionIntent { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protection intent objects collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectionIntentCollection { + #[doc = "The Replication protection intent details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ReplicationProtectionIntentCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication protection intent custom data details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProtectionIntentProperties { + #[doc = "The name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The job Id."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The job state."] + #[serde(rename = "jobState", default, skip_serializing_if = "Option::is_none")] + pub job_state: Option, + #[doc = "A value indicating whether the intent object is active."] + #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")] + pub is_active: Option, + #[doc = "The creation time in UTC."] + #[serde(rename = "creationTimeUTC", default, skip_serializing_if = "Option::is_none")] + pub creation_time_utc: Option, + #[doc = "Replication provider specific settings."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl ReplicationProtectionIntentProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Replication provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProtectionIntentProviderSpecificSettings { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReplicationProtectionIntentProviderSpecificSettings { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Provider specific input for unpairing operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReplicationProviderContainerUnmappingInput { + #[doc = "The class type."] + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, +} +impl ReplicationProviderContainerUnmappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific input for container creation operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificContainerCreationInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReplicationProviderSpecificContainerCreationInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Provider specific input for pairing operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificContainerMappingInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReplicationProviderSpecificContainerMappingInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Replication provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificSettings { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReplicationProviderSpecificSettings { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Provider specific input for update pairing operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReplicationProviderSpecificUpdateContainerMappingInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReplicationProviderSpecificUpdateContainerMappingInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Reprotect agent details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReprotectAgentDetails { + #[doc = "The reprotect agent Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The reprotect agent name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The reprotect agent Bios Id."] + #[serde(rename = "biosId", default, skip_serializing_if = "Option::is_none")] + pub bios_id: Option, + #[doc = "The fabric object Id."] + #[serde(rename = "fabricObjectId", default, skip_serializing_if = "Option::is_none")] + pub fabric_object_id: Option, + #[doc = "The reprotect agent Fqdn."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub fqdn: Option, + #[doc = "The version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The last heartbeat received from the reprotect agent."] + #[serde(rename = "lastHeartbeatUtc", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat_utc: Option, + #[doc = "The health of the reprotect agent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub health: Option, + #[doc = "The health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, + #[doc = "The protected item count."] + #[serde(rename = "protectedItemCount", default, skip_serializing_if = "Option::is_none")] + pub protected_item_count: Option, + #[doc = "The list of accessible datastores fetched from discovery."] + #[serde(rename = "accessibleDatastores", default, skip_serializing_if = "Vec::is_empty")] + pub accessible_datastores: Vec, + #[doc = "The Vcenter Id."] + #[serde(rename = "vcenterId", default, skip_serializing_if = "Option::is_none")] + pub vcenter_id: Option, + #[doc = "The last time when SDS information discovered in SRS."] + #[serde(rename = "lastDiscoveryInUtc", default, skip_serializing_if = "Option::is_none")] + pub last_discovery_in_utc: Option, +} +impl ReprotectAgentDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod reprotect_agent_details { + use super::*; + #[doc = "The health of the reprotect agent."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Health { + None, + Normal, + Warning, + Critical, + } +} +#[doc = "Resolve health errors input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResolveHealthError { + #[doc = "Health error id."] + #[serde(rename = "healthErrorId", default, skip_serializing_if = "Option::is_none")] + pub health_error_id: Option, +} +impl ResolveHealthError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resolve health input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResolveHealthInput { + #[doc = "Resolve health input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResolveHealthInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resolve health input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResolveHealthInputProperties { + #[doc = "Health errors."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl ResolveHealthInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Location"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class to define the health summary of the resources contained under an Arm resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceHealthSummary { + #[doc = "The count of total resources under the container."] + #[serde(rename = "resourceCount", default, skip_serializing_if = "Option::is_none")] + pub resource_count: Option, + #[doc = "The list of summary of health errors across the resources under the container."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub issues: Vec, + #[doc = "The categorized resource counts."] + #[serde(rename = "categorizedResourceCounts", default, skip_serializing_if = "Option::is_none")] + pub categorized_resource_counts: Option, +} +impl ResourceHealthSummary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resume job params."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResumeJobParams { + #[doc = "Resume job properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ResumeJobParams { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resume job properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResumeJobParamsProperties { + #[doc = "Resume job comments."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +impl ResumeJobParamsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Resync input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncInput { + #[doc = "Resync input properties."] + pub properties: ResyncInputProperties, +} +impl ResyncInput { + pub fn new(properties: ResyncInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Resync input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncInputProperties { + #[doc = "Resync provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: ResyncProviderSpecificInput, +} +impl ResyncInputProperties { + pub fn new(provider_specific_details: ResyncProviderSpecificInput) -> Self { + Self { provider_specific_details } + } +} +#[doc = "Resync provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResyncProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ResyncProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "The retention details of the MT."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RetentionVolume { + #[doc = "The volume name."] + #[serde(rename = "volumeName", default, skip_serializing_if = "Option::is_none")] + pub volume_name: Option, + #[doc = "The volume capacity."] + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[doc = "The free space available in this volume."] + #[serde(rename = "freeSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub free_space_in_bytes: Option, + #[doc = "The threshold percentage."] + #[serde(rename = "thresholdPercentage", default, skip_serializing_if = "Option::is_none")] + pub threshold_percentage: Option, +} +impl RetentionVolume { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reverse replication input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReverseReplicationInput { + #[doc = "Reverse replication input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ReverseReplicationInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reverse replication input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ReverseReplicationInputProperties { + #[doc = "Failover direction."] + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[doc = "Provider specific reverse replication input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl ReverseReplicationInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific reverse replication input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ReverseReplicationProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl ReverseReplicationProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Azure role assignment details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoleAssignment { + #[doc = "The ARM Id of the role assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the role assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Role assignment scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Principal Id."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "Role definition id."] + #[serde(rename = "roleDefinitionId", default, skip_serializing_if = "Option::is_none")] + pub role_definition_id: Option, +} +impl RoleAssignment { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "CS Accounts Details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RunAsAccount { + #[doc = "The CS RunAs account Id."] + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[doc = "The CS RunAs account name."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, +} +impl RunAsAccount { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the script action task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScriptActionTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "The name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The path."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output: Option, + #[doc = "A value indicating whether it is a primary side script or not."] + #[serde(rename = "isPrimarySideScript", default, skip_serializing_if = "Option::is_none")] + pub is_primary_side_script: Option, +} +impl ScriptActionTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + name: None, + path: None, + output: None, + is_primary_side_script: None, + } + } +} +#[doc = "ASR error model."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServiceError { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Possible causes of error."] + #[serde(rename = "possibleCauses", default, skip_serializing_if = "Option::is_none")] + pub possible_causes: Option, + #[doc = "Recommended action to resolve error."] + #[serde(rename = "recommendedAction", default, skip_serializing_if = "Option::is_none")] + pub recommended_action: Option, + #[doc = "Activity Id."] + #[serde(rename = "activityId", default, skip_serializing_if = "Option::is_none")] + pub activity_id: Option, +} +impl ServiceError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage account custom input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StorageAccountCustomDetails { + #[doc = "The class type."] + #[serde(rename = "resourceType")] + pub resource_type: String, +} +impl StorageAccountCustomDetails { + pub fn new(resource_type: String) -> Self { + Self { resource_type } + } +} +#[doc = "Storage object definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassification { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Storage object properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl StorageClassification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of storage details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationCollection { + #[doc = "The storage details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StorageClassificationCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage mapping object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationMapping { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Storage mapping properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl StorageClassificationMapping { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of storage mapping details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationMappingCollection { + #[doc = "The storage details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl StorageClassificationMappingCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage mapping input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationMappingInput { + #[doc = "Storage mapping input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl StorageClassificationMappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage mapping properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationMappingProperties { + #[doc = "Target storage object Id."] + #[serde(rename = "targetStorageClassificationId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_classification_id: Option, +} +impl StorageClassificationMappingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage object properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageClassificationProperties { + #[doc = "Friendly name of the Storage classification."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, +} +impl StorageClassificationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Storage mapping input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageMappingInputProperties { + #[doc = "The ID of the storage object."] + #[serde(rename = "targetStorageClassificationId", default, skip_serializing_if = "Option::is_none")] + pub target_storage_classification_id: Option, +} +impl StorageMappingInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Subnets of the network."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Subnet { + #[doc = "The subnet name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The subnet friendly name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The list of addresses for the subnet."] + #[serde(rename = "addressList", default, skip_serializing_if = "Vec::is_empty")] + pub address_list: Vec, +} +impl Subnet { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Supported operating system details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedOsDetails { + #[doc = "The name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "The type."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The list of version for operating system."] + #[serde(rename = "osVersions", default, skip_serializing_if = "Vec::is_empty")] + pub os_versions: Vec, +} +impl SupportedOsDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Supported operating systems properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedOsProperties { + #[doc = "The supported operating systems property list."] + #[serde(rename = "supportedOsList", default, skip_serializing_if = "Vec::is_empty")] + pub supported_os_list: Vec, +} +impl SupportedOsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Supported operating systems property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedOsProperty { + #[doc = "The replication provider type."] + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[doc = "The list of supported operating systems."] + #[serde(rename = "supportedOs", default, skip_serializing_if = "Vec::is_empty")] + pub supported_os: Vec, +} +impl SupportedOsProperty { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Supported operating systems."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SupportedOperatingSystems { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Supported operating systems properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SupportedOperatingSystems { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Switch protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SwitchProtectionInput { + #[doc = "Switch protection input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SwitchProtectionInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Switch protection input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SwitchProtectionInputProperties { + #[doc = "The unique replication protected item name."] + #[serde(rename = "replicationProtectedItemName", default, skip_serializing_if = "Option::is_none")] + pub replication_protected_item_name: Option, + #[doc = "Provider specific switch protection input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl SwitchProtectionInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents details for switch protection job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "ARM Id of the new replication protected item."] + #[serde(rename = "newReplicationProtectedItemId", default, skip_serializing_if = "Option::is_none")] + pub new_replication_protected_item_id: Option, +} +impl SwitchProtectionJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + new_replication_protected_item_id: None, + } + } +} +#[doc = "Provider specific switch protection input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProtectionProviderSpecificInput { + #[doc = "Gets the Instance type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl SwitchProtectionProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input definition for switch provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SwitchProviderInput { + #[doc = "Input definition for switch provider input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SwitchProviderInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input definition for switch provider input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SwitchProviderInputProperties { + #[doc = "Target provider type."] + #[serde(rename = "targetInstanceType", default, skip_serializing_if = "Option::is_none")] + pub target_instance_type: Option, + #[doc = "Provider specific switch provider input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl SwitchProviderInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific switch provider input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchProviderProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl SwitchProviderProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Represents applicable recovery vm sizes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetComputeSize { + #[doc = "The Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The Type of the object."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Represents applicable recovery vm sizes properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TargetComputeSize { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Target compute size collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetComputeSizeCollection { + #[doc = "The list of target compute sizes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TargetComputeSizeCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents applicable recovery vm sizes properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TargetComputeSizeProperties { + #[doc = "Target compute size name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Target compute size display name."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The maximum cpu cores count supported by target compute size."] + #[serde(rename = "cpuCoresCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_cores_count: Option, + #[doc = "The Available vCPUs supported by target compute size."] + #[serde(rename = "vCPUsAvailable", default, skip_serializing_if = "Option::is_none")] + pub v_cp_us_available: Option, + #[doc = "The maximum memory in GB supported by target compute size."] + #[serde(rename = "memoryInGB", default, skip_serializing_if = "Option::is_none")] + pub memory_in_gb: Option, + #[doc = "The maximum data disks count supported by target compute size."] + #[serde(rename = "maxDataDiskCount", default, skip_serializing_if = "Option::is_none")] + pub max_data_disk_count: Option, + #[doc = "The maximum Nics count supported by target compute size."] + #[serde(rename = "maxNicsCount", default, skip_serializing_if = "Option::is_none")] + pub max_nics_count: Option, + #[doc = "The reasons why the target compute size is not applicable for the protected item."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, + #[doc = "The value indicating whether the target compute size supports high Iops."] + #[serde(rename = "highIopsSupported", default, skip_serializing_if = "Option::is_none")] + pub high_iops_supported: Option, + #[doc = "The supported HyperV Generations."] + #[serde(rename = "hyperVGenerations", default, skip_serializing_if = "Vec::is_empty")] + pub hyper_v_generations: Vec, +} +impl TargetComputeSizeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Task details based on specific task type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TaskTypeDetails { + #[doc = "The type of task details."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl TaskTypeDetails { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input definition for test failover cleanup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverCleanupInput { + #[doc = "Input definition for test failover cleanup input properties."] + pub properties: TestFailoverCleanupInputProperties, +} +impl TestFailoverCleanupInput { + pub fn new(properties: TestFailoverCleanupInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Input definition for test failover cleanup input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TestFailoverCleanupInputProperties { + #[doc = "Test failover cleanup comments."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +impl TestFailoverCleanupInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input definition for test failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverInput { + #[doc = "Input definition for test failover input properties."] + pub properties: TestFailoverInputProperties, +} +impl TestFailoverInput { + pub fn new(properties: TestFailoverInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Input definition for test failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TestFailoverInputProperties { + #[doc = "Test failover direction."] + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[doc = "Network type to be used for test failover."] + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, + #[doc = "The id of the network to be used for test failover."] + #[serde(rename = "networkId", default, skip_serializing_if = "Option::is_none")] + pub network_id: Option, + #[doc = "Provider specific test failover input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl TestFailoverInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This class represents the details for a test failover job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverJobDetails { + #[serde(flatten)] + pub job_details: JobDetails, + #[doc = "The test failover status."] + #[serde(rename = "testFailoverStatus", default, skip_serializing_if = "Option::is_none")] + pub test_failover_status: Option, + #[doc = "The test failover comments."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, + #[doc = "The test network name."] + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[doc = "The test network friendly name."] + #[serde(rename = "networkFriendlyName", default, skip_serializing_if = "Option::is_none")] + pub network_friendly_name: Option, + #[doc = "The test network type (see TestFailoverInput enum for possible values)."] + #[serde(rename = "networkType", default, skip_serializing_if = "Option::is_none")] + pub network_type: Option, + #[doc = "The test VM details."] + #[serde(rename = "protectedItemDetails", default, skip_serializing_if = "Vec::is_empty")] + pub protected_item_details: Vec, +} +impl TestFailoverJobDetails { + pub fn new(job_details: JobDetails) -> Self { + Self { + job_details, + test_failover_status: None, + comments: None, + network_name: None, + network_friendly_name: None, + network_type: None, + protected_item_details: Vec::new(), + } + } +} +#[doc = "Provider specific test failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestFailoverProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl TestFailoverProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input for test migrate cleanup."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateCleanupInput { + #[doc = "Test migrate cleanup input properties."] + pub properties: TestMigrateCleanupInputProperties, +} +impl TestMigrateCleanupInput { + pub fn new(properties: TestMigrateCleanupInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Test migrate cleanup input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TestMigrateCleanupInputProperties { + #[doc = "Test migrate cleanup comments."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub comments: Option, +} +impl TestMigrateCleanupInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input for test migrate."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateInput { + #[doc = "Test migrate input properties."] + pub properties: TestMigrateInputProperties, +} +impl TestMigrateInput { + pub fn new(properties: TestMigrateInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Test migrate input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateInputProperties { + #[doc = "Test migrate provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: TestMigrateProviderSpecificInput, +} +impl TestMigrateInputProperties { + pub fn new(provider_specific_details: TestMigrateProviderSpecificInput) -> Self { + Self { provider_specific_details } + } +} +#[doc = "Test migrate provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TestMigrateProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl TestMigrateProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input definition for unplanned failover."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnplannedFailoverInput { + #[doc = "Input definition for unplanned failover input properties."] + pub properties: UnplannedFailoverInputProperties, +} +impl UnplannedFailoverInput { + pub fn new(properties: UnplannedFailoverInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Input definition for unplanned failover input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnplannedFailoverInputProperties { + #[doc = "Failover direction."] + #[serde(rename = "failoverDirection", default, skip_serializing_if = "Option::is_none")] + pub failover_direction: Option, + #[doc = "Source site operations status."] + #[serde(rename = "sourceSiteOperations", default, skip_serializing_if = "Option::is_none")] + pub source_site_operations: Option, + #[doc = "Provider specific unplanned failover input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl UnplannedFailoverInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provider specific unplanned failover input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UnplannedFailoverProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl UnplannedFailoverProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Update appliance for replication protected item input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemInput { + #[doc = "Update appliance for protected item input properties."] + pub properties: UpdateApplianceForReplicationProtectedItemInputProperties, +} +impl UpdateApplianceForReplicationProtectedItemInput { + pub fn new(properties: UpdateApplianceForReplicationProtectedItemInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Update appliance for protected item input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemInputProperties { + #[doc = "The target appliance Id."] + #[serde(rename = "targetApplianceId")] + pub target_appliance_id: String, + #[doc = "Update replication protected item provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: UpdateApplianceForReplicationProtectedItemProviderSpecificInput, +} +impl UpdateApplianceForReplicationProtectedItemInputProperties { + pub fn new( + target_appliance_id: String, + provider_specific_details: UpdateApplianceForReplicationProtectedItemProviderSpecificInput, + ) -> Self { + Self { + target_appliance_id, + provider_specific_details, + } + } +} +#[doc = "Update replication protected item provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateApplianceForReplicationProtectedItemProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl UpdateApplianceForReplicationProtectedItemProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Disk input for update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateDiskInput { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "The target disk name."] + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +impl UpdateDiskInput { + pub fn new(disk_id: String) -> Self { + Self { + disk_id, + target_disk_name: None, + } + } +} +#[doc = "Update migration item input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateMigrationItemInput { + #[doc = "Update migration item input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateMigrationItemInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update migration item input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMigrationItemInputProperties { + #[doc = "Update migration item provider specific input."] + #[serde(rename = "providerSpecificDetails")] + pub provider_specific_details: UpdateMigrationItemProviderSpecificInput, +} +impl UpdateMigrationItemInputProperties { + pub fn new(provider_specific_details: UpdateMigrationItemProviderSpecificInput) -> Self { + Self { provider_specific_details } + } +} +#[doc = "Update migration item provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateMigrationItemProviderSpecificInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl UpdateMigrationItemProviderSpecificInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Request to update the mobility service on a protected item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateMobilityServiceRequest { + #[doc = "The properties of an update mobility service request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateMobilityServiceRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an update mobility service request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateMobilityServiceRequestProperties { + #[doc = "The CS run as account Id."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +impl UpdateMobilityServiceRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update network mapping input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateNetworkMappingInput { + #[doc = "Common input details for network mapping operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateNetworkMappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common input details for network mapping operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateNetworkMappingInputProperties { + #[doc = "Recovery fabric name."] + #[serde(rename = "recoveryFabricName", default, skip_serializing_if = "Option::is_none")] + pub recovery_fabric_name: Option, + #[doc = "Recovery network Id."] + #[serde(rename = "recoveryNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_id: Option, + #[doc = "Input details specific to fabrics during Network Mapping."] + #[serde(rename = "fabricSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub fabric_specific_details: Option, +} +impl UpdateNetworkMappingInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update policy input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdatePolicyInput { + #[doc = "Policy update properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdatePolicyInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Policy update properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdatePolicyInputProperties { + #[doc = "Base class for provider specific input."] + #[serde(rename = "replicationProviderSettings", default, skip_serializing_if = "Option::is_none")] + pub replication_provider_settings: Option, +} +impl UpdatePolicyInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container pairing update input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateProtectionContainerMappingInput { + #[doc = "Container pairing update input."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateProtectionContainerMappingInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Container pairing update input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateProtectionContainerMappingInputProperties { + #[doc = "Provider specific input for update pairing operations."] + #[serde(rename = "providerSpecificInput", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_input: Option, +} +impl UpdateProtectionContainerMappingInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update recovery plan input class."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateRecoveryPlanInput { + #[doc = "Recovery plan update properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateRecoveryPlanInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Recovery plan update properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateRecoveryPlanInputProperties { + #[doc = "The recovery plan groups."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub groups: Vec, +} +impl UpdateRecoveryPlanInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update replication protected item input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateReplicationProtectedItemInput { + #[doc = "Update protected item input properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateReplicationProtectedItemInput { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Update protected item input properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateReplicationProtectedItemInputProperties { + #[doc = "Target Azure VM name given by the user."] + #[serde(rename = "recoveryAzureVMName", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_name: Option, + #[doc = "Target Azure VM size."] + #[serde(rename = "recoveryAzureVMSize", default, skip_serializing_if = "Option::is_none")] + pub recovery_azure_vm_size: Option, + #[doc = "Target Azure Network Id."] + #[serde(rename = "selectedRecoveryAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_recovery_azure_network_id: Option, + #[doc = "The Azure Network Id for test failover."] + #[serde(rename = "selectedTfoAzureNetworkId", default, skip_serializing_if = "Option::is_none")] + pub selected_tfo_azure_network_id: Option, + #[doc = "The selected source nic Id which will be used as the primary nic during failover."] + #[serde(rename = "selectedSourceNicId", default, skip_serializing_if = "Option::is_none")] + pub selected_source_nic_id: Option, + #[doc = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum."] + #[serde(rename = "enableRdpOnTargetOption", default, skip_serializing_if = "Option::is_none")] + pub enable_rdp_on_target_option: Option, + #[doc = "The list of VM nic details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "License type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The target availability set Id."] + #[serde(rename = "recoveryAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub recovery_availability_set_id: Option, + #[doc = "Update replication protected item provider specific input."] + #[serde(rename = "providerSpecificDetails", default, skip_serializing_if = "Option::is_none")] + pub provider_specific_details: Option, +} +impl UpdateReplicationProtectedItemInputProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod update_replication_protected_item_input_properties { + use super::*; + #[doc = "License type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } +} +#[doc = "Update replication protected item provider specific input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateReplicationProtectedItemProviderInput { + #[doc = "The class type."] + #[serde(rename = "instanceType")] + pub instance_type: String, +} +impl UpdateReplicationProtectedItemProviderInput { + pub fn new(instance_type: String) -> Self { + Self { instance_type } + } +} +#[doc = "Input required to update vCenter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateVCenterRequest { + #[doc = "The properties of an update vCenter request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl UpdateVCenterRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an update vCenter request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateVCenterRequestProperties { + #[doc = "The friendly name of the vCenter."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "The IP address of the vCenter to be discovered."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The process server Id from where the update can be orchestrated."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The port number for discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The CS account Id which has privileges to update the vCenter."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, +} +impl UpdateVCenterRequestProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "vCenter definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VCenter { + #[serde(flatten)] + pub resource: Resource, + #[doc = "vCenter properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VCenter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Collection of vCenter details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VCenterCollection { + #[doc = "The vCenter details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VCenterCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "vCenter properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VCenterProperties { + #[doc = "Friendly name of the vCenter."] + #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")] + pub friendly_name: Option, + #[doc = "VCenter internal ID."] + #[serde(rename = "internalId", default, skip_serializing_if = "Option::is_none")] + pub internal_id: Option, + #[doc = "The time when the last heartbeat was received by vCenter."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "The VCenter discovery status."] + #[serde(rename = "discoveryStatus", default, skip_serializing_if = "Option::is_none")] + pub discovery_status: Option, + #[doc = "The process server Id."] + #[serde(rename = "processServerId", default, skip_serializing_if = "Option::is_none")] + pub process_server_id: Option, + #[doc = "The IP address of the vCenter."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The infrastructure Id of vCenter."] + #[serde(rename = "infrastructureId", default, skip_serializing_if = "Option::is_none")] + pub infrastructure_id: Option, + #[doc = "The port number for discovery."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The account Id which has privileges to discover the vCenter."] + #[serde(rename = "runAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub run_as_account_id: Option, + #[doc = "The ARM resource name of the fabric containing this VCenter."] + #[serde(rename = "fabricArmResourceName", default, skip_serializing_if = "Option::is_none")] + pub fabric_arm_resource_name: Option, + #[doc = "The health errors for this VCenter."] + #[serde(rename = "healthErrors", default, skip_serializing_if = "Vec::is_empty")] + pub health_errors: Vec, +} +impl VCenterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Hyper V VM network details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VmNicDetails { + #[doc = "The nic Id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[doc = "The replica nic Id."] + #[serde(rename = "replicaNicId", default, skip_serializing_if = "Option::is_none")] + pub replica_nic_id: Option, + #[doc = "The source nic ARM Id."] + #[serde(rename = "sourceNicArmId", default, skip_serializing_if = "Option::is_none")] + pub source_nic_arm_id: Option, + #[doc = "VM network name."] + #[serde(rename = "vMNetworkName", default, skip_serializing_if = "Option::is_none")] + pub v_m_network_name: Option, + #[doc = "Recovery VM network Id."] + #[serde(rename = "recoveryVMNetworkId", default, skip_serializing_if = "Option::is_none")] + pub recovery_vm_network_id: Option, + #[doc = "The IP configurations of the NIC."] + #[serde(rename = "ipConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configs: Vec, + #[doc = "Selection type for failover."] + #[serde(rename = "selectionType", default, skip_serializing_if = "Option::is_none")] + pub selection_type: Option, + #[doc = "The id of the NSG associated with the NIC."] + #[serde(rename = "recoveryNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_security_group_id: Option, + #[doc = "A value indicating whether the NIC has accelerated networking enabled."] + #[serde(rename = "enableAcceleratedNetworkingOnRecovery", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_recovery: Option, + #[doc = "The network to be used by NIC during test failover."] + #[serde(rename = "tfoVMNetworkId", default, skip_serializing_if = "Option::is_none")] + pub tfo_vm_network_id: Option, + #[doc = "The NSG to be used by NIC during test failover."] + #[serde(rename = "tfoNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub tfo_network_security_group_id: Option, + #[doc = "Whether the TFO NIC has accelerated networking enabled."] + #[serde(rename = "enableAcceleratedNetworkingOnTfo", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_tfo: Option, + #[doc = "The name of the NIC to be used when creating target NICs."] + #[serde(rename = "recoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_name: Option, + #[doc = "The resource group of the NIC to be used when creating target NICs."] + #[serde(rename = "recoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_resource_group_name: Option, + #[doc = "A value indicating whether an existing NIC is allowed to be reused during failover subject to availability."] + #[serde(rename = "reuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub reuse_existing_nic: Option, + #[doc = "The name of the NIC to be used when creating target NICs in TFO."] + #[serde(rename = "tfoRecoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub tfo_recovery_nic_name: Option, + #[doc = "The resource group of the NIC to be used when creating target NICs in TFO."] + #[serde(rename = "tfoRecoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub tfo_recovery_nic_resource_group_name: Option, + #[doc = "A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability."] + #[serde(rename = "tfoReuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub tfo_reuse_existing_nic: Option, + #[doc = "Target NIC name."] + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, +} +impl VmNicDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Hyper V VM network input details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VmNicInputDetails { + #[doc = "The nic Id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[doc = "The IP configurations to be used by NIC during test failover and failover."] + #[serde(rename = "ipConfigs", default, skip_serializing_if = "Vec::is_empty")] + pub ip_configs: Vec, + #[doc = "Selection type for failover."] + #[serde(rename = "selectionType", default, skip_serializing_if = "Option::is_none")] + pub selection_type: Option, + #[doc = "The id of the NSG associated with the NIC."] + #[serde(rename = "recoveryNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub recovery_network_security_group_id: Option, + #[doc = "Whether the NIC has accelerated networking enabled."] + #[serde(rename = "enableAcceleratedNetworkingOnRecovery", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_recovery: Option, + #[doc = "The NSG to be used by NIC during test failover."] + #[serde(rename = "tfoNetworkSecurityGroupId", default, skip_serializing_if = "Option::is_none")] + pub tfo_network_security_group_id: Option, + #[doc = "Whether the test NIC has accelerated networking enabled."] + #[serde(rename = "enableAcceleratedNetworkingOnTfo", default, skip_serializing_if = "Option::is_none")] + pub enable_accelerated_networking_on_tfo: Option, + #[doc = "The name of the NIC to be used when creating target NICs."] + #[serde(rename = "recoveryNicName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_name: Option, + #[doc = "The resource group of the NIC to be used when creating target NICs."] + #[serde(rename = "recoveryNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub recovery_nic_resource_group_name: Option, + #[doc = "A value indicating whether an existing NIC is allowed to be reused during failover subject to availability."] + #[serde(rename = "reuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub reuse_existing_nic: Option, + #[doc = "The name of the NIC to be used when creating target NICs in TFO."] + #[serde(rename = "tfoNicName", default, skip_serializing_if = "Option::is_none")] + pub tfo_nic_name: Option, + #[doc = "The resource group of the NIC to be used when creating target NICs in TFO."] + #[serde(rename = "tfoNicResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub tfo_nic_resource_group_name: Option, + #[doc = "A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability."] + #[serde(rename = "tfoReuseExistingNic", default, skip_serializing_if = "Option::is_none")] + pub tfo_reuse_existing_nic: Option, + #[doc = "Target NIC name."] + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, +} +impl VmNicInputDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "VMwareCbt container creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtContainerCreationInput { + #[serde(flatten)] + pub replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput, +} +impl VMwareCbtContainerCreationInput { + pub fn new(replication_provider_specific_container_creation_input: ReplicationProviderSpecificContainerCreationInput) -> Self { + Self { + replication_provider_specific_container_creation_input, + } + } +} +#[doc = "VMwareCbt container mapping input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtContainerMappingInput { + #[serde(flatten)] + pub replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput, + #[doc = "The target key vault ARM Id."] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[doc = "The target key vault URL."] + #[serde(rename = "keyVaultUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_uri: Option, + #[doc = "The storage account ARM Id."] + #[serde(rename = "storageAccountId")] + pub storage_account_id: String, + #[doc = "The secret name of the storage account."] + #[serde(rename = "storageAccountSasSecretName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_sas_secret_name: Option, + #[doc = "The secret name of the service bus connection string."] + #[serde(rename = "serviceBusConnectionStringSecretName", default, skip_serializing_if = "Option::is_none")] + pub service_bus_connection_string_secret_name: Option, + #[doc = "The target location."] + #[serde(rename = "targetLocation")] + pub target_location: String, +} +impl VMwareCbtContainerMappingInput { + pub fn new( + replication_provider_specific_container_mapping_input: ReplicationProviderSpecificContainerMappingInput, + storage_account_id: String, + target_location: String, + ) -> Self { + Self { + replication_provider_specific_container_mapping_input, + key_vault_id: None, + key_vault_uri: None, + storage_account_id, + storage_account_sas_secret_name: None, + service_bus_connection_string_secret_name: None, + target_location, + } + } +} +#[doc = "VMwareCbt disk input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtDiskInput { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "The disk type."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk")] + pub is_os_disk: String, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId")] + pub log_storage_account_id: String, + #[doc = "The key vault secret name of the log storage account."] + #[serde(rename = "logStorageAccountSasSecretName")] + pub log_storage_account_sas_secret_name: String, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl VMwareCbtDiskInput { + pub fn new(disk_id: String, is_os_disk: String, log_storage_account_id: String, log_storage_account_sas_secret_name: String) -> Self { + Self { + disk_id, + disk_type: None, + is_os_disk, + log_storage_account_id, + log_storage_account_sas_secret_name, + disk_encryption_set_id: None, + } + } +} +pub mod v_mware_cbt_disk_input { + use super::*; + #[doc = "The disk type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "VMwareCbt specific enable migration input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtEnableMigrationInput { + #[serde(flatten)] + pub enable_migration_provider_specific_input: EnableMigrationProviderSpecificInput, + #[doc = "The ARM Id of the VM discovered in VMware."] + #[serde(rename = "vmwareMachineId")] + pub vmware_machine_id: String, + #[doc = "The disks to include list."] + #[serde(rename = "disksToInclude")] + pub disks_to_include: Vec, + #[doc = "License type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The data mover run as account Id."] + #[serde(rename = "dataMoverRunAsAccountId")] + pub data_mover_run_as_account_id: String, + #[doc = "The snapshot run as account Id."] + #[serde(rename = "snapshotRunAsAccountId")] + pub snapshot_run_as_account_id: String, + #[doc = "The target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The target resource group ARM Id."] + #[serde(rename = "targetResourceGroupId")] + pub target_resource_group_id: String, + #[doc = "The target network ARM Id."] + #[serde(rename = "targetNetworkId")] + pub target_network_id: String, + #[doc = "The selected test network ARM Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "The target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "The selected test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The target availability set ARM Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group ARM Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "A value indicating whether auto resync is to be done."] + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the seed disks."] + #[serde(rename = "seedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_disk_tags: Option, + #[doc = "The tags for the target disks."] + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +impl VMwareCbtEnableMigrationInput { + pub fn new( + enable_migration_provider_specific_input: EnableMigrationProviderSpecificInput, + vmware_machine_id: String, + disks_to_include: Vec, + data_mover_run_as_account_id: String, + snapshot_run_as_account_id: String, + target_resource_group_id: String, + target_network_id: String, + ) -> Self { + Self { + enable_migration_provider_specific_input, + vmware_machine_id, + disks_to_include, + license_type: None, + sql_server_license_type: None, + data_mover_run_as_account_id, + snapshot_run_as_account_id, + target_vm_name: None, + target_vm_size: None, + target_resource_group_id, + target_network_id, + test_network_id: None, + target_subnet_name: None, + test_subnet_name: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + perform_auto_resync: None, + target_vm_tags: None, + seed_disk_tags: None, + target_disk_tags: None, + target_nic_tags: None, + } + } +} +pub mod v_mware_cbt_enable_migration_input { + use super::*; + #[doc = "License type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Event details for VMwareCbt provider."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtEventDetails { + #[serde(flatten)] + pub event_provider_specific_details: EventProviderSpecificDetails, + #[doc = "The migration item name."] + #[serde(rename = "migrationItemName", default, skip_serializing_if = "Option::is_none")] + pub migration_item_name: Option, +} +impl VMwareCbtEventDetails { + pub fn new(event_provider_specific_details: EventProviderSpecificDetails) -> Self { + Self { + event_provider_specific_details, + migration_item_name: None, + } + } +} +#[doc = "VMwareCbt specific migrate input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtMigrateInput { + #[serde(flatten)] + pub migrate_provider_specific_input: MigrateProviderSpecificInput, + #[doc = "A value indicating whether VM is to be shutdown."] + #[serde(rename = "performShutdown")] + pub perform_shutdown: String, +} +impl VMwareCbtMigrateInput { + pub fn new(migrate_provider_specific_input: MigrateProviderSpecificInput, perform_shutdown: String) -> Self { + Self { + migrate_provider_specific_input, + perform_shutdown, + } + } +} +#[doc = "VMwareCbt provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtMigrationDetails { + #[serde(flatten)] + pub migration_provider_specific_settings: MigrationProviderSpecificSettings, + #[doc = "The ARM Id of the VM discovered in VMware."] + #[serde(rename = "vmwareMachineId", default, skip_serializing_if = "Option::is_none")] + pub vmware_machine_id: Option, + #[doc = "The type of the OS on the VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The firmware type."] + #[serde(rename = "firmwareType", default, skip_serializing_if = "Option::is_none")] + pub firmware_type: Option, + #[doc = "The target generation."] + #[serde(rename = "targetGeneration", default, skip_serializing_if = "Option::is_none")] + pub target_generation: Option, + #[doc = "License Type of the VM to be used."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "The data mover run as account Id."] + #[serde(rename = "dataMoverRunAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub data_mover_run_as_account_id: Option, + #[doc = "The snapshot run as account Id."] + #[serde(rename = "snapshotRunAsAccountId", default, skip_serializing_if = "Option::is_none")] + pub snapshot_run_as_account_id: Option, + #[doc = "Target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The target location."] + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, + #[doc = "The target resource group Id."] + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[doc = "The target availability set Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The list of protected disks."] + #[serde(rename = "protectedDisks", default, skip_serializing_if = "Vec::is_empty")] + pub protected_disks: Vec, + #[doc = "The target network Id."] + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[doc = "The network details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, + #[doc = "The recovery point Id to which the VM was migrated."] + #[serde(rename = "migrationRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub migration_recovery_point_id: Option, + #[doc = "The last recovery point received time."] + #[serde(rename = "lastRecoveryPointReceived", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_received: Option, + #[doc = "The last recovery point Id."] + #[serde(rename = "lastRecoveryPointId", default, skip_serializing_if = "Option::is_none")] + pub last_recovery_point_id: Option, + #[doc = "The initial seeding progress percentage."] + #[serde(rename = "initialSeedingProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub initial_seeding_progress_percentage: Option, + #[doc = "The migration progress percentage."] + #[serde(rename = "migrationProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub migration_progress_percentage: Option, + #[doc = "The resync progress percentage."] + #[serde(rename = "resyncProgressPercentage", default, skip_serializing_if = "Option::is_none")] + pub resync_progress_percentage: Option, + #[doc = "The initial seeding retry count."] + #[serde(rename = "initialSeedingRetryCount", default, skip_serializing_if = "Option::is_none")] + pub initial_seeding_retry_count: Option, + #[doc = "The resync retry count."] + #[serde(rename = "resyncRetryCount", default, skip_serializing_if = "Option::is_none")] + pub resync_retry_count: Option, + #[doc = "A value indicating whether resync is required."] + #[serde(rename = "resyncRequired", default, skip_serializing_if = "Option::is_none")] + pub resync_required: Option, + #[doc = "The resync state."] + #[serde(rename = "resyncState", default, skip_serializing_if = "Option::is_none")] + pub resync_state: Option, + #[doc = "A value indicating whether auto resync is to be done."] + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[doc = "The tags for the seed disks."] + #[serde(rename = "seedDiskTags", default, skip_serializing_if = "Option::is_none")] + pub seed_disk_tags: Option, + #[doc = "The tags for the target disks."] + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, +} +impl VMwareCbtMigrationDetails { + pub fn new(migration_provider_specific_settings: MigrationProviderSpecificSettings) -> Self { + Self { + migration_provider_specific_settings, + vmware_machine_id: None, + os_type: None, + firmware_type: None, + target_generation: None, + license_type: None, + sql_server_license_type: None, + data_mover_run_as_account_id: None, + snapshot_run_as_account_id: None, + target_vm_name: None, + target_vm_size: None, + target_location: None, + target_resource_group_id: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + target_vm_tags: None, + protected_disks: Vec::new(), + target_network_id: None, + vm_nics: Vec::new(), + target_nic_tags: None, + migration_recovery_point_id: None, + last_recovery_point_received: None, + last_recovery_point_id: None, + initial_seeding_progress_percentage: None, + migration_progress_percentage: None, + resync_progress_percentage: None, + initial_seeding_retry_count: None, + resync_retry_count: None, + resync_required: None, + resync_state: None, + perform_auto_resync: None, + seed_disk_tags: None, + target_disk_tags: None, + } + } +} +pub mod v_mware_cbt_migration_details { + use super::*; + #[doc = "The resync state."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ResyncState { + None, + PreparedForResynchronization, + StartedResynchronization, + } +} +#[doc = "VMwareCbt NIC details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VMwareCbtNicDetails { + #[doc = "The NIC Id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[doc = "A value indicating whether this is the primary NIC."] + #[serde(rename = "isPrimaryNic", default, skip_serializing_if = "Option::is_none")] + pub is_primary_nic: Option, + #[doc = "The source IP address."] + #[serde(rename = "sourceIPAddress", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address: Option, + #[doc = "The source IP address type."] + #[serde(rename = "sourceIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub source_ip_address_type: Option, + #[doc = "Source network Id."] + #[serde(rename = "sourceNetworkId", default, skip_serializing_if = "Option::is_none")] + pub source_network_id: Option, + #[doc = "The target IP address."] + #[serde(rename = "targetIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address: Option, + #[doc = "The target IP address type."] + #[serde(rename = "targetIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub target_ip_address_type: Option, + #[doc = "Target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "Source network Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "Test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The test IP address."] + #[serde(rename = "testIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address: Option, + #[doc = "The test IP address type."] + #[serde(rename = "testIPAddressType", default, skip_serializing_if = "Option::is_none")] + pub test_ip_address_type: Option, + #[doc = "Target NIC name."] + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, + #[doc = "A value indicating whether this NIC is selected for migration."] + #[serde(rename = "isSelectedForMigration", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_migration: Option, +} +impl VMwareCbtNicDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod v_mware_cbt_nic_details { + use super::*; + #[doc = "The source IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SourceIpAddressType { + Dynamic, + Static, + } + #[doc = "The target IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TargetIpAddressType { + Dynamic, + Static, + } + #[doc = "The test IP address type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TestIpAddressType { + Dynamic, + Static, + } +} +#[doc = "VMwareCbt NIC input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtNicInput { + #[doc = "The NIC Id."] + #[serde(rename = "nicId")] + pub nic_id: String, + #[doc = "A value indicating whether this is the primary NIC."] + #[serde(rename = "isPrimaryNic")] + pub is_primary_nic: String, + #[doc = "Target subnet name."] + #[serde(rename = "targetSubnetName", default, skip_serializing_if = "Option::is_none")] + pub target_subnet_name: Option, + #[doc = "The static IP address."] + #[serde(rename = "targetStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub target_static_ip_address: Option, + #[doc = "A value indicating whether this NIC is selected for migration."] + #[serde(rename = "isSelectedForMigration", default, skip_serializing_if = "Option::is_none")] + pub is_selected_for_migration: Option, + #[doc = "Target NIC name."] + #[serde(rename = "targetNicName", default, skip_serializing_if = "Option::is_none")] + pub target_nic_name: Option, + #[doc = "The test subnet name."] + #[serde(rename = "testSubnetName", default, skip_serializing_if = "Option::is_none")] + pub test_subnet_name: Option, + #[doc = "The test static IP address."] + #[serde(rename = "testStaticIPAddress", default, skip_serializing_if = "Option::is_none")] + pub test_static_ip_address: Option, +} +impl VMwareCbtNicInput { + pub fn new(nic_id: String, is_primary_nic: String) -> Self { + Self { + nic_id, + is_primary_nic, + target_subnet_name: None, + target_static_ip_address: None, + is_selected_for_migration: None, + target_nic_name: None, + test_subnet_name: None, + test_static_ip_address: None, + } + } +} +#[doc = "VMware Cbt policy creation input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtPolicyCreationInput { + #[serde(flatten)] + pub policy_provider_specific_input: PolicyProviderSpecificInput, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[doc = "The crash consistent snapshot frequency (in minutes)."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, + #[doc = "The app consistent snapshot frequency (in minutes)."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, +} +impl VMwareCbtPolicyCreationInput { + pub fn new(policy_provider_specific_input: PolicyProviderSpecificInput) -> Self { + Self { + policy_provider_specific_input, + recovery_point_history_in_minutes: None, + crash_consistent_frequency_in_minutes: None, + app_consistent_frequency_in_minutes: None, + } + } +} +#[doc = "VMwareCbt protected disk details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VMwareCbtProtectedDiskDetails { + #[doc = "The disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "The disk name."] + #[serde(rename = "diskName", default, skip_serializing_if = "Option::is_none")] + pub disk_name: Option, + #[doc = "The disk type."] + #[serde(rename = "diskType", default, skip_serializing_if = "Option::is_none")] + pub disk_type: Option, + #[doc = "The disk path."] + #[serde(rename = "diskPath", default, skip_serializing_if = "Option::is_none")] + pub disk_path: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, + #[doc = "The disk capacity in bytes."] + #[serde(rename = "capacityInBytes", default, skip_serializing_if = "Option::is_none")] + pub capacity_in_bytes: Option, + #[doc = "The log storage account ARM Id."] + #[serde(rename = "logStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_id: Option, + #[doc = "The key vault secret name of the log storage account."] + #[serde(rename = "logStorageAccountSasSecretName", default, skip_serializing_if = "Option::is_none")] + pub log_storage_account_sas_secret_name: Option, + #[doc = "The DiskEncryptionSet ARM Id."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, + #[doc = "The ARM Id of the seed managed disk."] + #[serde(rename = "seedManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub seed_managed_disk_id: Option, + #[doc = "The ARM Id of the target managed disk."] + #[serde(rename = "targetManagedDiskId", default, skip_serializing_if = "Option::is_none")] + pub target_managed_disk_id: Option, + #[doc = "The name for the target managed disk."] + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, +} +impl VMwareCbtProtectedDiskDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod v_mware_cbt_protected_disk_details { + use super::*; + #[doc = "The disk type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DiskType { + #[serde(rename = "Standard_LRS")] + StandardLrs, + #[serde(rename = "Premium_LRS")] + PremiumLrs, + #[serde(rename = "StandardSSD_LRS")] + StandardSsdLrs, + } +} +#[doc = "VMwareCbt provider specific container mapping details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtProtectionContainerMappingDetails { + #[serde(flatten)] + pub protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails, + #[doc = "The target key vault ARM Id."] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, + #[doc = "The target key vault URI."] + #[serde(rename = "keyVaultUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_uri: Option, + #[doc = "The storage account ARM Id."] + #[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")] + pub storage_account_id: Option, + #[doc = "The secret name of the storage account."] + #[serde(rename = "storageAccountSasSecretName", default, skip_serializing_if = "Option::is_none")] + pub storage_account_sas_secret_name: Option, + #[doc = "The secret name of the service bus connection string."] + #[serde(rename = "serviceBusConnectionStringSecretName", default, skip_serializing_if = "Option::is_none")] + pub service_bus_connection_string_secret_name: Option, + #[doc = "The target location."] + #[serde(rename = "targetLocation", default, skip_serializing_if = "Option::is_none")] + pub target_location: Option, +} +impl VMwareCbtProtectionContainerMappingDetails { + pub fn new(protection_container_mapping_provider_specific_details: ProtectionContainerMappingProviderSpecificDetails) -> Self { + Self { + protection_container_mapping_provider_specific_details, + key_vault_id: None, + key_vault_uri: None, + storage_account_id: None, + storage_account_sas_secret_name: None, + service_bus_connection_string_secret_name: None, + target_location: None, + } + } +} +#[doc = "VMwareCbt specific resync input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtResyncInput { + #[serde(flatten)] + pub resync_provider_specific_input: ResyncProviderSpecificInput, + #[doc = "A value indicating whether CBT is to be reset."] + #[serde(rename = "skipCbtReset")] + pub skip_cbt_reset: String, +} +impl VMwareCbtResyncInput { + pub fn new(resync_provider_specific_input: ResyncProviderSpecificInput, skip_cbt_reset: String) -> Self { + Self { + resync_provider_specific_input, + skip_cbt_reset, + } + } +} +#[doc = "VMwareCbt specific test migrate input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtTestMigrateInput { + #[serde(flatten)] + pub test_migrate_provider_specific_input: TestMigrateProviderSpecificInput, + #[doc = "The recovery point Id."] + #[serde(rename = "recoveryPointId")] + pub recovery_point_id: String, + #[doc = "The test network Id."] + #[serde(rename = "networkId")] + pub network_id: String, + #[doc = "The list of NIC details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, +} +impl VMwareCbtTestMigrateInput { + pub fn new( + test_migrate_provider_specific_input: TestMigrateProviderSpecificInput, + recovery_point_id: String, + network_id: String, + ) -> Self { + Self { + test_migrate_provider_specific_input, + recovery_point_id, + network_id, + vm_nics: Vec::new(), + } + } +} +#[doc = "VMwareCbt disk input for update."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtUpdateDiskInput { + #[doc = "The disk Id."] + #[serde(rename = "diskId")] + pub disk_id: String, + #[doc = "The target disk name."] + #[serde(rename = "targetDiskName", default, skip_serializing_if = "Option::is_none")] + pub target_disk_name: Option, + #[doc = "A value indicating whether the disk is the OS disk."] + #[serde(rename = "isOSDisk", default, skip_serializing_if = "Option::is_none")] + pub is_os_disk: Option, +} +impl VMwareCbtUpdateDiskInput { + pub fn new(disk_id: String) -> Self { + Self { + disk_id, + target_disk_name: None, + is_os_disk: None, + } + } +} +#[doc = "VMwareCbt specific update migration item input."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareCbtUpdateMigrationItemInput { + #[serde(flatten)] + pub update_migration_item_provider_specific_input: UpdateMigrationItemProviderSpecificInput, + #[doc = "The target VM name."] + #[serde(rename = "targetVmName", default, skip_serializing_if = "Option::is_none")] + pub target_vm_name: Option, + #[doc = "The target VM size."] + #[serde(rename = "targetVmSize", default, skip_serializing_if = "Option::is_none")] + pub target_vm_size: Option, + #[doc = "The target resource group ARM Id."] + #[serde(rename = "targetResourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_group_id: Option, + #[doc = "The target availability set ARM Id."] + #[serde(rename = "targetAvailabilitySetId", default, skip_serializing_if = "Option::is_none")] + pub target_availability_set_id: Option, + #[doc = "The target availability zone."] + #[serde(rename = "targetAvailabilityZone", default, skip_serializing_if = "Option::is_none")] + pub target_availability_zone: Option, + #[doc = "The target proximity placement group ARM Id."] + #[serde(rename = "targetProximityPlacementGroupId", default, skip_serializing_if = "Option::is_none")] + pub target_proximity_placement_group_id: Option, + #[doc = "The target boot diagnostics storage account ARM Id."] + #[serde(rename = "targetBootDiagnosticsStorageAccountId", default, skip_serializing_if = "Option::is_none")] + pub target_boot_diagnostics_storage_account_id: Option, + #[doc = "The target network ARM Id."] + #[serde(rename = "targetNetworkId", default, skip_serializing_if = "Option::is_none")] + pub target_network_id: Option, + #[doc = "The test network ARM Id."] + #[serde(rename = "testNetworkId", default, skip_serializing_if = "Option::is_none")] + pub test_network_id: Option, + #[doc = "The list of NIC details."] + #[serde(rename = "vmNics", default, skip_serializing_if = "Vec::is_empty")] + pub vm_nics: Vec, + #[doc = "The list of disk update properties."] + #[serde(rename = "vmDisks", default, skip_serializing_if = "Vec::is_empty")] + pub vm_disks: Vec, + #[doc = "The license type."] + #[serde(rename = "licenseType", default, skip_serializing_if = "Option::is_none")] + pub license_type: Option, + #[doc = "The SQL Server license type."] + #[serde(rename = "sqlServerLicenseType", default, skip_serializing_if = "Option::is_none")] + pub sql_server_license_type: Option, + #[doc = "A value indicating whether auto resync is to be done."] + #[serde(rename = "performAutoResync", default, skip_serializing_if = "Option::is_none")] + pub perform_auto_resync: Option, + #[doc = "The target VM tags."] + #[serde(rename = "targetVmTags", default, skip_serializing_if = "Option::is_none")] + pub target_vm_tags: Option, + #[doc = "The tags for the target disks."] + #[serde(rename = "targetDiskTags", default, skip_serializing_if = "Option::is_none")] + pub target_disk_tags: Option, + #[doc = "The tags for the target NICs."] + #[serde(rename = "targetNicTags", default, skip_serializing_if = "Option::is_none")] + pub target_nic_tags: Option, +} +impl VMwareCbtUpdateMigrationItemInput { + pub fn new(update_migration_item_provider_specific_input: UpdateMigrationItemProviderSpecificInput) -> Self { + Self { + update_migration_item_provider_specific_input, + target_vm_name: None, + target_vm_size: None, + target_resource_group_id: None, + target_availability_set_id: None, + target_availability_zone: None, + target_proximity_placement_group_id: None, + target_boot_diagnostics_storage_account_id: None, + target_network_id: None, + test_network_id: None, + vm_nics: Vec::new(), + vm_disks: Vec::new(), + license_type: None, + sql_server_license_type: None, + perform_auto_resync: None, + target_vm_tags: None, + target_disk_tags: None, + target_nic_tags: None, + } + } +} +pub mod v_mware_cbt_update_migration_item_input { + use super::*; + #[doc = "The license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LicenseType { + NotSpecified, + NoLicenseType, + WindowsServer, + } + #[doc = "The SQL Server license type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum SqlServerLicenseType { + NotSpecified, + NoLicenseType, + #[serde(rename = "PAYG")] + Payg, + #[serde(rename = "AHUB")] + Ahub, + } +} +#[doc = "Store the fabric details specific to the VMware fabric."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[doc = "The list of Process Servers associated with the fabric."] + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, + #[doc = "The list of Master Target servers associated with the fabric."] + #[serde(rename = "masterTargetServers", default, skip_serializing_if = "Vec::is_empty")] + pub master_target_servers: Vec, + #[doc = "The list of run as accounts created on the server."] + #[serde(rename = "runAsAccounts", default, skip_serializing_if = "Vec::is_empty")] + pub run_as_accounts: Vec, + #[doc = "The number of replication pairs configured in this CS."] + #[serde(rename = "replicationPairCount", default, skip_serializing_if = "Option::is_none")] + pub replication_pair_count: Option, + #[doc = "The number of process servers."] + #[serde(rename = "processServerCount", default, skip_serializing_if = "Option::is_none")] + pub process_server_count: Option, + #[doc = "The number of source and target servers configured to talk to this CS."] + #[serde(rename = "agentCount", default, skip_serializing_if = "Option::is_none")] + pub agent_count: Option, + #[doc = "The number of protected servers."] + #[serde(rename = "protectedServers", default, skip_serializing_if = "Option::is_none")] + pub protected_servers: Option, + #[doc = "The percentage of the system load."] + #[serde(rename = "systemLoad", default, skip_serializing_if = "Option::is_none")] + pub system_load: Option, + #[doc = "The system load status."] + #[serde(rename = "systemLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub system_load_status: Option, + #[doc = "The percentage of the CPU load."] + #[serde(rename = "cpuLoad", default, skip_serializing_if = "Option::is_none")] + pub cpu_load: Option, + #[doc = "The CPU load status."] + #[serde(rename = "cpuLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub cpu_load_status: Option, + #[doc = "The total memory."] + #[serde(rename = "totalMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_memory_in_bytes: Option, + #[doc = "The available memory."] + #[serde(rename = "availableMemoryInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_memory_in_bytes: Option, + #[doc = "The memory usage status."] + #[serde(rename = "memoryUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub memory_usage_status: Option, + #[doc = "The total space."] + #[serde(rename = "totalSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub total_space_in_bytes: Option, + #[doc = "The available space."] + #[serde(rename = "availableSpaceInBytes", default, skip_serializing_if = "Option::is_none")] + pub available_space_in_bytes: Option, + #[doc = "The space usage status."] + #[serde(rename = "spaceUsageStatus", default, skip_serializing_if = "Option::is_none")] + pub space_usage_status: Option, + #[doc = "The web load."] + #[serde(rename = "webLoad", default, skip_serializing_if = "Option::is_none")] + pub web_load: Option, + #[doc = "The web load status."] + #[serde(rename = "webLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub web_load_status: Option, + #[doc = "The database server load."] + #[serde(rename = "databaseServerLoad", default, skip_serializing_if = "Option::is_none")] + pub database_server_load: Option, + #[doc = "The database server load status."] + #[serde(rename = "databaseServerLoadStatus", default, skip_serializing_if = "Option::is_none")] + pub database_server_load_status: Option, + #[doc = "The CS service status."] + #[serde(rename = "csServiceStatus", default, skip_serializing_if = "Option::is_none")] + pub cs_service_status: Option, + #[doc = "The IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The agent Version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "The host name."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "The last heartbeat received from CS server."] + #[serde(rename = "lastHeartbeat", default, skip_serializing_if = "Option::is_none")] + pub last_heartbeat: Option, + #[doc = "Version status."] + #[serde(rename = "versionStatus", default, skip_serializing_if = "Option::is_none")] + pub version_status: Option, + #[doc = "CS SSL cert expiry date."] + #[serde(rename = "sslCertExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_date: Option, + #[doc = "CS SSL cert expiry date."] + #[serde(rename = "sslCertExpiryRemainingDays", default, skip_serializing_if = "Option::is_none")] + pub ssl_cert_expiry_remaining_days: Option, + #[doc = "PS template version."] + #[serde(rename = "psTemplateVersion", default, skip_serializing_if = "Option::is_none")] + pub ps_template_version: Option, + #[doc = "Agent expiry date."] + #[serde(rename = "agentExpiryDate", default, skip_serializing_if = "Option::is_none")] + pub agent_expiry_date: Option, + #[doc = "Version related details."] + #[serde(rename = "agentVersionDetails", default, skip_serializing_if = "Option::is_none")] + pub agent_version_details: Option, + #[doc = "The switch provider blocking error information."] + #[serde(rename = "switchProviderBlockingErrorDetails", default, skip_serializing_if = "Vec::is_empty")] + pub switch_provider_blocking_error_details: Vec, +} +impl VMwareDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { + fabric_specific_details, + process_servers: Vec::new(), + master_target_servers: Vec::new(), + run_as_accounts: Vec::new(), + replication_pair_count: None, + process_server_count: None, + agent_count: None, + protected_servers: None, + system_load: None, + system_load_status: None, + cpu_load: None, + cpu_load_status: None, + total_memory_in_bytes: None, + available_memory_in_bytes: None, + memory_usage_status: None, + total_space_in_bytes: None, + available_space_in_bytes: None, + space_usage_status: None, + web_load: None, + web_load_status: None, + database_server_load: None, + database_server_load_status: None, + cs_service_status: None, + ip_address: None, + agent_version: None, + host_name: None, + last_heartbeat: None, + version_status: None, + ssl_cert_expiry_date: None, + ssl_cert_expiry_remaining_days: None, + ps_template_version: None, + agent_expiry_date: None, + agent_version_details: None, + switch_provider_blocking_error_details: Vec::new(), + } + } +} +#[doc = "VMwareV2 fabric provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareV2FabricCreationInput { + #[serde(flatten)] + pub fabric_specific_creation_input: FabricSpecificCreationInput, + #[doc = "The ARM Id of the VMware site."] + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[doc = "The ARM Id of the physical site."] + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[doc = "The ARM Id of the migration solution."] + #[serde(rename = "migrationSolutionId")] + pub migration_solution_id: String, +} +impl VMwareV2FabricCreationInput { + pub fn new(fabric_specific_creation_input: FabricSpecificCreationInput, migration_solution_id: String) -> Self { + Self { + fabric_specific_creation_input, + vmware_site_id: None, + physical_site_id: None, + migration_solution_id, + } + } +} +#[doc = "VMwareV2 fabric specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareV2FabricSpecificDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, + #[doc = "The ARM Id of the VMware site."] + #[serde(rename = "vmwareSiteId", default, skip_serializing_if = "Option::is_none")] + pub vmware_site_id: Option, + #[doc = "The ARM Id of the physical site."] + #[serde(rename = "physicalSiteId", default, skip_serializing_if = "Option::is_none")] + pub physical_site_id: Option, + #[doc = "The Migration solution ARM Id."] + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[doc = "The service endpoint."] + #[serde(rename = "serviceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_endpoint: Option, + #[doc = "The service resource Id."] + #[serde(rename = "serviceResourceId", default, skip_serializing_if = "Option::is_none")] + pub service_resource_id: Option, + #[doc = "The service container Id."] + #[serde(rename = "serviceContainerId", default, skip_serializing_if = "Option::is_none")] + pub service_container_id: Option, + #[doc = "The list of process servers."] + #[serde(rename = "processServers", default, skip_serializing_if = "Vec::is_empty")] + pub process_servers: Vec, +} +impl VMwareV2FabricSpecificDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { + fabric_specific_details, + vmware_site_id: None, + physical_site_id: None, + migration_solution_id: None, + service_endpoint: None, + service_resource_id: None, + service_container_id: None, + process_servers: Vec::new(), + } + } +} +#[doc = "VMware provider specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VMwareVirtualMachineDetails { + #[serde(flatten)] + pub configuration_settings: ConfigurationSettings, + #[doc = "The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection."] + #[serde(rename = "agentGeneratedId", default, skip_serializing_if = "Option::is_none")] + pub agent_generated_id: Option, + #[doc = "The value indicating if InMage scout agent is installed on guest."] + #[serde(rename = "agentInstalled", default, skip_serializing_if = "Option::is_none")] + pub agent_installed: Option, + #[doc = "The OsType installed on VM."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "The agent version."] + #[serde(rename = "agentVersion", default, skip_serializing_if = "Option::is_none")] + pub agent_version: Option, + #[doc = "The IP address."] + #[serde(rename = "ipAddress", default, skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + #[doc = "The value indicating whether VM is powered on."] + #[serde(rename = "poweredOn", default, skip_serializing_if = "Option::is_none")] + pub powered_on: Option, + #[doc = "The VCenter infrastructure Id."] + #[serde(rename = "vCenterInfrastructureId", default, skip_serializing_if = "Option::is_none")] + pub v_center_infrastructure_id: Option, + #[doc = "A value indicating the discovery type of the machine. Value can be vCenter or physical."] + #[serde(rename = "discoveryType", default, skip_serializing_if = "Option::is_none")] + pub discovery_type: Option, + #[doc = "The disk details."] + #[serde(rename = "diskDetails", default, skip_serializing_if = "Vec::is_empty")] + pub disk_details: Vec, + #[doc = "The validation errors."] + #[serde(rename = "validationErrors", default, skip_serializing_if = "Vec::is_empty")] + pub validation_errors: Vec, +} +impl VMwareVirtualMachineDetails { + pub fn new(configuration_settings: ConfigurationSettings) -> Self { + Self { + configuration_settings, + agent_generated_id: None, + agent_installed: None, + os_type: None, + agent_version: None, + ip_address: None, + powered_on: None, + v_center_infrastructure_id: None, + discovery_type: None, + disk_details: Vec::new(), + validation_errors: Vec::new(), + } + } +} +#[doc = "Vault health details definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultHealthDetails { + #[serde(flatten)] + pub resource: Resource, + #[doc = "class to define the health summary of the Vault."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultHealthDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class to define the health summary of the Vault."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultHealthProperties { + #[doc = "The list of errors on the vault."] + #[serde(rename = "vaultErrors", default, skip_serializing_if = "Vec::is_empty")] + pub vault_errors: Vec, + #[doc = "Base class to define the health summary of the resources contained under an Arm resource."] + #[serde(rename = "protectedItemsHealth", default, skip_serializing_if = "Option::is_none")] + pub protected_items_health: Option, + #[doc = "Base class to define the health summary of the resources contained under an Arm resource."] + #[serde(rename = "fabricsHealth", default, skip_serializing_if = "Option::is_none")] + pub fabrics_health: Option, + #[doc = "Base class to define the health summary of the resources contained under an Arm resource."] + #[serde(rename = "containersHealth", default, skip_serializing_if = "Option::is_none")] + pub containers_health: Option, +} +impl VaultHealthProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultSetting { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Vault setting properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl VaultSetting { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault setting collection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultSettingCollection { + #[doc = "The list of vault setting."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The value of next link."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VaultSettingCollection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Input to create vault setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VaultSettingCreationInput { + #[doc = "Input to create vault setting."] + pub properties: VaultSettingCreationInputProperties, +} +impl VaultSettingCreationInput { + pub fn new(properties: VaultSettingCreationInputProperties) -> Self { + Self { properties } + } +} +#[doc = "Input to create vault setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultSettingCreationInputProperties { + #[doc = "The migration solution Id."] + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[doc = "VMware to Azure provider type."] + #[serde(rename = "vmwareToAzureProviderType", default, skip_serializing_if = "Option::is_none")] + pub vmware_to_azure_provider_type: Option, +} +impl VaultSettingCreationInputProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vault setting properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VaultSettingProperties { + #[doc = "The migration solution ARM Id."] + #[serde(rename = "migrationSolutionId", default, skip_serializing_if = "Option::is_none")] + pub migration_solution_id: Option, + #[doc = "VMware to Azure provider type."] + #[serde(rename = "vmwareToAzureProviderType", default, skip_serializing_if = "Option::is_none")] + pub vmware_to_azure_provider_type: Option, +} +impl VaultSettingProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Version related details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VersionDetails { + #[doc = "The agent version."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Version expiry date."] + #[serde(rename = "expiryDate", default, skip_serializing_if = "Option::is_none")] + pub expiry_date: Option, + #[doc = "A value indicating whether security update required."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl VersionDetails { + pub fn new() -> Self { + Self::default() + } +} +pub mod version_details { + use super::*; + #[doc = "A value indicating whether security update required."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Supported, + NotSupported, + Deprecated, + UpdateRequired, + SecurityUpdateRequired, + } +} +#[doc = "This class represents the virtual machine task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineTaskDetails { + #[serde(flatten)] + pub job_task_details: JobTaskDetails, + #[doc = "The skipped reason."] + #[serde(rename = "skippedReason", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason: Option, + #[doc = "The skipped reason string."] + #[serde(rename = "skippedReasonString", default, skip_serializing_if = "Option::is_none")] + pub skipped_reason_string: Option, +} +impl VirtualMachineTaskDetails { + pub fn new(job_task_details: JobTaskDetails) -> Self { + Self { + job_task_details, + skipped_reason: None, + skipped_reason_string: None, + } + } +} +#[doc = "This class represents the vm NicUpdates task details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmNicUpdatesTaskDetails { + #[serde(flatten)] + pub task_type_details: TaskTypeDetails, + #[doc = "Virtual machine Id."] + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[doc = "Nic Id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, + #[doc = "Name of the Nic."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl VmNicUpdatesTaskDetails { + pub fn new(task_type_details: TaskTypeDetails) -> Self { + Self { + task_type_details, + vm_id: None, + nic_id: None, + name: None, + } + } +} +#[doc = "VMM fabric specific details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmDetails { + #[serde(flatten)] + pub fabric_specific_details: FabricSpecificDetails, +} +impl VmmDetails { + pub fn new(fabric_specific_details: FabricSpecificDetails) -> Self { + Self { fabric_specific_details } + } +} +#[doc = "Create network mappings input properties/behavior specific to Vmm to Azure Network mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, +} +impl VmmToAzureCreateNetworkMappingInput { + pub fn new(fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput) -> Self { + Self { + fabric_specific_create_network_mapping_input, + } + } +} +#[doc = "E2A Network Mapping fabric specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, +} +impl VmmToAzureNetworkMappingSettings { + pub fn new(network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings) -> Self { + Self { + network_mapping_fabric_specific_settings, + } + } +} +#[doc = "Update network mappings input properties/behavior specific to vmm to azure."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToAzureUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, +} +impl VmmToAzureUpdateNetworkMappingInput { + pub fn new(fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput) -> Self { + Self { + fabric_specific_update_network_mapping_input, + } + } +} +#[doc = "Create network mappings input properties/behavior specific to vmm to vmm Network mapping."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmCreateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput, +} +impl VmmToVmmCreateNetworkMappingInput { + pub fn new(fabric_specific_create_network_mapping_input: FabricSpecificCreateNetworkMappingInput) -> Self { + Self { + fabric_specific_create_network_mapping_input, + } + } +} +#[doc = "E2E Network Mapping fabric specific settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmNetworkMappingSettings { + #[serde(flatten)] + pub network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings, +} +impl VmmToVmmNetworkMappingSettings { + pub fn new(network_mapping_fabric_specific_settings: NetworkMappingFabricSpecificSettings) -> Self { + Self { + network_mapping_fabric_specific_settings, + } + } +} +#[doc = "Update network mappings input properties/behavior specific to vmm to vmm."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmToVmmUpdateNetworkMappingInput { + #[serde(flatten)] + pub fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput, +} +impl VmmToVmmUpdateNetworkMappingInput { + pub fn new(fabric_specific_update_network_mapping_input: FabricSpecificUpdateNetworkMappingInput) -> Self { + Self { + fabric_specific_update_network_mapping_input, + } + } +} +#[doc = "VMM fabric provider specific VM settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmVirtualMachineDetails { + #[serde(flatten)] + pub hyper_v_virtual_machine_details: HyperVVirtualMachineDetails, +} +impl VmmVirtualMachineDetails { + pub fn new(hyper_v_virtual_machine_details: HyperVVirtualMachineDetails) -> Self { + Self { + hyper_v_virtual_machine_details, + } + } +} +#[doc = "VMware Cbt specific policy details."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmwareCbtPolicyDetails { + #[serde(flatten)] + pub policy_provider_specific_details: PolicyProviderSpecificDetails, + #[doc = "The duration in minutes until which the recovery points need to be stored."] + #[serde(rename = "recoveryPointHistoryInMinutes", default, skip_serializing_if = "Option::is_none")] + pub recovery_point_history_in_minutes: Option, + #[doc = "The app consistent snapshot frequency in minutes."] + #[serde(rename = "appConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub app_consistent_frequency_in_minutes: Option, + #[doc = "The crash consistent snapshot frequency in minutes."] + #[serde(rename = "crashConsistentFrequencyInMinutes", default, skip_serializing_if = "Option::is_none")] + pub crash_consistent_frequency_in_minutes: Option, +} +impl VmwareCbtPolicyDetails { + pub fn new(policy_provider_specific_details: PolicyProviderSpecificDetails) -> Self { + Self { + policy_provider_specific_details, + recovery_point_history_in_minutes: None, + app_consistent_frequency_in_minutes: None, + crash_consistent_frequency_in_minutes: None, + } + } +} diff --git a/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/operations.rs b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/operations.rs new file mode 100644 index 0000000000..3322167a60 --- /dev/null +++ b/services/mgmt/recoveryservicessiterecovery/src/package_2022_02/operations.rs @@ -0,0 +1,13113 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn migration_recovery_points(&self) -> migration_recovery_points::Client { + migration_recovery_points::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn recovery_points(&self) -> recovery_points::Client { + recovery_points::Client(self.clone()) + } + pub fn replication_alert_settings(&self) -> replication_alert_settings::Client { + replication_alert_settings::Client(self.clone()) + } + pub fn replication_appliances(&self) -> replication_appliances::Client { + replication_appliances::Client(self.clone()) + } + pub fn replication_eligibility_results(&self) -> replication_eligibility_results::Client { + replication_eligibility_results::Client(self.clone()) + } + pub fn replication_events(&self) -> replication_events::Client { + replication_events::Client(self.clone()) + } + pub fn replication_fabrics(&self) -> replication_fabrics::Client { + replication_fabrics::Client(self.clone()) + } + pub fn replication_jobs(&self) -> replication_jobs::Client { + replication_jobs::Client(self.clone()) + } + pub fn replication_logical_networks(&self) -> replication_logical_networks::Client { + replication_logical_networks::Client(self.clone()) + } + pub fn replication_migration_items(&self) -> replication_migration_items::Client { + replication_migration_items::Client(self.clone()) + } + pub fn replication_network_mappings(&self) -> replication_network_mappings::Client { + replication_network_mappings::Client(self.clone()) + } + pub fn replication_networks(&self) -> replication_networks::Client { + replication_networks::Client(self.clone()) + } + pub fn replication_policies(&self) -> replication_policies::Client { + replication_policies::Client(self.clone()) + } + pub fn replication_protectable_items(&self) -> replication_protectable_items::Client { + replication_protectable_items::Client(self.clone()) + } + pub fn replication_protected_items(&self) -> replication_protected_items::Client { + replication_protected_items::Client(self.clone()) + } + pub fn replication_protection_container_mappings(&self) -> replication_protection_container_mappings::Client { + replication_protection_container_mappings::Client(self.clone()) + } + pub fn replication_protection_containers(&self) -> replication_protection_containers::Client { + replication_protection_containers::Client(self.clone()) + } + pub fn replication_protection_intents(&self) -> replication_protection_intents::Client { + replication_protection_intents::Client(self.clone()) + } + pub fn replication_recovery_plans(&self) -> replication_recovery_plans::Client { + replication_recovery_plans::Client(self.clone()) + } + pub fn replication_recovery_services_providers(&self) -> replication_recovery_services_providers::Client { + replication_recovery_services_providers::Client(self.clone()) + } + pub fn replication_storage_classification_mappings(&self) -> replication_storage_classification_mappings::Client { + replication_storage_classification_mappings::Client(self.clone()) + } + pub fn replication_storage_classifications(&self) -> replication_storage_classifications::Client { + replication_storage_classifications::Client(self.clone()) + } + pub fn replication_vault_health(&self) -> replication_vault_health::Client { + replication_vault_health::Client(self.clone()) + } + pub fn replication_vault_setting(&self) -> replication_vault_setting::Client { + replication_vault_setting::Client(self.clone()) + } + pub fn replicationv_centers(&self) -> replicationv_centers::Client { + replicationv_centers::Client(self.clone()) + } + pub fn supported_operating_systems(&self) -> supported_operating_systems::Client { + supported_operating_systems::Client(self.clone()) + } + pub fn target_compute_sizes(&self) -> target_compute_sizes::Client { + target_compute_sizes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + ReplicationAlertSettings_List(#[from] replication_alert_settings::list::Error), + #[error(transparent)] + ReplicationAlertSettings_Get(#[from] replication_alert_settings::get::Error), + #[error(transparent)] + ReplicationAlertSettings_Create(#[from] replication_alert_settings::create::Error), + #[error(transparent)] + ReplicationAppliances_List(#[from] replication_appliances::list::Error), + #[error(transparent)] + ReplicationEligibilityResults_List(#[from] replication_eligibility_results::list::Error), + #[error(transparent)] + ReplicationEligibilityResults_Get(#[from] replication_eligibility_results::get::Error), + #[error(transparent)] + ReplicationEvents_List(#[from] replication_events::list::Error), + #[error(transparent)] + ReplicationEvents_Get(#[from] replication_events::get::Error), + #[error(transparent)] + ReplicationFabrics_List(#[from] replication_fabrics::list::Error), + #[error(transparent)] + ReplicationFabrics_Get(#[from] replication_fabrics::get::Error), + #[error(transparent)] + ReplicationFabrics_Create(#[from] replication_fabrics::create::Error), + #[error(transparent)] + ReplicationFabrics_Purge(#[from] replication_fabrics::purge::Error), + #[error(transparent)] + ReplicationFabrics_CheckConsistency(#[from] replication_fabrics::check_consistency::Error), + #[error(transparent)] + ReplicationFabrics_MigrateToAad(#[from] replication_fabrics::migrate_to_aad::Error), + #[error(transparent)] + ReplicationFabrics_ReassociateGateway(#[from] replication_fabrics::reassociate_gateway::Error), + #[error(transparent)] + ReplicationFabrics_Delete(#[from] replication_fabrics::delete::Error), + #[error(transparent)] + ReplicationFabrics_RenewCertificate(#[from] replication_fabrics::renew_certificate::Error), + #[error(transparent)] + ReplicationLogicalNetworks_ListByReplicationFabrics(#[from] replication_logical_networks::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationLogicalNetworks_Get(#[from] replication_logical_networks::get::Error), + #[error(transparent)] + ReplicationNetworks_ListByReplicationFabrics(#[from] replication_networks::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationNetworks_Get(#[from] replication_networks::get::Error), + #[error(transparent)] + ReplicationNetworkMappings_ListByReplicationNetworks(#[from] replication_network_mappings::list_by_replication_networks::Error), + #[error(transparent)] + ReplicationNetworkMappings_Get(#[from] replication_network_mappings::get::Error), + #[error(transparent)] + ReplicationNetworkMappings_Create(#[from] replication_network_mappings::create::Error), + #[error(transparent)] + ReplicationNetworkMappings_Update(#[from] replication_network_mappings::update::Error), + #[error(transparent)] + ReplicationNetworkMappings_Delete(#[from] replication_network_mappings::delete::Error), + #[error(transparent)] + ReplicationProtectionContainers_ListByReplicationFabrics(#[from] replication_protection_containers::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationProtectionContainers_Get(#[from] replication_protection_containers::get::Error), + #[error(transparent)] + ReplicationProtectionContainers_Create(#[from] replication_protection_containers::create::Error), + #[error(transparent)] + ReplicationProtectionContainers_DiscoverProtectableItem(#[from] replication_protection_containers::discover_protectable_item::Error), + #[error(transparent)] + ReplicationProtectionContainers_Delete(#[from] replication_protection_containers::delete::Error), + #[error(transparent)] + ReplicationMigrationItems_ListByReplicationProtectionContainers( + #[from] replication_migration_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationMigrationItems_Get(#[from] replication_migration_items::get::Error), + #[error(transparent)] + ReplicationMigrationItems_Create(#[from] replication_migration_items::create::Error), + #[error(transparent)] + ReplicationMigrationItems_Update(#[from] replication_migration_items::update::Error), + #[error(transparent)] + ReplicationMigrationItems_Delete(#[from] replication_migration_items::delete::Error), + #[error(transparent)] + ReplicationMigrationItems_Migrate(#[from] replication_migration_items::migrate::Error), + #[error(transparent)] + MigrationRecoveryPoints_ListByReplicationMigrationItems(#[from] migration_recovery_points::list_by_replication_migration_items::Error), + #[error(transparent)] + MigrationRecoveryPoints_Get(#[from] migration_recovery_points::get::Error), + #[error(transparent)] + ReplicationMigrationItems_Resync(#[from] replication_migration_items::resync::Error), + #[error(transparent)] + ReplicationMigrationItems_TestMigrate(#[from] replication_migration_items::test_migrate::Error), + #[error(transparent)] + ReplicationMigrationItems_TestMigrateCleanup(#[from] replication_migration_items::test_migrate_cleanup::Error), + #[error(transparent)] + ReplicationProtectableItems_ListByReplicationProtectionContainers( + #[from] replication_protectable_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectableItems_Get(#[from] replication_protectable_items::get::Error), + #[error(transparent)] + ReplicationProtectedItems_ListByReplicationProtectionContainers( + #[from] replication_protected_items::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectedItems_Get(#[from] replication_protected_items::get::Error), + #[error(transparent)] + ReplicationProtectedItems_Create(#[from] replication_protected_items::create::Error), + #[error(transparent)] + ReplicationProtectedItems_Update(#[from] replication_protected_items::update::Error), + #[error(transparent)] + ReplicationProtectedItems_Purge(#[from] replication_protected_items::purge::Error), + #[error(transparent)] + ReplicationProtectedItems_AddDisks(#[from] replication_protected_items::add_disks::Error), + #[error(transparent)] + ReplicationProtectedItems_ApplyRecoveryPoint(#[from] replication_protected_items::apply_recovery_point::Error), + #[error(transparent)] + ReplicationProtectedItems_FailoverCancel(#[from] replication_protected_items::failover_cancel::Error), + #[error(transparent)] + ReplicationProtectedItems_FailoverCommit(#[from] replication_protected_items::failover_commit::Error), + #[error(transparent)] + ReplicationProtectedItems_PlannedFailover(#[from] replication_protected_items::planned_failover::Error), + #[error(transparent)] + RecoveryPoints_ListByReplicationProtectedItems(#[from] recovery_points::list_by_replication_protected_items::Error), + #[error(transparent)] + RecoveryPoints_Get(#[from] recovery_points::get::Error), + #[error(transparent)] + ReplicationProtectedItems_Delete(#[from] replication_protected_items::delete::Error), + #[error(transparent)] + ReplicationProtectedItems_RemoveDisks(#[from] replication_protected_items::remove_disks::Error), + #[error(transparent)] + ReplicationProtectedItems_RepairReplication(#[from] replication_protected_items::repair_replication::Error), + #[error(transparent)] + ReplicationProtectedItems_Reprotect(#[from] replication_protected_items::reprotect::Error), + #[error(transparent)] + ReplicationProtectedItems_ResolveHealthErrors(#[from] replication_protected_items::resolve_health_errors::Error), + #[error(transparent)] + ReplicationProtectedItems_SwitchProvider(#[from] replication_protected_items::switch_provider::Error), + #[error(transparent)] + TargetComputeSizes_ListByReplicationProtectedItems(#[from] target_compute_sizes::list_by_replication_protected_items::Error), + #[error(transparent)] + ReplicationProtectedItems_TestFailover(#[from] replication_protected_items::test_failover::Error), + #[error(transparent)] + ReplicationProtectedItems_TestFailoverCleanup(#[from] replication_protected_items::test_failover_cleanup::Error), + #[error(transparent)] + ReplicationProtectedItems_UnplannedFailover(#[from] replication_protected_items::unplanned_failover::Error), + #[error(transparent)] + ReplicationProtectedItems_UpdateAppliance(#[from] replication_protected_items::update_appliance::Error), + #[error(transparent)] + ReplicationProtectedItems_UpdateMobilityService(#[from] replication_protected_items::update_mobility_service::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers( + #[from] replication_protection_container_mappings::list_by_replication_protection_containers::Error, + ), + #[error(transparent)] + ReplicationProtectionContainerMappings_Get(#[from] replication_protection_container_mappings::get::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Create(#[from] replication_protection_container_mappings::create::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Update(#[from] replication_protection_container_mappings::update::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Purge(#[from] replication_protection_container_mappings::purge::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_Delete(#[from] replication_protection_container_mappings::delete::Error), + #[error(transparent)] + ReplicationProtectionContainers_SwitchProtection(#[from] replication_protection_containers::switch_protection::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_ListByReplicationFabrics( + #[from] replication_recovery_services_providers::list_by_replication_fabrics::Error, + ), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Get(#[from] replication_recovery_services_providers::get::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Create(#[from] replication_recovery_services_providers::create::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Purge(#[from] replication_recovery_services_providers::purge::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_RefreshProvider(#[from] replication_recovery_services_providers::refresh_provider::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_Delete(#[from] replication_recovery_services_providers::delete::Error), + #[error(transparent)] + ReplicationStorageClassifications_ListByReplicationFabrics( + #[from] replication_storage_classifications::list_by_replication_fabrics::Error, + ), + #[error(transparent)] + ReplicationStorageClassifications_Get(#[from] replication_storage_classifications::get::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications( + #[from] replication_storage_classification_mappings::list_by_replication_storage_classifications::Error, + ), + #[error(transparent)] + ReplicationStorageClassificationMappings_Get(#[from] replication_storage_classification_mappings::get::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_Create(#[from] replication_storage_classification_mappings::create::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_Delete(#[from] replication_storage_classification_mappings::delete::Error), + #[error(transparent)] + ReplicationvCenters_ListByReplicationFabrics(#[from] replicationv_centers::list_by_replication_fabrics::Error), + #[error(transparent)] + ReplicationvCenters_Get(#[from] replicationv_centers::get::Error), + #[error(transparent)] + ReplicationvCenters_Create(#[from] replicationv_centers::create::Error), + #[error(transparent)] + ReplicationvCenters_Update(#[from] replicationv_centers::update::Error), + #[error(transparent)] + ReplicationvCenters_Delete(#[from] replicationv_centers::delete::Error), + #[error(transparent)] + ReplicationJobs_List(#[from] replication_jobs::list::Error), + #[error(transparent)] + ReplicationJobs_Get(#[from] replication_jobs::get::Error), + #[error(transparent)] + ReplicationJobs_Cancel(#[from] replication_jobs::cancel::Error), + #[error(transparent)] + ReplicationJobs_Restart(#[from] replication_jobs::restart::Error), + #[error(transparent)] + ReplicationJobs_Resume(#[from] replication_jobs::resume::Error), + #[error(transparent)] + ReplicationJobs_Export(#[from] replication_jobs::export::Error), + #[error(transparent)] + ReplicationMigrationItems_List(#[from] replication_migration_items::list::Error), + #[error(transparent)] + ReplicationNetworkMappings_List(#[from] replication_network_mappings::list::Error), + #[error(transparent)] + ReplicationNetworks_List(#[from] replication_networks::list::Error), + #[error(transparent)] + ReplicationPolicies_List(#[from] replication_policies::list::Error), + #[error(transparent)] + ReplicationPolicies_Get(#[from] replication_policies::get::Error), + #[error(transparent)] + ReplicationPolicies_Create(#[from] replication_policies::create::Error), + #[error(transparent)] + ReplicationPolicies_Update(#[from] replication_policies::update::Error), + #[error(transparent)] + ReplicationPolicies_Delete(#[from] replication_policies::delete::Error), + #[error(transparent)] + ReplicationProtectedItems_List(#[from] replication_protected_items::list::Error), + #[error(transparent)] + ReplicationProtectionContainerMappings_List(#[from] replication_protection_container_mappings::list::Error), + #[error(transparent)] + ReplicationProtectionContainers_List(#[from] replication_protection_containers::list::Error), + #[error(transparent)] + ReplicationProtectionIntents_List(#[from] replication_protection_intents::list::Error), + #[error(transparent)] + ReplicationProtectionIntents_Get(#[from] replication_protection_intents::get::Error), + #[error(transparent)] + ReplicationProtectionIntents_Create(#[from] replication_protection_intents::create::Error), + #[error(transparent)] + ReplicationRecoveryPlans_List(#[from] replication_recovery_plans::list::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Get(#[from] replication_recovery_plans::get::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Create(#[from] replication_recovery_plans::create::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Update(#[from] replication_recovery_plans::update::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Delete(#[from] replication_recovery_plans::delete::Error), + #[error(transparent)] + ReplicationRecoveryPlans_FailoverCancel(#[from] replication_recovery_plans::failover_cancel::Error), + #[error(transparent)] + ReplicationRecoveryPlans_FailoverCommit(#[from] replication_recovery_plans::failover_commit::Error), + #[error(transparent)] + ReplicationRecoveryPlans_PlannedFailover(#[from] replication_recovery_plans::planned_failover::Error), + #[error(transparent)] + ReplicationRecoveryPlans_Reprotect(#[from] replication_recovery_plans::reprotect::Error), + #[error(transparent)] + ReplicationRecoveryPlans_TestFailover(#[from] replication_recovery_plans::test_failover::Error), + #[error(transparent)] + ReplicationRecoveryPlans_TestFailoverCleanup(#[from] replication_recovery_plans::test_failover_cleanup::Error), + #[error(transparent)] + ReplicationRecoveryPlans_UnplannedFailover(#[from] replication_recovery_plans::unplanned_failover::Error), + #[error(transparent)] + ReplicationRecoveryServicesProviders_List(#[from] replication_recovery_services_providers::list::Error), + #[error(transparent)] + ReplicationStorageClassificationMappings_List(#[from] replication_storage_classification_mappings::list::Error), + #[error(transparent)] + ReplicationStorageClassifications_List(#[from] replication_storage_classifications::list::Error), + #[error(transparent)] + SupportedOperatingSystems_Get(#[from] supported_operating_systems::get::Error), + #[error(transparent)] + ReplicationVaultHealth_Get(#[from] replication_vault_health::get::Error), + #[error(transparent)] + ReplicationVaultHealth_Refresh(#[from] replication_vault_health::refresh::Error), + #[error(transparent)] + ReplicationVaultSetting_List(#[from] replication_vault_setting::list::Error), + #[error(transparent)] + ReplicationVaultSetting_Get(#[from] replication_vault_setting::get::Error), + #[error(transparent)] + ReplicationVaultSetting_Create(#[from] replication_vault_setting::create::Error), + #[error(transparent)] + ReplicationvCenters_List(#[from] replicationv_centers::list::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Returns the list of available operations."] + pub fn list(&self, resource_group_name: impl Into, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/operations", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationsDiscoveryCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_alert_settings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of configured email notification(alert) configurations."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets an email notification(alert) configuration."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + alert_setting_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + alert_setting_name: alert_setting_name.into(), + } + } + #[doc = "Configures email notifications for this vault."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + alert_setting_name: impl Into, + request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + alert_setting_name: alert_setting_name.into(), + request: request.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AlertCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) alert_setting_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.alert_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) alert_setting_name: String, + pub(crate) request: models::ConfigureAlertRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAlertSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.alert_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Alert = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_appliances { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of appliances."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationAppliances", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApplianceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_eligibility_results { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the validation errors in case the VM is unsuitable for protection."] + pub fn list( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + #[doc = "Gets the validation errors in case the VM is unsuitable for protection."] + pub fn get( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/providers/Microsoft.RecoveryServices/replicationEligibilityResults" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationEligibilityResultsCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . virtual_machine_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationEligibilityResults = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_events { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of Azure Site Recovery events."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + #[doc = "Get the details of an Azure Site recovery event."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + event_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + event_name: event_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationEvents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EventCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) event_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationEvents/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.event_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Event = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_fabrics { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of ASR fabrics."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the details of an ASR fabric."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + filter: None, + } + } + #[doc = "Creates an Azure Site Recovery fabric."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + input: input.into(), + } + } + #[doc = "Purges the site."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Checks the consistency of the ASR fabric."] + pub fn check_consistency( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> check_consistency::Builder { + check_consistency::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Migrates the site to AAD."] + pub fn migrate_to_aad( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> migrate_to_aad::Builder { + migrate_to_aad::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Perform failover of the process server."] + pub fn reassociate_gateway( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + failover_process_server_request: impl Into, + ) -> reassociate_gateway::Builder { + reassociate_gateway::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + failover_process_server_request: failover_process_server_request.into(), + } + } + #[doc = "Deletes the site."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Renews certificate for the fabric."] + pub fn renew_certificate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + renew_certificate: impl Into, + ) -> renew_certificate::Builder { + renew_certificate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + renew_certificate: renew_certificate.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FabricCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) input: models::FabricCreationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod check_consistency { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/checkConsistency" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate_to_aad { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/migratetoaad" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reassociate_gateway { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) failover_process_server_request: models::FailoverProcessServerRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/reassociateGateway" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_process_server_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/remove", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.fabric_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod renew_certificate { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Fabric), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) renew_certificate: models::RenewCertificateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/renewCertificate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.renew_certificate).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Fabric = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_logical_networks { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of logical networks under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets a logical network with specified server id and logical network name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + logical_network_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + logical_network_name: logical_network_name.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationLogicalNetworks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogicalNetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) logical_network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationLogicalNetworks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . logical_network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LogicalNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_networks { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of networks under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets a network with specified server id and network name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + } + } + #[doc = "Gets the list of networks. View-only API."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Network = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationNetworks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_network_mappings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets all the network mappings under a network."] + pub fn list_by_replication_networks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + ) -> list_by_replication_networks::Builder { + list_by_replication_networks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + } + } + #[doc = "Gets network mapping by name."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + } + } + #[doc = "Creates network mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + input: input.into(), + } + } + #[doc = "Updates network mapping."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + input: input.into(), + } + } + #[doc = "Delete network mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + network_name: impl Into, + network_mapping_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + network_name: network_name.into(), + network_mapping_name: network_mapping_name.into(), + } + } + #[doc = "Gets all the network mappings under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_networks { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + pub(crate) input: models::CreateNetworkMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NetworkMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + pub(crate) input: models::UpdateNetworkMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) network_name: String, + pub(crate) network_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationNetworks/{}/replicationNetworkMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . network_name , & self . network_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationNetworkMappings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_containers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protection container for a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the protection container details."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Create a protection container."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + creation_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + creation_input: creation_input.into(), + } + } + #[doc = "Adds a protectable item to the replication protection container."] + pub fn discover_protectable_item( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + discover_protectable_item_request: impl Into, + ) -> discover_protectable_item::Builder { + discover_protectable_item::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + discover_protectable_item_request: discover_protectable_item_request.into(), + } + } + #[doc = "Removes a protection container."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Switches protection from one container to another or one replication provider to another."] + pub fn switch_protection( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + switch_input: impl Into, + ) -> switch_protection::Builder { + switch_protection::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + switch_input: switch_input.into(), + } + } + #[doc = "Gets the list of all protection containers in a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) creation_input: models::CreateProtectionContainerInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.creation_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod discover_protectable_item { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) discover_protectable_item_request: models::DiscoverProtectableItemRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/discoverProtectableItem" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.discover_protectable_item_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod switch_protection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) switch_input: models::SwitchProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/switchprotection" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.switch_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionContainers" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_migration_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of migration items in the protection container."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + skip_token: None, + take_token: None, + filter: None, + } + } + #[doc = "Gets the details of a migration item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + } + } + #[doc = "Enables migration."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Updates migration item."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Delete the migration item."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + delete_option: None, + } + } + #[doc = "Migrate item."] + pub fn migrate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + migrate_input: impl Into, + ) -> migrate::Builder { + migrate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + migrate_input: migrate_input.into(), + } + } + #[doc = "Resynchronizes replication."] + pub fn resync( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + input: impl Into, + ) -> resync::Builder { + resync::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + input: input.into(), + } + } + #[doc = "Test migrate item."] + pub fn test_migrate( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + test_migrate_input: impl Into, + ) -> test_migrate::Builder { + test_migrate::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + test_migrate_input: test_migrate_input.into(), + } + } + #[doc = "Test migrate cleanup."] + pub fn test_migrate_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + test_migrate_cleanup_input: impl Into, + ) -> test_migrate_cleanup::Builder { + test_migrate_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + test_migrate_cleanup_input: test_migrate_cleanup_input.into(), + } + } + #[doc = "Gets the list of migration items in the vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + take_token: None, + filter: None, + } + } + } + pub mod list_by_replication_protection_containers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::EnableMigrationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::UpdateMigrationItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) delete_option: Option, + } + impl Builder { + pub fn delete_option(mut self, delete_option: impl Into) -> Self { + self.delete_option = Some(delete_option.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(delete_option) = &self.delete_option { + url.query_pairs_mut().append_pair("deleteOption", delete_option); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod migrate { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) migrate_input: models::MigrateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.migrate_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resync { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) input: models::ResyncInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/resync" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_migrate { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) test_migrate_input: models::TestMigrateInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/testMigrate" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.test_migrate_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_migrate_cleanup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::MigrationItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) test_migrate_cleanup_input: models::TestMigrateCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/testMigrateCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.test_migrate_cleanup_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationMigrationItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod migration_recovery_points { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the recovery points for a migration item."] + pub fn list_by_replication_migration_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + ) -> list_by_replication_migration_items::Builder { + list_by_replication_migration_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + } + } + #[doc = "Gets a recovery point for a migration item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + migration_item_name: impl Into, + migration_recovery_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + migration_item_name: migration_item_name.into(), + migration_recovery_point_name: migration_recovery_point_name.into(), + } + } + } + pub mod list_by_replication_migration_items { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrationRecoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationRecoveryPointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) migration_item_name: String, + pub(crate) migration_recovery_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationMigrationItems/{}/migrationRecoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . migration_item_name , & self . migration_recovery_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MigrationRecoveryPoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protectable_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protectable items."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + filter: None, + take: None, + skip_token: None, + } + } + #[doc = "Gets the details of a protectable item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + protectable_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + protectable_item_name: protectable_item_name.into(), + } + } + } + pub mod list_by_replication_protection_containers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) filter: Option, + pub(crate) take: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn take(mut self, take: impl Into) -> Self { + self.take = Some(take.into()); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectableItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(take) = &self.take { + url.query_pairs_mut().append_pair("$take", take); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) protectable_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectableItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . protectable_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectableItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protected_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of Replication protected items."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Gets the details of a Replication protected item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Enables protection."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + input: input.into(), + } + } + #[doc = "Updates the replication protected item settings."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + update_protection_input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + update_protection_input: update_protection_input.into(), + } + } + #[doc = "Purges protection."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Add disk(s) for protection."] + pub fn add_disks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + add_disks_input: impl Into, + ) -> add_disks::Builder { + add_disks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + add_disks_input: add_disks_input.into(), + } + } + #[doc = "Change or apply recovery point."] + pub fn apply_recovery_point( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + apply_recovery_point_input: impl Into, + ) -> apply_recovery_point::Builder { + apply_recovery_point::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + apply_recovery_point_input: apply_recovery_point_input.into(), + } + } + #[doc = "Execute cancel failover."] + pub fn failover_cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> failover_cancel::Builder { + failover_cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute commit failover."] + pub fn failover_commit( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> failover_commit::Builder { + failover_commit::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute planned failover."] + pub fn planned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + failover_input: impl Into, + ) -> planned_failover::Builder { + planned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + failover_input: failover_input.into(), + } + } + #[doc = "Disables protection."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + disable_protection_input: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + disable_protection_input: disable_protection_input.into(), + } + } + #[doc = "Removes disk(s)."] + pub fn remove_disks( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + remove_disks_input: impl Into, + ) -> remove_disks::Builder { + remove_disks::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + remove_disks_input: remove_disks_input.into(), + } + } + #[doc = "Resynchronize or repair replication."] + pub fn repair_replication( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> repair_replication::Builder { + repair_replication::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Execute Reverse Replication\\Reprotect."] + pub fn reprotect( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + reprotect_input: impl Into, + ) -> reprotect::Builder { + reprotect::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + reprotect_input: reprotect_input.into(), + } + } + #[doc = "Resolve health errors."] + pub fn resolve_health_errors( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + resolve_health_input: impl Into, + ) -> resolve_health_errors::Builder { + resolve_health_errors::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + resolve_health_input: resolve_health_input.into(), + } + } + #[doc = "Execute switch provider."] + pub fn switch_provider( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + switch_provider_input: impl Into, + ) -> switch_provider::Builder { + switch_provider::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + switch_provider_input: switch_provider_input.into(), + } + } + #[doc = "Execute test failover."] + pub fn test_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + testfailover_input: impl Into, + ) -> test_failover::Builder { + test_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + testfailover_input: testfailover_input.into(), + } + } + #[doc = "Execute test failover cleanup."] + pub fn test_failover_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + cleanup_input: impl Into, + ) -> test_failover_cleanup::Builder { + test_failover_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + cleanup_input: cleanup_input.into(), + } + } + #[doc = "Execute unplanned failover."] + pub fn unplanned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + failover_input: impl Into, + ) -> unplanned_failover::Builder { + unplanned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + failover_input: failover_input.into(), + } + } + #[doc = "Updates appliance for replication protected Item."] + pub fn update_appliance( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + appliance_update_input: impl Into, + ) -> update_appliance::Builder { + update_appliance::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + appliance_update_input: appliance_update_input.into(), + } + } + #[doc = "Update the mobility service on a protected item."] + pub fn update_mobility_service( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replication_protected_item_name: impl Into, + update_mobility_service_request: impl Into, + ) -> update_mobility_service::Builder { + update_mobility_service::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replication_protected_item_name: replication_protected_item_name.into(), + update_mobility_service_request: update_mobility_service_request.into(), + } + } + #[doc = "Gets the list of replication protected items."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + filter: None, + } + } + } + pub mod list_by_replication_protection_containers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) input: models::EnableProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) update_protection_input: models::UpdateReplicationProtectedItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_protection_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod add_disks { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) add_disks_input: models::AddDisksInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/addDisks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_disks_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod apply_recovery_point { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) apply_recovery_point_input: models::ApplyRecoveryPointInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/applyRecoveryPoint" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.apply_recovery_point_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_cancel { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/failoverCancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_commit { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/failoverCommit" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod planned_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) failover_input: models::PlannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/plannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) disable_protection_input: models::DisableProtectionInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.disable_protection_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod remove_disks { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) remove_disks_input: models::RemoveDisksInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/removeDisks" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.remove_disks_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod repair_replication { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/repairReplication" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reprotect { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) reprotect_input: models::ReverseReplicationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/reProtect" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.reprotect_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resolve_health_errors { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) resolve_health_input: models::ResolveHealthInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/resolveHealthErrors" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resolve_health_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod switch_provider { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) switch_provider_input: models::SwitchProviderInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/switchProvider" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.switch_provider_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) testfailover_input: models::TestFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/testFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.testfailover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover_cleanup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) cleanup_input: models::TestFailoverCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/testFailoverCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.cleanup_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod unplanned_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) failover_input: models::UnplannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/unplannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.failover_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_appliance { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) appliance_update_input: models::UpdateApplianceForReplicationProtectedItemInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/updateAppliance" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.appliance_update_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update_mobility_service { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ReplicationProtectedItem), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replication_protected_item_name: String, + pub(crate) update_mobility_service_request: models::UpdateMobilityServiceRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/updateMobilityService" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replication_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_mobility_service_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) filter: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectedItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectedItemCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod recovery_points { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of recovery points for a replication protected item."] + pub fn list_by_replication_protected_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> list_by_replication_protected_items::Builder { + list_by_replication_protected_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + #[doc = "Gets a recovery point."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + recovery_point_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + recovery_point_name: recovery_point_name.into(), + } + } + } + pub mod list_by_replication_protected_items { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/recoveryPoints" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPointCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + pub(crate) recovery_point_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/recoveryPoints/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name , & self . recovery_point_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPoint = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod target_compute_sizes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of target compute sizes for the replication protected item."] + pub fn list_by_replication_protected_items( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + replicated_protected_item_name: impl Into, + ) -> list_by_replication_protected_items::Builder { + list_by_replication_protected_items::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + replicated_protected_item_name: replicated_protected_item_name.into(), + } + } + } + pub mod list_by_replication_protected_items { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) replicated_protected_item_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectedItems/{}/targetComputeSizes" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . replicated_protected_item_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TargetComputeSizeCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_container_mappings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of protection container mappings for a protection container."] + pub fn list_by_replication_protection_containers( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + ) -> list_by_replication_protection_containers::Builder { + list_by_replication_protection_containers::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + } + } + #[doc = "Gets a protection container mapping."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + } + } + #[doc = "Create protection container mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + creation_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + creation_input: creation_input.into(), + } + } + #[doc = "Update protection container mapping."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + update_input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + update_input: update_input.into(), + } + } + #[doc = "Purge protection container mapping."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + } + } + #[doc = "Remove protection container mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + protection_container_name: impl Into, + mapping_name: impl Into, + removal_input: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + protection_container_name: protection_container_name.into(), + mapping_name: mapping_name.into(), + removal_input: removal_input.into(), + } + } + #[doc = "Gets the list of all protection container mappings in a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_protection_containers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) creation_input: models::CreateProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.creation_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ProtectionContainerMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) update_input: models::UpdateProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) protection_container_name: String, + pub(crate) mapping_name: String, + pub(crate) removal_input: models::RemoveProtectionContainerMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationProtectionContainers/{}/replicationProtectionContainerMappings/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . protection_container_name , & self . mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.removal_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionContainerMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ProtectionContainerMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_recovery_services_providers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of registered recovery services providers for the fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a recovery services provider."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Adds a recovery services provider."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + add_provider_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + add_provider_input: add_provider_input.into(), + } + } + #[doc = "Purges recovery service provider from fabric."] + pub fn purge( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> purge::Builder { + purge::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Refresh details from the recovery services provider."] + pub fn refresh_provider( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> refresh_provider::Builder { + refresh_provider::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is unsupported. To maintain backward compatibility for released clients the object \"deleteRspInput\" is used (if the object is empty we assume that it is old client and continue the old behavior)."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + provider_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + provider_name: provider_name.into(), + } + } + #[doc = "Gets the list of registered recovery services providers in the vault. This is a view only api."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryServicesProvider), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + pub(crate) add_provider_input: models::AddRecoveryServicesProviderInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_provider_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod purge { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod refresh_provider { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryServicesProvider), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}/refreshProvider" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProvider = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) provider_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationRecoveryServicesProviders/{}/remove" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . provider_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryServicesProviders" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryServicesProviderCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_storage_classifications { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of storage classification objects under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a storage classification."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + } + } + #[doc = "Gets the list of storage classification objects under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationStorageClassifications" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_storage_classification_mappings { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of storage classification mappings objects under a storage."] + pub fn list_by_replication_storage_classifications( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + ) -> list_by_replication_storage_classifications::Builder { + list_by_replication_storage_classifications::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + } + } + #[doc = "Gets the details of a storage classification mapping."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + } + } + #[doc = "Create storage classification mapping."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + pairing_input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + pairing_input: pairing_input.into(), + } + } + #[doc = "Delete a storage classification mapping."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + storage_classification_name: impl Into, + storage_classification_mapping_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + storage_classification_name: storage_classification_name.into(), + storage_classification_mapping_name: storage_classification_mapping_name.into(), + } + } + #[doc = "Gets the list of storage classification mappings objects under a vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_storage_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::StorageClassificationMapping), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + pub(crate) pairing_input: models::StorageClassificationMappingInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.pairing_input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMapping = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) storage_classification_name: String, + pub(crate) storage_classification_mapping_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationStorageClassifications/{}/replicationStorageClassificationMappings/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . storage_classification_name , & self . storage_classification_mapping_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationStorageClassificationMappings" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::StorageClassificationMappingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replicationv_centers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of vCenter registered under a fabric."] + pub fn list_by_replication_fabrics( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + ) -> list_by_replication_fabrics::Builder { + list_by_replication_fabrics::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + } + } + #[doc = "Gets the details of a vCenter."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + } + } + #[doc = "Add vCenter."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + add_v_center_request: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + add_v_center_request: add_v_center_request.into(), + } + } + #[doc = "Update vCenter operation."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + update_v_center_request: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + update_v_center_request: update_v_center_request.into(), + } + } + #[doc = "Remove vcenter operation."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + fabric_name: impl Into, + vcenter_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + fabric_name: fabric_name.into(), + vcenter_name: vcenter_name.into(), + } + } + #[doc = "Gets the list of vCenter registered under the vault."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_by_replication_fabrics { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VCenter), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + pub(crate) add_v_center_request: models::AddVCenterRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.add_v_center_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VCenter), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + pub(crate) update_v_center_request: models::UpdateVCenterRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_v_center_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) fabric_name: String, + pub(crate) vcenter_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationFabrics/{}/replicationvCenters/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . fabric_name , & self . vcenter_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationvCenters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VCenterCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of jobs."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + filter: None, + } + } + #[doc = "Gets the job details."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Cancels the specified job."] + pub fn cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> cancel::Builder { + cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Restarts the specified job."] + pub fn restart( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + } + } + #[doc = "Resumes the specified job."] + pub fn resume( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_name: impl Into, + resume_job_params: impl Into, + ) -> resume::Builder { + resume::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_name: job_name.into(), + resume_job_params: resume_job_params.into(), + } + } + #[doc = "Exports the details of the Azure Site Recovery jobs of the vault."] + pub fn export( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + job_query_parameter: impl Into, + ) -> export::Builder { + export::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + job_query_parameter: job_query_parameter.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) filter: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod cancel { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/cancel", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod restart { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod resume { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_name: String, + pub(crate) resume_job_params: models::ResumeJobParams, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/{}/resume", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.job_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.resume_job_params).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod export { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Job), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) job_query_parameter: models::JobQueryParameter, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationJobs/export", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.job_query_parameter).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_policies { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of replication policies."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the requested policy."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + #[doc = "Creates the policy."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + input: input.into(), + } + } + #[doc = "Updates the policy."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + input: input.into(), + } + } + #[doc = "Delete the policy."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + policy_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + policy_name: policy_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PolicyCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Policy), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) input: models::CreatePolicyInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Policy), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + pub(crate) input: models::UpdatePolicyInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Policy = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) policy_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationPolicies/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.policy_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_protection_intents { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of replication protection intent objects."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + skip_token: None, + take_token: None, + } + } + #[doc = "Gets the details of a Replication protection intent item."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + intent_object_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + intent_object_name: intent_object_name.into(), + } + } + #[doc = "Create protection intent Resource."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + intent_object_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + intent_object_name: intent_object_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) take_token: Option, + } + impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn take_token(mut self, take_token: impl Into) -> Self { + self.take_token = Some(take_token.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> + { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("skipToken", skip_token); + } + if let Some(take_token) = &self.take_token { + url.query_pairs_mut().append_pair("takeToken", take_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntentCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) intent_object_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) intent_object_name: String, + pub(crate) input: models::CreateProtectionIntentInput, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationProtectionIntents/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . intent_object_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationProtectionIntent = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_recovery_plans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of recovery plans."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the requested recovery plan."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Creates a recovery plan with the given details."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Updates the given recovery plan."] + pub fn update( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Deletes the specified recovery plan."] + pub fn delete( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute cancel failover of the recovery plan."] + pub fn failover_cancel( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> failover_cancel::Builder { + failover_cancel::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute commit failover of the recovery plan."] + pub fn failover_commit( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> failover_commit::Builder { + failover_commit::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute planned failover of the recovery plan."] + pub fn planned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> planned_failover::Builder { + planned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute reprotect of the recovery plan."] + pub fn reprotect( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + ) -> reprotect::Builder { + reprotect::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + } + } + #[doc = "Execute test failover of the recovery plan."] + pub fn test_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> test_failover::Builder { + test_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute test failover cleanup of the recovery plan."] + pub fn test_failover_cleanup( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> test_failover_cleanup::Builder { + test_failover_cleanup::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + #[doc = "Execute unplanned failover of the recovery plan."] + pub fn unplanned_failover( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + recovery_plan_name: impl Into, + input: impl Into, + ) -> unplanned_failover::Builder { + unplanned_failover::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + recovery_plan_name: recovery_plan_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlanCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::CreateRecoveryPlanInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::UpdateRecoveryPlanInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.recovery_plan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_cancel { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/failoverCancel" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod failover_commit { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/failoverCommit" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod planned_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanPlannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/plannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod reprotect { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/reProtect" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanTestFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/testFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod test_failover_cleanup { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanTestFailoverCleanupInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/testFailoverCleanup" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod unplanned_failover { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RecoveryPlan), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) recovery_plan_name: String, + pub(crate) input: models::RecoveryPlanUnplannedFailoverInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationRecoveryPlans/{}/unplannedFailover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name , & self . recovery_plan_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RecoveryPlan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod supported_operating_systems { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the data of supported operating systems by SRS."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + instance_type: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) instance_type: Option, + } + impl Builder { + pub fn instance_type(mut self, instance_type: impl Into) -> Self { + self.instance_type = Some(instance_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationSupportedOperatingSystems" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(instance_type) = &self.instance_type { + url.query_pairs_mut().append_pair("instanceType", instance_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SupportedOperatingSystems = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_vault_health { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the health summary for the vault."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Refreshes health summary of the vault."] + pub fn refresh( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> refresh::Builder { + refresh::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultHealth", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultHealthDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod refresh { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VaultHealthDetails), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultHealth/default/refresh" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultHealthDetails = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod replication_vault_setting { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the list of vault setting."] + pub fn list( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Gets the vault setting."] + pub fn get( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_setting_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_setting_name: vault_setting_name.into(), + } + } + #[doc = "Updates vault setting. A vault setting object is a singleton per vault and it is always present by default."] + pub fn create( + &self, + resource_name: impl Into, + resource_group_name: impl Into, + subscription_id: impl Into, + vault_setting_name: impl Into, + input: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + resource_name: resource_name.into(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vault_setting_name: vault_setting_name.into(), + input: input.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSettingCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_setting_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.vault_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSetting = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_name: String, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vault_setting_name: String, + pub(crate) input: models::VaultSettingCreationInput, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RecoveryServices/vaults/{}/replicationVaultSettings/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name, + &self.vault_setting_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.input).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VaultSetting = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/redhatopenshift/Cargo.toml b/services/mgmt/redhatopenshift/Cargo.toml index 27df07214d..d4c8ad7d59 100644 --- a/services/mgmt/redhatopenshift/Cargo.toml +++ b/services/mgmt/redhatopenshift/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_redhatopenshift" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,12 +24,13 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-09-01-preview"] +features = ["no-default-tag", "package-2020-04-30", "package-2021-09-01-preview"] [features] -default = ["package-2020-04-30", "enable_reqwest"] +default = ["package-2022-04-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-2020-04-30" = [] "package-2021-09-01-preview" = [] +"package-2022-04-01" = [] diff --git a/services/mgmt/redhatopenshift/README.md b/services/mgmt/redhatopenshift/README.md index 6aa5dc21f1..415df3e70c 100644 --- a/services/mgmt/redhatopenshift/README.md +++ b/services/mgmt/redhatopenshift/README.md @@ -6,9 +6,10 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/redhatopen To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2020-04-30`. +The default tag is `package-2022-04-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: - `package-2020-04-30` has 8 operations from 1 API versions: `2020-04-30`. Use crate feature `package-2020-04-30` to enable. The operations will be in the `package_2020_04_30` module. -- `package-2021-09-01-preview` has 9 operations from 1 API versions: `2021-09-01-preview`. Use crate feature `package-2021-09-01-preview` to enable. The operations will be in the `package_2021_09_01_preview` module. \ No newline at end of file +- `package-2021-09-01-preview` has 9 operations from 1 API versions: `2021-09-01-preview`. Use crate feature `package-2021-09-01-preview` to enable. The operations will be in the `package_2021_09_01_preview` module. +- `package-2022-04-01` has 9 operations from 1 API versions: `2022-04-01`. Use crate feature `package-2022-04-01` to enable. The operations will be in the `package_2022_04_01` module. \ No newline at end of file diff --git a/services/mgmt/redhatopenshift/src/lib.rs b/services/mgmt/redhatopenshift/src/lib.rs index 09b706904b..e8a5a87b23 100644 --- a/services/mgmt/redhatopenshift/src/lib.rs +++ b/services/mgmt/redhatopenshift/src/lib.rs @@ -11,3 +11,7 @@ pub use package_2020_04_30::{models, operations, operations::Client, operations: pub mod package_2021_09_01_preview; #[cfg(all(feature = "package-2021-09-01-preview", not(feature = "no-default-tag")))] pub use package_2021_09_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-04-01")] +pub mod package_2022_04_01; +#[cfg(all(feature = "package-2022-04-01", not(feature = "no-default-tag")))] +pub use package_2022_04_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/redhatopenshift/src/package_2022_04_01/mod.rs b/services/mgmt/redhatopenshift/src/package_2022_04_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/redhatopenshift/src/package_2022_04_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/redhatopenshift/src/package_2022_04_01/models.rs b/services/mgmt/redhatopenshift/src/package_2022_04_01/models.rs new file mode 100644 index 0000000000..5d43289c29 --- /dev/null +++ b/services/mgmt/redhatopenshift/src/package_2022_04_01/models.rs @@ -0,0 +1,482 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "APIServerProfile represents an API server profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ApiServerProfile { + #[doc = "Visibility represents visibility."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[doc = "The URL to access the cluster API server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[doc = "The IP of the cluster API server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ip: Option, +} +impl ApiServerProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "CloudError represents a cloud error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudError { + #[doc = "CloudErrorBody represents the body of a cloud error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl CloudError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "CloudErrorBody represents the body of a cloud error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudErrorBody { + #[doc = "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "A message describing the error, intended to be suitable for display in a user interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The target of the particular error. For example, the name of the property in error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "A list of additional details about the error."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ClusterProfile represents a cluster profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClusterProfile { + #[doc = "The pull secret for the cluster."] + #[serde(rename = "pullSecret", default, skip_serializing_if = "Option::is_none")] + pub pull_secret: Option, + #[doc = "The domain for the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub domain: Option, + #[doc = "The version of the cluster."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The ID of the cluster resource group."] + #[serde(rename = "resourceGroupId", default, skip_serializing_if = "Option::is_none")] + pub resource_group_id: Option, + #[doc = "FipsValidatedModules determines if FIPS is used."] + #[serde(rename = "fipsValidatedModules", default, skip_serializing_if = "Option::is_none")] + pub fips_validated_modules: Option, +} +impl ClusterProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ConsoleProfile represents a console profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConsoleProfile { + #[doc = "The URL to access the cluster console."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, +} +impl ConsoleProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Display represents the display details of an operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Display { + #[doc = "Friendly name of the resource provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource type on which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Operation type: read, write, delete, listKeys/action, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Friendly name of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl Display { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "EncryptionAtHost represents encryption at host state"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EncryptionAtHost { + Disabled, + Enabled, +} +#[doc = "FipsValidatedModules determines if FIPS is used."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum FipsValidatedModules { + Disabled, + Enabled, +} +#[doc = "IngressProfile represents an ingress profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IngressProfile { + #[doc = "The ingress profile name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Visibility represents visibility."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[doc = "The IP of the ingress."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ip: Option, +} +impl IngressProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "MasterProfile represents a master profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MasterProfile { + #[doc = "VM size availability varies by region.\nIf a node contains insufficient compute resources (memory, cpu, etc.), pods might fail to run correctly.\nFor more details on restricted VM sizes, see: https://docs.microsoft.com/en-us/azure/openshift/support-policies-v4#supported-virtual-machine-sizes"] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "The Azure resource ID of the master subnet."] + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[doc = "EncryptionAtHost represents encryption at host state"] + #[serde(rename = "encryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub encryption_at_host: Option, + #[doc = "The resource ID of an associated DiskEncryptionSet, if applicable."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl MasterProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "NetworkProfile represents a network profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfile { + #[doc = "The CIDR used for OpenShift/Kubernetes Pods."] + #[serde(rename = "podCidr", default, skip_serializing_if = "Option::is_none")] + pub pod_cidr: Option, + #[doc = "The CIDR used for OpenShift/Kubernetes Services."] + #[serde(rename = "serviceCidr", default, skip_serializing_if = "Option::is_none")] + pub service_cidr: Option, +} +impl NetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenShiftCluster represents an Azure Red Hat OpenShift cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OpenShiftCluster { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "OpenShiftClusterProperties represents an OpenShift cluster's properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl OpenShiftCluster { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + system_data: None, + } + } +} +#[doc = "OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenShiftClusterAdminKubeconfig { + #[doc = "The base64-encoded kubeconfig file."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kubeconfig: Option, +} +impl OpenShiftClusterAdminKubeconfig { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenShiftClusterCredentials represents an OpenShift cluster's credentials."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenShiftClusterCredentials { + #[doc = "The username for the kubeadmin user."] + #[serde(rename = "kubeadminUsername", default, skip_serializing_if = "Option::is_none")] + pub kubeadmin_username: Option, + #[doc = "The password for the kubeadmin user."] + #[serde(rename = "kubeadminPassword", default, skip_serializing_if = "Option::is_none")] + pub kubeadmin_password: Option, +} +impl OpenShiftClusterCredentials { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenShiftClusterList represents a list of OpenShift clusters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenShiftClusterList { + #[doc = "The list of OpenShift clusters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link used to get the next page of operations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OpenShiftClusterList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenShiftClusterProperties represents an OpenShift cluster's properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenShiftClusterProperties { + #[doc = "ProvisioningState represents a provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "ClusterProfile represents a cluster profile."] + #[serde(rename = "clusterProfile", default, skip_serializing_if = "Option::is_none")] + pub cluster_profile: Option, + #[doc = "ConsoleProfile represents a console profile."] + #[serde(rename = "consoleProfile", default, skip_serializing_if = "Option::is_none")] + pub console_profile: Option, + #[doc = "ServicePrincipalProfile represents a service principal profile."] + #[serde(rename = "servicePrincipalProfile", default, skip_serializing_if = "Option::is_none")] + pub service_principal_profile: Option, + #[doc = "NetworkProfile represents a network profile."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[doc = "MasterProfile represents a master profile."] + #[serde(rename = "masterProfile", default, skip_serializing_if = "Option::is_none")] + pub master_profile: Option, + #[doc = "The cluster worker profiles."] + #[serde(rename = "workerProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub worker_profiles: Vec, + #[doc = "APIServerProfile represents an API server profile."] + #[serde(rename = "apiserverProfile", default, skip_serializing_if = "Option::is_none")] + pub apiserver_profile: Option, + #[doc = "The cluster ingress profiles."] + #[serde(rename = "ingressProfiles", default, skip_serializing_if = "Vec::is_empty")] + pub ingress_profiles: Vec, +} +impl OpenShiftClusterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OpenShiftCluster represents an Azure Red Hat OpenShift cluster."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OpenShiftClusterUpdate { + #[doc = "Tags represents an OpenShift cluster's tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "OpenShiftClusterProperties represents an OpenShift cluster's properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl OpenShiftClusterUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation represents an RP operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation name: {provider}/{resource}/{operation}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display represents the display details of an operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Sources of requests to this operation. Comma separated list with valid values user or system, e.g. \"user,system\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "OperationList represents an RP operation list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationList { + #[doc = "List of operations supported by the resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link used to get the next page of operations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ProvisioningState represents a provisioning state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ProvisioningState { + AdminUpdating, + Creating, + Deleting, + Failed, + Succeeded, + Updating, +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ServicePrincipalProfile represents a service principal profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicePrincipalProfile { + #[doc = "The client ID used for the cluster."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The client secret used for the cluster."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl ServicePrincipalProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Tags represents an OpenShift cluster's tags."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Tags {} +impl Tags { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +pub type VmSize = String; +#[doc = "Visibility represents visibility."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Visibility { + Private, + Public, +} +#[doc = "WorkerProfile represents a worker profile."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkerProfile { + #[doc = "The worker profile name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "VM size availability varies by region.\nIf a node contains insufficient compute resources (memory, cpu, etc.), pods might fail to run correctly.\nFor more details on restricted VM sizes, see: https://docs.microsoft.com/en-us/azure/openshift/support-policies-v4#supported-virtual-machine-sizes"] + #[serde(rename = "vmSize", default, skip_serializing_if = "Option::is_none")] + pub vm_size: Option, + #[doc = "The disk size of the worker VMs."] + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[doc = "The Azure resource ID of the worker subnet."] + #[serde(rename = "subnetId", default, skip_serializing_if = "Option::is_none")] + pub subnet_id: Option, + #[doc = "The number of worker VMs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "EncryptionAtHost represents encryption at host state"] + #[serde(rename = "encryptionAtHost", default, skip_serializing_if = "Option::is_none")] + pub encryption_at_host: Option, + #[doc = "The resource ID of an associated DiskEncryptionSet, if applicable."] + #[serde(rename = "diskEncryptionSetId", default, skip_serializing_if = "Option::is_none")] + pub disk_encryption_set_id: Option, +} +impl WorkerProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/redhatopenshift/src/package_2022_04_01/operations.rs b/services/mgmt/redhatopenshift/src/package_2022_04_01/operations.rs new file mode 100644 index 0000000000..3f18a91c7a --- /dev/null +++ b/services/mgmt/redhatopenshift/src/package_2022_04_01/operations.rs @@ -0,0 +1,934 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn open_shift_clusters(&self) -> open_shift_clusters::Client { + open_shift_clusters::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + OpenShiftClusters_List(#[from] open_shift_clusters::list::Error), + #[error(transparent)] + OpenShiftClusters_ListByResourceGroup(#[from] open_shift_clusters::list_by_resource_group::Error), + #[error(transparent)] + OpenShiftClusters_Get(#[from] open_shift_clusters::get::Error), + #[error(transparent)] + OpenShiftClusters_CreateOrUpdate(#[from] open_shift_clusters::create_or_update::Error), + #[error(transparent)] + OpenShiftClusters_Update(#[from] open_shift_clusters::update::Error), + #[error(transparent)] + OpenShiftClusters_Delete(#[from] open_shift_clusters::delete::Error), + #[error(transparent)] + OpenShiftClusters_ListAdminCredentials(#[from] open_shift_clusters::list_admin_credentials::Error), + #[error(transparent)] + OpenShiftClusters_ListCredentials(#[from] open_shift_clusters::list_credentials::Error), +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists all of the available RP operations."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.RedHatOpenShift/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod open_shift_clusters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Lists OpenShift clusters in the specified subscription."] + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + #[doc = "Lists OpenShift clusters in the specified subscription and resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Gets a OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + parameters: parameters.into(), + } + } + #[doc = "Deletes a OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn list_admin_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_admin_credentials::Builder { + list_admin_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + #[doc = "Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name."] + pub fn list_credentials( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_name: impl Into, + ) -> list_credentials::Builder { + list_credentials::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_name: resource_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftClusterList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftClusterList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OpenShiftCluster), + Created201(models::OpenShiftCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::OpenShiftCluster, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::OpenShiftCluster), + Created201(models::OpenShiftCluster), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + pub(crate) parameters: models::OpenShiftClusterUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftCluster = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_admin_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}/listAdminCredentials" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . resource_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftClusterAdminKubeconfig = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{}/listCredentials", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OpenShiftClusterCredentials = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/redis/Cargo.toml b/services/mgmt/redis/Cargo.toml index d640d0a8a5..1851aab254 100644 --- a/services/mgmt/redis/Cargo.toml +++ b/services/mgmt/redis/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_redis" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/redisenterprise/Cargo.toml b/services/mgmt/redisenterprise/Cargo.toml index 113744b633..23b511320a 100644 --- a/services/mgmt/redisenterprise/Cargo.toml +++ b/services/mgmt/redisenterprise/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_redisenterprise" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/relay/Cargo.toml b/services/mgmt/relay/Cargo.toml index d75952900e..2dcb27b2f1 100644 --- a/services/mgmt/relay/Cargo.toml +++ b/services/mgmt/relay/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_relay" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2016-07", "package-2018-01-preview"] +features = ["no-default-tag", "package-2017-04", "package-2016-07", "package-2018-01-preview"] [features] -default = ["package-2017-04", "enable_reqwest"] +default = ["package-2021-11-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-2021-11-01" = [] "package-2017-04" = [] "package-2016-07" = [] "package-2018-01-preview" = [] diff --git a/services/mgmt/relay/README.md b/services/mgmt/relay/README.md index d480eebbfd..739c146ea8 100644 --- a/services/mgmt/relay/README.md +++ b/services/mgmt/relay/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/relay/reso To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2017-04`. +The default tag is `package-2021-11-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-2021-11-01` has 42 operations from 1 API versions: `2021-11-01`. Use crate feature `package-2021-11-01` to enable. The operations will be in the `package_2021_11_01` module. - `package-2017-04` has 34 operations from 1 API versions: `2017-04-01`. Use crate feature `package-2017-04` to enable. The operations will be in the `package_2017_04` module. - `package-2016-07` has 40 operations from 1 API versions: `2016-07-01`. Use crate feature `package-2016-07` to enable. The operations will be in the `package_2016_07` module. - `package-2018-01-preview` has 16 operations from 1 API versions: `2018-01-01-preview`. Use crate feature `package-2018-01-preview` to enable. The operations will be in the `package_2018_01_preview` module. \ No newline at end of file diff --git a/services/mgmt/relay/src/lib.rs b/services/mgmt/relay/src/lib.rs index 9c88186e1e..d0597527e7 100644 --- a/services/mgmt/relay/src/lib.rs +++ b/services/mgmt/relay/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-2021-11-01")] +pub mod package_2021_11_01; +#[cfg(all(feature = "package-2021-11-01", not(feature = "no-default-tag")))] +pub use package_2021_11_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2017-04")] pub mod package_2017_04; #[cfg(all(feature = "package-2017-04", not(feature = "no-default-tag")))] diff --git a/services/mgmt/relay/src/package_2021_11_01/mod.rs b/services/mgmt/relay/src/package_2021_11_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/relay/src/package_2021_11_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/relay/src/package_2021_11_01/models.rs b/services/mgmt/relay/src/package_2021_11_01/models.rs new file mode 100644 index 0000000000..51a3ad17ca --- /dev/null +++ b/services/mgmt/relay/src/package_2021_11_01/models.rs @@ -0,0 +1,857 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Namespace/Relay Connection String"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccessKeys { + #[doc = "Primary connection string of the created namespace authorization rule."] + #[serde(rename = "primaryConnectionString", default, skip_serializing_if = "Option::is_none")] + pub primary_connection_string: Option, + #[doc = "Secondary connection string of the created namespace authorization rule."] + #[serde(rename = "secondaryConnectionString", default, skip_serializing_if = "Option::is_none")] + pub secondary_connection_string: Option, + #[doc = "A base64-encoded 256-bit primary key for signing and validating the SAS token."] + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[doc = "A base64-encoded 256-bit secondary key for signing and validating the SAS token."] + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, + #[doc = "A string that describes the authorization rule."] + #[serde(rename = "keyName", default, skip_serializing_if = "Option::is_none")] + pub key_name: Option, +} +impl AccessKeys { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Single item in a List or Get AuthorizationRule operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationRule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties supplied to create or update AuthorizationRule"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl AuthorizationRule { + pub fn new() -> Self { + Self::default() + } +} +pub mod authorization_rule { + use super::*; + #[doc = "Properties supplied to create or update AuthorizationRule"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Properties { + #[doc = "The rights associated with the rule."] + pub rights: Vec, + } + impl Properties { + pub fn new(rights: Vec) -> Self { + Self { rights } + } + } +} +#[doc = "The response from the list namespace operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AuthorizationRuleListResult { + #[doc = "Result of the list authorization rules operation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if value contains incomplete list of authorization rules."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AuthorizationRuleListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of the check name availability request properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CheckNameAvailability { + #[doc = "The namespace name to check for availability. The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number."] + pub name: String, +} +impl CheckNameAvailability { + pub fn new(name: String) -> Self { + Self { name } + } +} +#[doc = "Description of the check name availability request properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CheckNameAvailabilityResult { + #[doc = "The detailed info regarding the reason associated with the namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Value indicating namespace is available. Returns true if the namespace is available; otherwise, false."] + #[serde(rename = "nameAvailable", default, skip_serializing_if = "Option::is_none")] + pub name_available: Option, + #[doc = "Specifies the reason for the unavailability of the service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, +} +impl CheckNameAvailabilityResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ConnectionState information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectionState { + #[doc = "Status of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Description of the connection state."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ConnectionState { + pub fn new() -> Self { + Self::default() + } +} +pub mod connection_state { + use super::*; + #[doc = "Status of the connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Pending, + Approved, + Rejected, + Disconnected, + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Description of hybrid connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HybridConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of the HybridConnection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl HybridConnection { + pub fn new() -> Self { + Self::default() + } +} +pub mod hybrid_connection { + use super::*; + #[doc = "Properties of the HybridConnection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "The time the hybrid connection was created."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The time the namespace was updated."] + #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[doc = "The number of listeners for this hybrid connection. Note that min : 1 and max:25 are supported."] + #[serde(rename = "listenerCount", default, skip_serializing_if = "Option::is_none")] + pub listener_count: Option, + #[doc = "Returns true if client authorization is needed for this hybrid connection; otherwise, false."] + #[serde(rename = "requiresClientAuthorization", default, skip_serializing_if = "Option::is_none")] + pub requires_client_authorization: Option, + #[doc = "The usermetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored."] + #[serde(rename = "userMetadata", default, skip_serializing_if = "Option::is_none")] + pub user_metadata: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The response of the list hybrid connection operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HybridConnectionListResult { + #[doc = "Result of the list hybrid connections."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if value contains incomplete list hybrid connection operation."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl HybridConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The response from the List namespace operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NwRuleSetIpRules { + #[doc = "IP Mask"] + #[serde(rename = "ipMask", default, skip_serializing_if = "Option::is_none")] + pub ip_mask: Option, + #[doc = "The IP Filter Action"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub action: Option, +} +impl NwRuleSetIpRules { + pub fn new() -> Self { + Self::default() + } +} +pub mod nw_rule_set_ip_rules { + use super::*; + #[doc = "The IP Filter Action"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Action { + Allow, + } +} +#[doc = "Description of topic resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkRuleSet { + #[serde(flatten)] + pub resource: Resource, + #[doc = "NetworkRuleSet properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl NetworkRuleSet { + pub fn new() -> Self { + Self::default() + } +} +pub mod network_rule_set { + use super::*; + #[doc = "NetworkRuleSet properties"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Default Action for Network Rule Set"] + #[serde(rename = "defaultAction", default, skip_serializing_if = "Option::is_none")] + pub default_action: Option, + #[doc = "List of IpRules"] + #[serde(rename = "ipRules", default, skip_serializing_if = "Vec::is_empty")] + pub ip_rules: Vec, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "Default Action for Network Rule Set"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultAction { + Allow, + Deny, + } + } +} +#[doc = "A Relay REST API operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "Operation name: {provider}/{resource}/{operation}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Indicates whether the operation is a data action"] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Operation display payload"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "Origin of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Properties of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Operation display payload"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationDisplay { + #[doc = "Resource provider of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource of the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Localized friendly name for the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Localized friendly description for the operation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl OperationDisplay { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the request to list Relay operations. It contains a list of operations and a URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of Relay operations supported by the Microsoft.EventHub resource provider."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results if there are any."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "PrivateEndpoint information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "The ARM identifier for Private Endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the PrivateEndpointConnection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of the private endpoint connection resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the list of all private endpoint connections operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionListResult { + #[doc = "A collection of private endpoint connection resources."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "A link for the next page of private endpoint connection resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateEndpointConnectionListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the private endpoint connection resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "PrivateEndpoint information."] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "ConnectionState information."] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "Provisioning state of the Private Endpoint Connection."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod private_endpoint_connection_properties { + use super::*; + #[doc = "Provisioning state of the Private Endpoint Connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ProvisioningState { + Creating, + Updating, + Deleting, + Succeeded, + Canceled, + Failed, + } +} +#[doc = "Information of the private link resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResource { + #[doc = "Properties of PrivateLinkResource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Fully qualified identifier of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the resource"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl PrivateLinkResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of PrivateLinkResource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourceProperties { + #[doc = "The private link resource group id."] + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[doc = "The private link resource required member names."] + #[serde(rename = "requiredMembers", default, skip_serializing_if = "Vec::is_empty")] + pub required_members: Vec, + #[doc = "The private link resource Private link DNS zone name."] + #[serde(rename = "requiredZoneNames", default, skip_serializing_if = "Vec::is_empty")] + pub required_zone_names: Vec, +} +impl PrivateLinkResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Result of the List private link resources operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkResourcesListResult { + #[doc = "A collection of private link resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "A link for the next page of private link resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PrivateLinkResourcesListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.EventHub/Namespaces\" or \"Microsoft.EventHub/Namespaces/EventHubs\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The geo-location where the resource lives"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters supplied to the regenerate authorization rule operation, specifies which key needs to be reset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegenerateAccessKeyParameters { + #[doc = "The access key to regenerate."] + #[serde(rename = "keyType")] + pub key_type: regenerate_access_key_parameters::KeyType, + #[doc = "Optional. If the key value is provided, this is set to key type, or autogenerated key value set for key type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, +} +impl RegenerateAccessKeyParameters { + pub fn new(key_type: regenerate_access_key_parameters::KeyType) -> Self { + Self { key_type, key: None } + } +} +pub mod regenerate_access_key_parameters { + use super::*; + #[doc = "The access key to regenerate."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyType { + PrimaryKey, + SecondaryKey, + } +} +#[doc = "Description of a namespace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelayNamespace { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "SKU of the namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Properties of the namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RelayNamespace { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + sku: None, + system_data: None, + properties: None, + } + } +} +#[doc = "The response from the list namespace operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RelayNamespaceListResult { + #[doc = "Result of the list namespace operation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if value contains incomplete list of namespaces."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RelayNamespaceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of the namespace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RelayNamespaceProperties { + #[doc = "Provisioning state of the Namespace."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Status of the Namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The time the namespace was created."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The time the namespace was updated."] + #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[doc = "Endpoint you can use to perform Service Bus operations."] + #[serde(rename = "serviceBusEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_bus_endpoint: Option, + #[doc = "Identifier for Azure Insights metrics."] + #[serde(rename = "metricId", default, skip_serializing_if = "Option::is_none")] + pub metric_id: Option, + #[doc = "List of private endpoint connections."] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "This determines if traffic is allowed over public network. By default it is enabled."] + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, +} +impl RelayNamespaceProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod relay_namespace_properties { + use super::*; + #[doc = "This determines if traffic is allowed over public network. By default it is enabled."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PublicNetworkAccess { + Enabled, + Disabled, + SecuredByPerimeter, + } + impl Default for PublicNetworkAccess { + fn default() -> Self { + Self::Enabled + } + } +} +#[doc = "Description of a namespace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RelayUpdateParameters { + #[serde(flatten)] + pub resource_namespace_patch: ResourceNamespacePatch, + #[doc = "SKU of the namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Properties of the namespace."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RelayUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Resource ID."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Definition of resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNamespacePatch { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ResourceNamespacePatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SKU of the namespace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Sku { + #[doc = "Name of this SKU."] + pub name: sku::Name, + #[doc = "The tier of this SKU."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, +} +impl Sku { + pub fn new(name: sku::Name) -> Self { + Self { name, tier: None } + } +} +pub mod sku { + use super::*; + #[doc = "Name of this SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Name { + Standard, + } + #[doc = "The tier of this SKU."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Tier { + Standard, + } +} +#[doc = "Definition of resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource location."] + pub location: String, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + location, + tags: None, + } + } +} +#[doc = "Specifies the reason for the unavailability of the service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum UnavailableReason { + None, + InvalidName, + SubscriptionIsDisabled, + NameInUse, + NameInLockdown, + TooManyNamespaceInCurrentSubscription, +} +#[doc = "Description of the WCF relay resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WcfRelay { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of the WCF relay."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl WcfRelay { + pub fn new() -> Self { + Self::default() + } +} +pub mod wcf_relay { + use super::*; + #[doc = "Properties of the WCF relay."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Properties { + #[doc = "Returns true if the relay is dynamic; otherwise, false."] + #[serde(rename = "isDynamic", default, skip_serializing_if = "Option::is_none")] + pub is_dynamic: Option, + #[doc = "The time the WCF relay was created."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The time the namespace was updated."] + #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[doc = "The number of listeners for this relay. Note that min :1 and max:25 are supported."] + #[serde(rename = "listenerCount", default, skip_serializing_if = "Option::is_none")] + pub listener_count: Option, + #[doc = "WCF relay type."] + #[serde(rename = "relayType", default, skip_serializing_if = "Option::is_none")] + pub relay_type: Option, + #[doc = "Returns true if client authorization is needed for this relay; otherwise, false."] + #[serde(rename = "requiresClientAuthorization", default, skip_serializing_if = "Option::is_none")] + pub requires_client_authorization: Option, + #[doc = "Returns true if transport security is needed for this relay; otherwise, false."] + #[serde(rename = "requiresTransportSecurity", default, skip_serializing_if = "Option::is_none")] + pub requires_transport_security: Option, + #[doc = "The usermetadata is a placeholder to store user-defined string data for the WCF Relay endpoint. For example, it can be used to store descriptive data, such as list of teams and their contact information. Also, user-defined configuration settings can be stored."] + #[serde(rename = "userMetadata", default, skip_serializing_if = "Option::is_none")] + pub user_metadata: Option, + } + impl Properties { + pub fn new() -> Self { + Self::default() + } + } + pub mod properties { + use super::*; + #[doc = "WCF relay type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RelayType { + NetTcp, + Http, + } + } +} +#[doc = "The response of the list WCF relay operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WcfRelaysListResult { + #[doc = "Result of the list WCF relay operation."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to the next set of results. Not empty if value contains incomplete list of WCF relays."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl WcfRelaysListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/relay/src/package_2021_11_01/operations.rs b/services/mgmt/relay/src/package_2021_11_01/operations.rs new file mode 100644 index 0000000000..25f6374ce8 --- /dev/null +++ b/services/mgmt/relay/src/package_2021_11_01/operations.rs @@ -0,0 +1,4150 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn hybrid_connections(&self) -> hybrid_connections::Client { + hybrid_connections::Client(self.clone()) + } + pub fn namespaces(&self) -> namespaces::Client { + namespaces::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn private_endpoint_connections(&self) -> private_endpoint_connections::Client { + private_endpoint_connections::Client(self.clone()) + } + pub fn private_link_resources(&self) -> private_link_resources::Client { + private_link_resources::Client(self.clone()) + } + pub fn wcf_relays(&self) -> wcf_relays::Client { + wcf_relays::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Namespaces_ListAuthorizationRules(#[from] namespaces::list_authorization_rules::Error), + #[error(transparent)] + Namespaces_GetAuthorizationRule(#[from] namespaces::get_authorization_rule::Error), + #[error(transparent)] + Namespaces_CreateOrUpdateAuthorizationRule(#[from] namespaces::create_or_update_authorization_rule::Error), + #[error(transparent)] + Namespaces_DeleteAuthorizationRule(#[from] namespaces::delete_authorization_rule::Error), + #[error(transparent)] + Namespaces_ListKeys(#[from] namespaces::list_keys::Error), + #[error(transparent)] + Namespaces_RegenerateKeys(#[from] namespaces::regenerate_keys::Error), + #[error(transparent)] + HybridConnections_ListAuthorizationRules(#[from] hybrid_connections::list_authorization_rules::Error), + #[error(transparent)] + HybridConnections_GetAuthorizationRule(#[from] hybrid_connections::get_authorization_rule::Error), + #[error(transparent)] + HybridConnections_CreateOrUpdateAuthorizationRule(#[from] hybrid_connections::create_or_update_authorization_rule::Error), + #[error(transparent)] + HybridConnections_DeleteAuthorizationRule(#[from] hybrid_connections::delete_authorization_rule::Error), + #[error(transparent)] + HybridConnections_ListKeys(#[from] hybrid_connections::list_keys::Error), + #[error(transparent)] + HybridConnections_RegenerateKeys(#[from] hybrid_connections::regenerate_keys::Error), + #[error(transparent)] + WcfRelays_ListAuthorizationRules(#[from] wcf_relays::list_authorization_rules::Error), + #[error(transparent)] + WcfRelays_GetAuthorizationRule(#[from] wcf_relays::get_authorization_rule::Error), + #[error(transparent)] + WcfRelays_CreateOrUpdateAuthorizationRule(#[from] wcf_relays::create_or_update_authorization_rule::Error), + #[error(transparent)] + WcfRelays_DeleteAuthorizationRule(#[from] wcf_relays::delete_authorization_rule::Error), + #[error(transparent)] + WcfRelays_ListKeys(#[from] wcf_relays::list_keys::Error), + #[error(transparent)] + WcfRelays_RegenerateKeys(#[from] wcf_relays::regenerate_keys::Error), + #[error(transparent)] + HybridConnections_ListByNamespace(#[from] hybrid_connections::list_by_namespace::Error), + #[error(transparent)] + HybridConnections_Get(#[from] hybrid_connections::get::Error), + #[error(transparent)] + HybridConnections_CreateOrUpdate(#[from] hybrid_connections::create_or_update::Error), + #[error(transparent)] + HybridConnections_Delete(#[from] hybrid_connections::delete::Error), + #[error(transparent)] + Namespaces_CheckNameAvailability(#[from] namespaces::check_name_availability::Error), + #[error(transparent)] + Namespaces_List(#[from] namespaces::list::Error), + #[error(transparent)] + Namespaces_ListByResourceGroup(#[from] namespaces::list_by_resource_group::Error), + #[error(transparent)] + Namespaces_Get(#[from] namespaces::get::Error), + #[error(transparent)] + Namespaces_CreateOrUpdate(#[from] namespaces::create_or_update::Error), + #[error(transparent)] + Namespaces_Update(#[from] namespaces::update::Error), + #[error(transparent)] + Namespaces_Delete(#[from] namespaces::delete::Error), + #[error(transparent)] + PrivateEndpointConnections_List(#[from] private_endpoint_connections::list::Error), + #[error(transparent)] + PrivateEndpointConnections_Get(#[from] private_endpoint_connections::get::Error), + #[error(transparent)] + PrivateEndpointConnections_CreateOrUpdate(#[from] private_endpoint_connections::create_or_update::Error), + #[error(transparent)] + PrivateEndpointConnections_Delete(#[from] private_endpoint_connections::delete::Error), + #[error(transparent)] + PrivateLinkResources_Get(#[from] private_link_resources::get::Error), + #[error(transparent)] + PrivateLinkResources_List(#[from] private_link_resources::list::Error), + #[error(transparent)] + Namespaces_GetNetworkRuleSet(#[from] namespaces::get_network_rule_set::Error), + #[error(transparent)] + Namespaces_CreateOrUpdateNetworkRuleSet(#[from] namespaces::create_or_update_network_rule_set::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + WcfRelays_ListByNamespace(#[from] wcf_relays::list_by_namespace::Error), + #[error(transparent)] + WcfRelays_Get(#[from] wcf_relays::get::Error), + #[error(transparent)] + WcfRelays_CreateOrUpdate(#[from] wcf_relays::create_or_update::Error), + #[error(transparent)] + WcfRelays_Delete(#[from] wcf_relays::delete::Error), +} +pub mod namespaces { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_authorization_rules( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> list_authorization_rules::Builder { + list_authorization_rules::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> get_authorization_rule::Builder { + get_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update_authorization_rule::Builder { + create_or_update_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> delete_authorization_rule::Builder { + delete_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> regenerate_keys::Builder { + regenerate_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn check_name_availability( + &self, + subscription_id: impl Into, + parameters: impl Into, + ) -> check_name_availability::Builder { + check_name_availability::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + pub fn list(&self, subscription_id: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_resource_group( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn update( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_network_rule_set( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> get_network_rule_set::Builder { + get_network_rule_set::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update_network_rule_set( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + parameters: impl Into, + ) -> create_or_update_network_rule_set::Builder { + create_or_update_network_rule_set::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + parameters: parameters.into(), + } + } + } + pub mod list_authorization_rules { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::AuthorizationRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_authorization_rule { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules/{}/listKeys", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::RegenerateAccessKeyParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/authorizationRules/{}/regenerateKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod check_name_availability { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) parameters: models::CheckNameAvailability, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Relay/checkNameAvailability", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CheckNameAvailabilityResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Relay/namespaces", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespaceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RelayNamespace), + Created201(models::RelayNamespace), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) parameters: models::RelayNamespace, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::RelayNamespace), + Created201(models::RelayNamespace), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) parameters: models::RelayUpdateParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RelayNamespace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_network_rule_set { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/networkRuleSets/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkRuleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_network_rule_set { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + pub(crate) parameters: models::NetworkRuleSet, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/networkRuleSets/default", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NetworkRuleSet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod hybrid_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_authorization_rules( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + subscription_id: impl Into, + ) -> list_authorization_rules::Builder { + list_authorization_rules::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> get_authorization_rule::Builder { + get_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update_authorization_rule::Builder { + create_or_update_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> delete_authorization_rule::Builder { + delete_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> regenerate_keys::Builder { + regenerate_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_namespace( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> list_by_namespace::Builder { + list_by_namespace::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + hybrid_connection_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + hybrid_connection_name: hybrid_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_authorization_rules { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::AuthorizationRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_authorization_rule { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules/{}/listKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::RegenerateAccessKeyParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}/authorizationRules/{}/regenerateKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . hybrid_connection_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_namespace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.hybrid_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) parameters: models::HybridConnection, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.hybrid_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::HybridConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) hybrid_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/hybridConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.hybrid_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod wcf_relays { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_authorization_rules( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + subscription_id: impl Into, + ) -> list_authorization_rules::Builder { + list_authorization_rules::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> get_authorization_rule::Builder { + get_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update_authorization_rule::Builder { + create_or_update_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete_authorization_rule( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> delete_authorization_rule::Builder { + delete_authorization_rule::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + authorization_rule_name: impl Into, + subscription_id: impl Into, + ) -> list_keys::Builder { + list_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + authorization_rule_name: authorization_rule_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn regenerate_keys( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + authorization_rule_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> regenerate_keys::Builder { + regenerate_keys::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + authorization_rule_name: authorization_rule_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list_by_namespace( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> list_by_namespace::Builder { + list_by_namespace::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + relay_name: impl Into, + subscription_id: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + relay_name: relay_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod list_authorization_rules { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRuleListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_authorization_rule { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::AuthorizationRule, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AuthorizationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_authorization_rule { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name, + &self.authorization_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules/{}/listKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . relay_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod regenerate_keys { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) authorization_rule_name: String, + pub(crate) parameters: models::RegenerateAccessKeyParameters, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}/authorizationRules/{}/regenerateKeys" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . namespace_name , & self . relay_name , & self . authorization_rule_name) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AccessKeys = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_namespace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WcfRelaysListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::WcfRelay), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WcfRelay = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) parameters: models::WcfRelay, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::WcfRelay = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) relay_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/wcfRelays/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.relay_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_endpoint_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + private_endpoint_connection_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + namespace_name: impl Into, + private_endpoint_connection_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + private_endpoint_connection_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + private_endpoint_connection_name: private_endpoint_connection_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateEndpointConnections", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnectionListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PrivateEndpointConnection), + Created201(models::PrivateEndpointConnection), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) private_endpoint_connection_name: String, + pub(crate) parameters: models::PrivateEndpointConnection, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateEndpointConnection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + pub(crate) private_endpoint_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateEndpointConnections/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod private_link_resources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + private_link_resource_name: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + private_link_resource_name: private_link_resource_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn list( + &self, + resource_group_name: impl Into, + namespace_name: impl Into, + subscription_id: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + namespace_name: namespace_name.into(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) private_link_resource_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateLinkResources/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name, + &self.private_link_resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) namespace_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Relay/namespaces/{}/privateLinkResources", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.namespace_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PrivateLinkResourcesListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Relay/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/reservations/Cargo.toml b/services/mgmt/reservations/Cargo.toml index 9a6025fd90..e9a56f9017 100644 --- a/services/mgmt/reservations/Cargo.toml +++ b/services/mgmt/reservations/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_reservations" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/reservations/src/package_2017_11/models.rs b/services/mgmt/reservations/src/package_2017_11/models.rs index 0b80efba1a..58056daf81 100644 --- a/services/mgmt/reservations/src/package_2017_11/models.rs +++ b/services/mgmt/reservations/src/package_2017_11/models.rs @@ -330,6 +330,7 @@ pub enum ProvisioningState { Failed, Split, Merged, + Processing, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct ReservationList { diff --git a/services/mgmt/reservations/src/package_2021_07_01/models.rs b/services/mgmt/reservations/src/package_2021_07_01/models.rs index edfc5eb2a5..011488b940 100644 --- a/services/mgmt/reservations/src/package_2021_07_01/models.rs +++ b/services/mgmt/reservations/src/package_2021_07_01/models.rs @@ -427,6 +427,7 @@ pub enum DisplayProvisioningState { Expiring, Expired, Pending, + Processing, Cancelled, Failed, } @@ -1461,6 +1462,7 @@ impl ReservationSplitProperties { pub enum ReservationStatusCode { None, Pending, + Processing, Active, PurchaseError, PaymentInstrumentError, @@ -1490,6 +1492,9 @@ pub struct ReservationSummary { #[doc = "The number of reservation in Cancelled state"] #[serde(rename = "cancelledCount", default, skip_serializing_if = "Option::is_none")] pub cancelled_count: Option, + #[doc = "The number of reservation in Processing state"] + #[serde(rename = "processingCount", default, skip_serializing_if = "Option::is_none")] + pub processing_count: Option, } impl ReservationSummary { pub fn new() -> Self { diff --git a/services/mgmt/reservations/src/package_2022_03/models.rs b/services/mgmt/reservations/src/package_2022_03/models.rs index feb3281764..2a35550343 100644 --- a/services/mgmt/reservations/src/package_2022_03/models.rs +++ b/services/mgmt/reservations/src/package_2022_03/models.rs @@ -427,6 +427,7 @@ pub enum DisplayProvisioningState { Expiring, Expired, Pending, + Processing, Cancelled, Failed, } @@ -1464,6 +1465,7 @@ impl ReservationSplitProperties { pub enum ReservationStatusCode { None, Pending, + Processing, Active, PurchaseError, PaymentInstrumentError, @@ -1493,6 +1495,9 @@ pub struct ReservationSummary { #[doc = "The number of reservation in Cancelled state"] #[serde(rename = "cancelledCount", default, skip_serializing_if = "Option::is_none")] pub cancelled_count: Option, + #[doc = "The number of reservation in Processing state"] + #[serde(rename = "processingCount", default, skip_serializing_if = "Option::is_none")] + pub processing_count: Option, } impl ReservationSummary { pub fn new() -> Self { @@ -1783,6 +1788,7 @@ pub enum ReservedResourceType { NetAppStorage, AzureFiles, SqlEdge, + VirtualMachineSoftware, } #[doc = "Resource name provided by the resource provider. Use this property for quotaRequest parameter."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] diff --git a/services/mgmt/resourceconnector/Cargo.toml b/services/mgmt/resourceconnector/Cargo.toml index 3ac14f2dea..3c34de5e23 100644 --- a/services/mgmt/resourceconnector/Cargo.toml +++ b/services/mgmt/resourceconnector/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_resourceconnector" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/resourcegraph/Cargo.toml b/services/mgmt/resourcegraph/Cargo.toml index 0b77cd5d12..53f2d1b3fb 100644 --- a/services/mgmt/resourcegraph/Cargo.toml +++ b/services/mgmt/resourcegraph/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_resourcegraph" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/resourcehealth/Cargo.toml b/services/mgmt/resourcehealth/Cargo.toml index de0ec8a998..ed991740d0 100644 --- a/services/mgmt/resourcehealth/Cargo.toml +++ b/services/mgmt/resourcehealth/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_resourcehealth" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/resourcehealth/README.md b/services/mgmt/resourcehealth/README.md index 95044f6b7c..1cc4ff6c9b 100644 --- a/services/mgmt/resourcehealth/README.md +++ b/services/mgmt/resourcehealth/README.md @@ -14,5 +14,5 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-2015-01` has 8 operations from 1 API versions: `2015-01-01`. Use crate feature `package-2015-01` to enable. The operations will be in the `package_2015_01` module. - `package-2018-08-preview` has 12 operations from 1 API versions: `2018-07-01-preview`. Use crate feature `package-2018-08-preview` to enable. The operations will be in the `package_2018_08_preview` module. - `package-2020-05-01-preview` has 5 operations from 1 API versions: `2020-05-01-preview`. Use crate feature `package-2020-05-01-preview` to enable. The operations will be in the `package_2020_05_01_preview` module. -- `package-2018-07-01` has 9 operations from 1 API versions: `2018-07-01`. Use crate feature `package-2018-07-01` to enable. The operations will be in the `package_2018_07_01` module. +- `package-2018-07-01` has 11 operations from 1 API versions: `2018-07-01`. Use crate feature `package-2018-07-01` to enable. The operations will be in the `package_2018_07_01` module. - `package-2020-05-01` has 5 operations from 1 API versions: `2020-05-01`. Use crate feature `package-2020-05-01` to enable. The operations will be in the `package_2020_05_01` module. \ No newline at end of file diff --git a/services/mgmt/resourcehealth/src/package_2018_07_01/operations.rs b/services/mgmt/resourcehealth/src/package_2018_07_01/operations.rs index 3965e04e0b..621dab3551 100644 --- a/services/mgmt/resourcehealth/src/package_2018_07_01/operations.rs +++ b/services/mgmt/resourcehealth/src/package_2018_07_01/operations.rs @@ -83,6 +83,9 @@ impl Client { pub fn events(&self) -> events::Client { events::Client(self.clone()) } + pub fn metadata(&self) -> metadata::Client { + metadata::Client(self.clone()) + } pub fn operations(&self) -> operations::Client { operations::Client(self.clone()) } @@ -109,6 +112,10 @@ pub enum Error { EmergingIssues_Get(#[from] emerging_issues::get::Error), #[error(transparent)] EmergingIssues_List(#[from] emerging_issues::list::Error), + #[error(transparent)] + Metadata_List(#[from] metadata::list::Error), + #[error(transparent)] + Metadata_GetEntity(#[from] metadata::get_entity::Error), } pub mod events { use super::models; @@ -959,3 +966,159 @@ pub mod emerging_issues { } } } +pub mod metadata { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn get_entity(&self, name: impl Into) -> get_entity::Builder { + get_entity::Builder { + client: self.0.clone(), + name: name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ResourceHealth/metadata", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetadataEntityListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.ResourceHealth/metadata/{}", + self.client.endpoint(), + &self.name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2018-07-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetadataEntity = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/resourcemover/Cargo.toml b/services/mgmt/resourcemover/Cargo.toml index bec4368103..39664c01cb 100644 --- a/services/mgmt/resourcemover/Cargo.toml +++ b/services/mgmt/resourcemover/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_resourcemover" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/resources/Cargo.toml b/services/mgmt/resources/Cargo.toml index c5ccbce599..fddb92010b 100644 --- a/services/mgmt/resources/Cargo.toml +++ b/services/mgmt/resources/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_resources" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,14 +24,15 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-changes-2022-03", "package-policy-2021-06", "package-privatelinks-2020-05", "package-locks-2020-05"] +features = ["no-default-tag", "package-changes-2022-03-01-preview", "package-policy-2021-06", "package-privatelinks-2020-05", "package-locks-2020-05"] [features] -default = ["package-resources-2021-04", "enable_reqwest"] +default = ["package-changes-2022-05", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] -"package-changes-2022-03" = [] +"package-changes-2022-05" = [] +"package-changes-2022-03-01-preview" = [] "package-policy-2021-06" = [] "package-privatelinks-2020-05" = [] "package-locks-2020-05" = [] @@ -52,6 +53,7 @@ no-default-tag = [] "package-policy-2018-03" = [] "package-policy-2017-06" = [] "package-pure-policy-2017-06" = [] +"package-templatespecs-2022-02" = [] "package-templatespecs-2021-05" = [] "package-templatespecs-2021-03-preview" = [] "package-templatespecs-2019-06-preview" = [] diff --git a/services/mgmt/resources/README.md b/services/mgmt/resources/README.md index ff0a3d17c2..4c5c3831e0 100644 --- a/services/mgmt/resources/README.md +++ b/services/mgmt/resources/README.md @@ -6,11 +6,12 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/ To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-resources-2021-04`. +The default tag is `package-changes-2022-05`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: -- `package-changes-2022-03` has 2 operations from 1 API versions: `2022-03-01-preview`. Use crate feature `package-changes-2022-03` to enable. The operations will be in the `package_changes_2022_03` module. +- `package-changes-2022-05` has 2 operations from 1 API versions: `2022-05-01`. Use crate feature `package-changes-2022-05` to enable. The operations will be in the `package_changes_2022_05` module. +- `package-changes-2022-03-01-preview` has 2 operations from 1 API versions: `2022-03-01-preview`. Use crate feature `package-changes-2022-03-01-preview` to enable. The operations will be in the `package_changes_2022_03_01_preview` module. - `package-policy-2021-06` has 41 operations from 4 API versions: `2020-06-01`, `2020-07-01-preview`, `2020-09-01`, `2021-06-01`. Use crate feature `package-policy-2021-06` to enable. The operations will be in the `package_policy_2021_06` module. - `package-privatelinks-2020-05` has 9 operations from 1 API versions: `2020-05-01`. Use crate feature `package-privatelinks-2020-05` to enable. The operations will be in the `package_privatelinks_2020_05` module. - `package-locks-2020-05` has 17 operations from 1 API versions: `2020-05-01`. Use crate feature `package-locks-2020-05` to enable. The operations will be in the `package_locks_2020_05` module. @@ -31,6 +32,7 @@ The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/servi - `package-policy-2018-03` has 29 operations from 1 API versions: `2018-03-01`. Use crate feature `package-policy-2018-03` to enable. The operations will be in the `package_policy_2018_03` module. - `package-policy-2017-06` has 29 operations from 2 API versions: `2016-12-01`, `2017-06-01-preview`. Use crate feature `package-policy-2017-06` to enable. The operations will be in the `package_policy_2017_06` module. - `package-pure-policy-2017-06` has 19 operations from 1 API versions: `2017-06-01-preview`. Use crate feature `package-pure-policy-2017-06` to enable. The operations will be in the `package_pure_policy_2017_06` module. +- `package-templatespecs-2022-02` has 15 operations from 1 API versions: `2022-02-01`. Use crate feature `package-templatespecs-2022-02` to enable. The operations will be in the `package_templatespecs_2022_02` module. - `package-templatespecs-2021-05` has 11 operations from 1 API versions: `2021-05-01`. Use crate feature `package-templatespecs-2021-05` to enable. The operations will be in the `package_templatespecs_2021_05` module. - `package-templatespecs-2021-03-preview` has 11 operations from 1 API versions: `2021-03-01-preview`. Use crate feature `package-templatespecs-2021-03-preview` to enable. The operations will be in the `package_templatespecs_2021_03_preview` module. - `package-templatespecs-2019-06-preview` has 11 operations from 1 API versions: `2019-06-01-preview`. Use crate feature `package-templatespecs-2019-06-preview` to enable. The operations will be in the `package_templatespecs_2019_06_preview` module. diff --git a/services/mgmt/resources/src/lib.rs b/services/mgmt/resources/src/lib.rs index 7ffd650e64..f0a9976cb1 100644 --- a/services/mgmt/resources/src/lib.rs +++ b/services/mgmt/resources/src/lib.rs @@ -3,10 +3,14 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] -#[cfg(feature = "package-changes-2022-03")] -pub mod package_changes_2022_03; -#[cfg(all(feature = "package-changes-2022-03", not(feature = "no-default-tag")))] -pub use package_changes_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-changes-2022-05")] +pub mod package_changes_2022_05; +#[cfg(all(feature = "package-changes-2022-05", not(feature = "no-default-tag")))] +pub use package_changes_2022_05::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-changes-2022-03-01-preview")] +pub mod package_changes_2022_03_01_preview; +#[cfg(all(feature = "package-changes-2022-03-01-preview", not(feature = "no-default-tag")))] +pub use package_changes_2022_03_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-policy-2021-06")] pub mod package_policy_2021_06; #[cfg(all(feature = "package-policy-2021-06", not(feature = "no-default-tag")))] @@ -87,6 +91,10 @@ pub use package_policy_2017_06::{models, operations, operations::Client, operati pub mod package_pure_policy_2017_06; #[cfg(all(feature = "package-pure-policy-2017-06", not(feature = "no-default-tag")))] pub use package_pure_policy_2017_06::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-templatespecs-2022-02")] +pub mod package_templatespecs_2022_02; +#[cfg(all(feature = "package-templatespecs-2022-02", not(feature = "no-default-tag")))] +pub use package_templatespecs_2022_02::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-templatespecs-2021-05")] pub mod package_templatespecs_2021_05; #[cfg(all(feature = "package-templatespecs-2021-05", not(feature = "no-default-tag")))] diff --git a/services/mgmt/resources/src/package_changes_2022_03_01_preview/mod.rs b/services/mgmt/resources/src/package_changes_2022_03_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/resources/src/package_changes_2022_03_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/resources/src/package_changes_2022_03/models.rs b/services/mgmt/resources/src/package_changes_2022_03_01_preview/models.rs similarity index 100% rename from services/mgmt/resources/src/package_changes_2022_03/models.rs rename to services/mgmt/resources/src/package_changes_2022_03_01_preview/models.rs diff --git a/services/mgmt/resources/src/package_changes_2022_03/operations.rs b/services/mgmt/resources/src/package_changes_2022_03_01_preview/operations.rs similarity index 96% rename from services/mgmt/resources/src/package_changes_2022_03/operations.rs rename to services/mgmt/resources/src/package_changes_2022_03_01_preview/operations.rs index 440bebcba4..f917a016e1 100644 --- a/services/mgmt/resources/src/package_changes_2022_03/operations.rs +++ b/services/mgmt/resources/src/package_changes_2022_03_01_preview/operations.rs @@ -74,11 +74,8 @@ impl Client { pipeline, } } - pub fn change_resource(&self) -> change_resource::Client { - change_resource::Client(self.clone()) - } - pub fn change_resources(&self) -> change_resources::Client { - change_resources::Client(self.clone()) + pub fn changes(&self) -> changes::Client { + changes::Client(self.clone()) } } #[non_exhaustive] @@ -86,11 +83,11 @@ impl Client { #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] - ChangeResources_List(#[from] change_resources::list::Error), + Changes_List(#[from] changes::list::Error), #[error(transparent)] - ChangeResource_Get(#[from] change_resource::get::Error), + Changes_Get(#[from] changes::get::Error), } -pub mod change_resources { +pub mod changes { use super::models; pub struct Client(pub(crate) super::Client); impl Client { @@ -113,6 +110,25 @@ pub mod change_resources { skip_token: None, } } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + resource_type: impl Into, + resource_name: impl Into, + change_resource_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + change_resource_id: change_resource_id.into(), + } + } } pub mod list { use super::models; @@ -211,31 +227,6 @@ pub mod change_resources { } } } -} -pub mod change_resource { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn get( - &self, - subscription_id: impl Into, - resource_group_name: impl Into, - resource_provider_namespace: impl Into, - resource_type: impl Into, - resource_name: impl Into, - change_resource_id: impl Into, - ) -> get::Builder { - get::Builder { - client: self.0.clone(), - subscription_id: subscription_id.into(), - resource_group_name: resource_group_name.into(), - resource_provider_namespace: resource_provider_namespace.into(), - resource_type: resource_type.into(), - resource_name: resource_name.into(), - change_resource_id: change_resource_id.into(), - } - } - } pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] diff --git a/services/mgmt/resources/src/package_changes_2022_05/mod.rs b/services/mgmt/resources/src/package_changes_2022_05/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/resources/src/package_changes_2022_05/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/resources/src/package_changes_2022_05/models.rs b/services/mgmt/resources/src/package_changes_2022_05/models.rs new file mode 100644 index 0000000000..cc2518d153 --- /dev/null +++ b/services/mgmt/resources/src/package_changes_2022_05/models.rs @@ -0,0 +1,205 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Details about the change resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangeAttributes { + #[doc = "The ARM correlation ID of the change resource"] + #[serde(rename = "correlationId", default, skip_serializing_if = "Option::is_none")] + pub correlation_id: Option, + #[doc = "The time the change(s) on the target resource ocurred"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, + #[doc = "The number of changes this resource captures"] + #[serde(rename = "changesCount", default, skip_serializing_if = "Option::is_none")] + pub changes_count: Option, + #[doc = "The GUID of the previous snapshot"] + #[serde(rename = "previousResourceSnapshotId", default, skip_serializing_if = "Option::is_none")] + pub previous_resource_snapshot_id: Option, + #[doc = "The GUID of the new snapshot"] + #[serde(rename = "newResourceSnapshotId", default, skip_serializing_if = "Option::is_none")] + pub new_resource_snapshot_id: Option, +} +impl ChangeAttributes { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An individual change on the target resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangeBase { + #[doc = "The type of change that occurred"] + #[serde(rename = "propertyChangeType", default, skip_serializing_if = "Option::is_none")] + pub property_change_type: Option, + #[doc = "The entity that made the change"] + #[serde(rename = "changeCategory", default, skip_serializing_if = "Option::is_none")] + pub change_category: Option, + #[doc = "The target resource property value before the change"] + #[serde(rename = "previousValue", default, skip_serializing_if = "Option::is_none")] + pub previous_value: Option, + #[doc = "The target resource property value after the change"] + #[serde(rename = "newValue", default, skip_serializing_if = "Option::is_none")] + pub new_value: Option, +} +impl ChangeBase { + pub fn new() -> Self { + Self::default() + } +} +pub mod change_base { + use super::*; + #[doc = "The type of change that occurred"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PropertyChangeType { + Insert, + Update, + Remove, + } + #[doc = "The entity that made the change"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ChangeCategory { + User, + System, + } +} +#[doc = "The properties of a change"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangeProperties { + #[doc = "The fully qualified ID of the target resource that was changed"] + #[serde(rename = "targetResourceId", default, skip_serializing_if = "Option::is_none")] + pub target_resource_id: Option, + #[doc = "The namespace and type of the resource"] + #[serde(rename = "targetResourceType", default, skip_serializing_if = "Option::is_none")] + pub target_resource_type: Option, + #[doc = "The type of change that was captured in the resource"] + #[serde(rename = "changeType", default, skip_serializing_if = "Option::is_none")] + pub change_type: Option, + #[doc = "Details about the change resource"] + #[serde(rename = "changeAttributes", default, skip_serializing_if = "Option::is_none")] + pub change_attributes: Option, + #[doc = "A dictionary with changed property name as a key and the change details as the value"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub changes: Option, +} +impl ChangeProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod change_properties { + use super::*; + #[doc = "The type of change that was captured in the resource"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ChangeType { + Update, + Delete, + Create, + } +} +#[doc = "The list of resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangeResourceListResult { + #[doc = "The link used to get the next page of Change Resources"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of resources"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl ChangeResourceListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Change Resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangeResourceResult { + #[serde(flatten)] + pub resource: Resource, + #[doc = "The properties of a change"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ChangeResourceResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A dictionary with changed property name as a key and the change details as the value"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ChangesDictionary {} +impl ChangesDictionary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} diff --git a/services/mgmt/resources/src/package_changes_2022_05/operations.rs b/services/mgmt/resources/src/package_changes_2022_05/operations.rs new file mode 100644 index 0000000000..a87f4dfab3 --- /dev/null +++ b/services/mgmt/resources/src/package_changes_2022_05/operations.rs @@ -0,0 +1,313 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn changes(&self) -> changes::Client { + changes::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Changes_List(#[from] changes::list::Error), + #[error(transparent)] + Changes_Get(#[from] changes::get::Error), +} +pub mod changes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + resource_type: impl Into, + resource_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + top: None, + skip_token: None, + } + } + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + resource_provider_namespace: impl Into, + resource_type: impl Into, + resource_name: impl Into, + change_resource_id: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + resource_provider_namespace: resource_provider_namespace.into(), + resource_type: resource_type.into(), + resource_name: resource_name.into(), + change_resource_id: change_resource_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) resource_type: String, + pub(crate) resource_name: String, + pub(crate) top: Option, + pub(crate) skip_token: Option, + } + impl Builder { + pub fn top(mut self, top: i64) -> Self { + self.top = Some(top); + self + } + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.Resources/changes", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.resource_type, + &self.resource_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ChangeResourceListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) resource_provider_namespace: String, + pub(crate) resource_type: String, + pub(crate) resource_name: String, + pub(crate) change_resource_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/{}/{}/providers/Microsoft.Resources/changes/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.resource_provider_namespace, + &self.resource_type, + &self.resource_name, + &self.change_resource_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ChangeResourceResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/resources/src/package_templatespecs_2022_02/mod.rs b/services/mgmt/resources/src/package_templatespecs_2022_02/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/resources/src/package_templatespecs_2022_02/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/resources/src/package_templatespecs_2022_02/models.rs b/services/mgmt/resources/src/package_templatespecs_2022_02/models.rs new file mode 100644 index 0000000000..08e64117f4 --- /dev/null +++ b/services/mgmt/resources/src/package_templatespecs_2022_02/models.rs @@ -0,0 +1,303 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Common properties for all Azure resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceBase { + #[doc = "String Id used to locate any resource on Azure."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Name of this resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of this resource."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl AzureResourceBase { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents a Template Spec artifact containing an embedded Azure Resource Manager template for use as a linked template."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedTemplateArtifact { + #[doc = "A filesystem safe relative path of the artifact."] + pub path: String, + #[doc = "The Azure Resource Manager template."] + pub template: serde_json::Value, +} +impl LinkedTemplateArtifact { + pub fn new(path: String, template: serde_json::Value) -> Self { + Self { path, template } + } +} +#[doc = "Template Spec object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TemplateSpec { + #[serde(flatten)] + pub azure_resource_base: AzureResourceBase, + #[doc = "The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations."] + pub location: String, + #[doc = "Template Spec properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TemplateSpec { + pub fn new(location: String) -> Self { + Self { + azure_resource_base: AzureResourceBase::default(), + location, + properties: None, + tags: None, + } + } +} +#[doc = "Template Spec properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecProperties { + #[doc = "Template Spec description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Template Spec display name."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The Template Spec metadata. Metadata is an open-ended object and is typically a collection of key-value pairs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[doc = "High-level information about the versions within this Template Spec. The keys are the version names. Only populated if the $expand query parameter is set to 'versions'."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub versions: Option, +} +impl TemplateSpecProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Template Spec properties to be updated (only tags are currently supported)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecUpdateModel { + #[serde(flatten)] + pub azure_resource_base: AzureResourceBase, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TemplateSpecUpdateModel { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Template Spec Version object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TemplateSpecVersion { + #[serde(flatten)] + pub azure_resource_base: AzureResourceBase, + #[doc = "The location of the Template Spec Version. It must match the location of the parent Template Spec."] + pub location: String, + #[doc = "Template Spec Version properties."] + pub properties: TemplateSpecVersionProperties, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TemplateSpecVersion { + pub fn new(location: String, properties: TemplateSpecVersionProperties) -> Self { + Self { + azure_resource_base: AzureResourceBase::default(), + location, + properties, + tags: None, + } + } +} +#[doc = "High-level information about a Template Spec version."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecVersionInfo { + #[doc = "Template Spec version description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The timestamp of when the version was created."] + #[serde(rename = "timeCreated", default, skip_serializing_if = "Option::is_none")] + pub time_created: Option, + #[doc = "The timestamp of when the version was last modified."] + #[serde(rename = "timeModified", default, skip_serializing_if = "Option::is_none")] + pub time_modified: Option, +} +impl TemplateSpecVersionInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Template Spec Version properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecVersionProperties { + #[doc = "Template Spec version description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "An array of linked template artifacts."] + #[serde(rename = "linkedTemplates", default, skip_serializing_if = "Vec::is_empty")] + pub linked_templates: Vec, + #[doc = "The version metadata. Metadata is an open-ended object and is typically a collection of key-value pairs."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[doc = "The main Azure Resource Manager template content."] + #[serde(rename = "mainTemplate", default, skip_serializing_if = "Option::is_none")] + pub main_template: Option, + #[doc = "The Azure Resource Manager template UI definition content."] + #[serde(rename = "uiFormDefinition", default, skip_serializing_if = "Option::is_none")] + pub ui_form_definition: Option, +} +impl TemplateSpecVersionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Template Spec Version properties to be updated (only tags are currently supported)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecVersionUpdateModel { + #[serde(flatten)] + pub azure_resource_base: AzureResourceBase, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl TemplateSpecVersionUpdateModel { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Template Specs versions"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecVersionsListResult { + #[doc = "An array of Template Spec versions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to use for getting the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TemplateSpecVersionsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Template Specs error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecsError { + #[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl TemplateSpecsError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "List of Template Specs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TemplateSpecsListResult { + #[doc = "An array of Template Specs."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The URL to use for getting the next set of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TemplateSpecsListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/resources/src/package_templatespecs_2022_02/operations.rs b/services/mgmt/resources/src/package_templatespecs_2022_02/operations.rs new file mode 100644 index 0000000000..e61f287532 --- /dev/null +++ b/services/mgmt/resources/src/package_templatespecs_2022_02/operations.rs @@ -0,0 +1,1544 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn template_spec_versions(&self) -> template_spec_versions::Client { + template_spec_versions::Client(self.clone()) + } + pub fn template_specs(&self) -> template_specs::Client { + template_specs::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + TemplateSpecs_Get(#[from] template_specs::get::Error), + #[error(transparent)] + TemplateSpecs_CreateOrUpdate(#[from] template_specs::create_or_update::Error), + #[error(transparent)] + TemplateSpecs_Update(#[from] template_specs::update::Error), + #[error(transparent)] + TemplateSpecs_Delete(#[from] template_specs::delete::Error), + #[error(transparent)] + TemplateSpecs_ListBySubscription(#[from] template_specs::list_by_subscription::Error), + #[error(transparent)] + TemplateSpecs_ListByResourceGroup(#[from] template_specs::list_by_resource_group::Error), + #[error(transparent)] + TemplateSpecVersions_Get(#[from] template_spec_versions::get::Error), + #[error(transparent)] + TemplateSpecVersions_CreateOrUpdate(#[from] template_spec_versions::create_or_update::Error), + #[error(transparent)] + TemplateSpecVersions_Update(#[from] template_spec_versions::update::Error), + #[error(transparent)] + TemplateSpecVersions_Delete(#[from] template_spec_versions::delete::Error), + #[error(transparent)] + TemplateSpecVersions_List(#[from] template_spec_versions::list::Error), + #[error(transparent)] + TemplateSpecs_GetBuiltIn(#[from] template_specs::get_built_in::Error), + #[error(transparent)] + TemplateSpecs_ListBuiltIns(#[from] template_specs::list_built_ins::Error), + #[error(transparent)] + TemplateSpecVersions_ListBuiltIns(#[from] template_spec_versions::list_built_ins::Error), + #[error(transparent)] + TemplateSpecVersions_GetBuiltIn(#[from] template_spec_versions::get_built_in::Error), +} +pub mod template_specs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + expand: None, + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + template_spec: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec: template_spec.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + } + } + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + expand: None, + } + } + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + expand: None, + } + } + pub fn get_built_in(&self, template_spec_name: impl Into) -> get_built_in::Builder { + get_built_in::Builder { + client: self.0.clone(), + template_spec_name: template_spec_name.into(), + expand: None, + } + } + pub fn list_built_ins(&self) -> list_built_ins::Builder { + list_built_ins::Builder { + client: self.0.clone(), + expand: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TemplateSpec), + Created201(models::TemplateSpec), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec: models::TemplateSpec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.template_spec).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec: Option, + } + impl Builder { + pub fn template_spec(mut self, template_spec: impl Into) -> Self { + self.template_spec = Some(template_spec.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = if let Some(template_spec) = &self.template_spec { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(template_spec).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.Resources/templateSpecs/", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_built_in { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) template_spec_name: String, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Resources/builtInTemplateSpecs/{}", + self.client.endpoint(), + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_built_ins { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) expand: Option, + } + impl Builder { + pub fn expand(mut self, expand: impl Into) -> Self { + self.expand = Some(expand.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.Resources/builtInTemplateSpecs/", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + if let Some(expand) = &self.expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod template_spec_versions { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + template_spec_version: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec_version: template_spec_version.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + template_spec_version: impl Into, + template_spec_version_model: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec_version: template_spec_version.into(), + template_spec_version_model: template_spec_version_model.into(), + } + } + pub fn update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + template_spec_version: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec_version: template_spec_version.into(), + template_spec_version_update_model: None, + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + template_spec_version: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + template_spec_version: template_spec_version.into(), + } + } + pub fn list( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + template_spec_name: impl Into, + ) -> list::Builder { + list::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + template_spec_name: template_spec_name.into(), + } + } + pub fn list_built_ins(&self, template_spec_name: impl Into) -> list_built_ins::Builder { + list_built_ins::Builder { + client: self.0.clone(), + template_spec_name: template_spec_name.into(), + } + } + pub fn get_built_in( + &self, + template_spec_name: impl Into, + template_spec_version: impl Into, + ) -> get_built_in::Builder { + get_built_in::Builder { + client: self.0.clone(), + template_spec_name: template_spec_name.into(), + template_spec_version: template_spec_version.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec_version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name, + &self.template_spec_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TemplateSpecVersion), + Created201(models::TemplateSpecVersion), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec_version: String, + pub(crate) template_spec_version_model: models::TemplateSpecVersion, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name, + &self.template_spec_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.template_spec_version_model).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec_version: String, + pub(crate) template_spec_version_update_model: Option, + } + impl Builder { + pub fn template_spec_version_update_model( + mut self, + template_spec_version_update_model: impl Into, + ) -> Self { + self.template_spec_version_update_model = Some(template_spec_version_update_model.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name, + &self.template_spec_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = if let Some(template_spec_version_update_model) = &self.template_spec_version_update_model { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(template_spec_version_update_model).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + pub(crate) template_spec_version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}/versions/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name, + &self.template_spec_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) template_spec_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Resources/templateSpecs/{}/versions", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_built_ins { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) template_spec_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Resources/builtInTemplateSpecs/{}/versions", + self.client.endpoint(), + &self.template_spec_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersionsListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_built_in { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::TemplateSpecsError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) template_spec_name: String, + pub(crate) template_spec_version: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/providers/Microsoft.Resources/builtInTemplateSpecs/{}/versions/{}", + self.client.endpoint(), + &self.template_spec_name, + &self.template_spec_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecVersion = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TemplateSpecsError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/saas/Cargo.toml b/services/mgmt/saas/Cargo.toml index d398611885..d7f4e2e7c9 100644 --- a/services/mgmt/saas/Cargo.toml +++ b/services/mgmt/saas/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_saas" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/scheduler/Cargo.toml b/services/mgmt/scheduler/Cargo.toml index d365967318..6f83feba21 100644 --- a/services/mgmt/scheduler/Cargo.toml +++ b/services/mgmt/scheduler/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_scheduler" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/scvmm/Cargo.toml b/services/mgmt/scvmm/Cargo.toml new file mode 100644 index 0000000000..617b23ede4 --- /dev/null +++ b/services/mgmt/scvmm/Cargo.toml @@ -0,0 +1,34 @@ +# generated by AutoRust +[package] +name = "azure_mgmt_scvmm" +version = "0.3.0" +edition = "2021" +license = "MIT" +description = "generated REST API bindings" +repository = "https://github.com/azure/azure-sdk-for-rust" +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_mgmt_scvmm" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.2", default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" +futures = "0.3" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1" } +tokio = { version = "1.0", features = ["macros"] } + +[package.metadata.docs.rs] +features = ["no-default-tag"] + +[features] +default = ["package-2020-06-05-preview", "enable_reqwest"] +enable_reqwest = ["azure_core/enable_reqwest"] +enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] +no-default-tag = [] +"package-2020-06-05-preview" = [] diff --git a/services/mgmt/scvmm/README.md b/services/mgmt/scvmm/README.md new file mode 100644 index 0000000000..0ca5ccd881 --- /dev/null +++ b/services/mgmt/scvmm/README.md @@ -0,0 +1,13 @@ +# azure_mgmt_scvmm crate + +This is a generated [Azure SDK for Rust](https://github.com/Azure/azure-sdk-for-rust) crate from the Azure REST API specifications listed in: + +https://github.com/Azure/azure-rest-api-specs/blob/main/specification/scvmm/resource-manager/readme.md + +To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). + +The default tag is `package-2020-06-05-preview`. + +The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: + +- `package-2020-06-05-preview` has 47 operations from 1 API versions: `2020-06-05-preview`. Use crate feature `package-2020-06-05-preview` to enable. The operations will be in the `package_2020_06_05_preview` module. \ No newline at end of file diff --git a/services/mgmt/scvmm/src/lib.rs b/services/mgmt/scvmm/src/lib.rs new file mode 100644 index 0000000000..d946e87521 --- /dev/null +++ b/services/mgmt/scvmm/src/lib.rs @@ -0,0 +1,9 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::ptr_arg)] +#![allow(clippy::large_enum_variant)] +#![doc = "generated by AutoRust"] +#[cfg(feature = "package-2020-06-05-preview")] +pub mod package_2020_06_05_preview; +#[cfg(all(feature = "package-2020-06-05-preview", not(feature = "no-default-tag")))] +pub use package_2020_06_05_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/scvmm/src/package_2020_06_05_preview/mod.rs b/services/mgmt/scvmm/src/package_2020_06_05_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/scvmm/src/package_2020_06_05_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/scvmm/src/package_2020_06_05_preview/models.rs b/services/mgmt/scvmm/src/package_2020_06_05_preview/models.rs new file mode 100644 index 0000000000..d0a387ea12 --- /dev/null +++ b/services/mgmt/scvmm/src/package_2020_06_05_preview/models.rs @@ -0,0 +1,1482 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Allocation method."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AllocationMethod { + Dynamic, + Static, +} +#[doc = "The AvailabilitySets resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailabilitySet { + #[doc = "Defines the resource properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation", default, skip_serializing_if = "Option::is_none")] + pub extended_location: Option, +} +impl AvailabilitySet { + pub fn new() -> Self { + Self::default() + } +} +pub type AvailabilitySetList = Vec; +#[doc = "List of AvailabilitySets."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailabilitySetListResult { + #[doc = "List of AvailabilitySets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl AvailabilitySetListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AvailabilitySetProperties { + #[doc = "Name of the availability set."] + #[serde(rename = "availabilitySetName", default, skip_serializing_if = "Option::is_none")] + pub availability_set_name: Option, + #[doc = "ARM Id of the vmmServer resource in which this resource resides."] + #[serde(rename = "vmmServerId", default, skip_serializing_if = "Option::is_none")] + pub vmm_server_id: Option, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl AvailabilitySetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Checkpoint { + #[doc = "Gets ID of parent of the checkpoint."] + #[serde(rename = "parentCheckpointID", default, skip_serializing_if = "Option::is_none")] + pub parent_checkpoint_id: Option, + #[doc = "Gets ID of the checkpoint."] + #[serde(rename = "checkpointID", default, skip_serializing_if = "Option::is_none")] + pub checkpoint_id: Option, + #[doc = "Gets name of the checkpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets description of the checkpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl Checkpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Clouds resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Cloud { + #[doc = "Defines the resource properties."] + pub properties: CloudProperties, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation")] + pub extended_location: ExtendedLocation, +} +impl Cloud { + pub fn new(properties: CloudProperties, location: String, extended_location: ExtendedLocation) -> Self { + Self { + properties, + id: None, + name: None, + type_: None, + location, + tags: None, + system_data: None, + extended_location, + } + } +} +#[doc = "Cloud Capacity model"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudCapacity { + #[doc = "CPUCount specifies the maximum number of CPUs that can be allocated in the cloud."] + #[serde(rename = "cpuCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_count: Option, + #[doc = "MemoryMB specifies a memory usage limit in megabytes."] + #[serde(rename = "memoryMB", default, skip_serializing_if = "Option::is_none")] + pub memory_mb: Option, + #[doc = "VMCount gives the max number of VMs that can be deployed in the cloud."] + #[serde(rename = "vmCount", default, skip_serializing_if = "Option::is_none")] + pub vm_count: Option, +} +impl CloudCapacity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Cloud inventory item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudInventoryItem { + #[serde(flatten)] + pub inventory_item_properties: InventoryItemProperties, +} +impl CloudInventoryItem { + pub fn new(inventory_item_properties: InventoryItemProperties) -> Self { + Self { inventory_item_properties } + } +} +#[doc = "List of Clouds."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudListResult { + #[doc = "List of Clouds."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl CloudListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CloudProperties { + #[doc = "Gets or sets the inventory Item ID for the resource."] + #[serde(rename = "inventoryItemId", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_id: Option, + #[doc = "Unique ID of the cloud."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "ARM Id of the vmmServer resource in which this resource resides."] + #[serde(rename = "vmmServerId", default, skip_serializing_if = "Option::is_none")] + pub vmm_server_id: Option, + #[doc = "Name of the cloud in VMMServer."] + #[serde(rename = "cloudName", default, skip_serializing_if = "Option::is_none")] + pub cloud_name: Option, + #[doc = "Cloud Capacity model"] + #[serde(rename = "cloudCapacity", default, skip_serializing_if = "Option::is_none")] + pub cloud_capacity: Option, + #[doc = "List of QoS policies available for the cloud."] + #[serde(rename = "storageQoSPolicies", default, skip_serializing_if = "Vec::is_empty")] + pub storage_qo_s_policies: Vec, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl CloudProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDefinition { + #[doc = "Service specific error code which serves as the substatus for the HTTP error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Description of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Internal error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorDefinition { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "Error definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The extended location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExtendedLocation { + #[doc = "The extended location type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The extended location name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ExtendedLocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HardwareProfile { + #[doc = "MemoryMB is the size of a virtual machine's memory, in MB."] + #[serde(rename = "memoryMB", default, skip_serializing_if = "Option::is_none")] + pub memory_mb: Option, + #[doc = "Gets or sets the number of vCPUs for the vm."] + #[serde(rename = "cpuCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_count: Option, + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[serde(rename = "limitCpuForMigration", default, skip_serializing_if = "Option::is_none")] + pub limit_cpu_for_migration: Option, + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[serde(rename = "dynamicMemoryEnabled", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_enabled: Option, + #[doc = "Gets or sets the max dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMaxMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_max_mb: Option, + #[doc = "Gets or sets the min dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMinMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_min_mb: Option, + #[doc = "Gets highly available property."] + #[serde(rename = "isHighlyAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_highly_available: Option, +} +impl HardwareProfile { + pub fn new() -> Self { + Self::default() + } +} +pub mod hardware_profile { + use super::*; + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LimitCpuForMigration { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DynamicMemoryEnabled { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HardwareProfileUpdate { + #[doc = "MemoryMB is the size of a virtual machine's memory, in MB."] + #[serde(rename = "memoryMB", default, skip_serializing_if = "Option::is_none")] + pub memory_mb: Option, + #[doc = "Gets or sets the number of vCPUs for the vm."] + #[serde(rename = "cpuCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_count: Option, + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[serde(rename = "limitCpuForMigration", default, skip_serializing_if = "Option::is_none")] + pub limit_cpu_for_migration: Option, + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[serde(rename = "dynamicMemoryEnabled", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_enabled: Option, + #[doc = "Gets or sets the max dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMaxMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_max_mb: Option, + #[doc = "Gets or sets the min dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMinMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_min_mb: Option, +} +impl HardwareProfileUpdate { + pub fn new() -> Self { + Self::default() + } +} +pub mod hardware_profile_update { + use super::*; + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LimitCpuForMigration { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DynamicMemoryEnabled { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } +} +#[doc = "Defines the inventory item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InventoryItem { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Defines the resource properties."] + pub properties: InventoryItemProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, +} +impl InventoryItem { + pub fn new(properties: InventoryItemProperties) -> Self { + Self { + proxy_resource: ProxyResource::default(), + properties, + system_data: None, + kind: None, + } + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InventoryItemDetails { + #[doc = "Gets or sets the inventory Item ID for the resource."] + #[serde(rename = "inventoryItemId", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_id: Option, + #[doc = "Gets or sets the Managed Object name in VMM for the resource."] + #[serde(rename = "inventoryItemName", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_name: Option, +} +impl InventoryItemDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InventoryItemProperties { + #[doc = "The inventory type."] + #[serde(rename = "inventoryType")] + pub inventory_type: InventoryType, + #[doc = "Gets the tracked resource id corresponding to the inventory resource."] + #[serde(rename = "managedResourceId", default, skip_serializing_if = "Option::is_none")] + pub managed_resource_id: Option, + #[doc = "Gets the UUID (which is assigned by VMM) for the inventory item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "Gets the Managed Object name in VMM for the inventory item."] + #[serde(rename = "inventoryItemName", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_name: Option, + #[doc = "Gets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl InventoryItemProperties { + pub fn new(inventory_type: InventoryType) -> Self { + Self { + inventory_type, + managed_resource_id: None, + uuid: None, + inventory_item_name: None, + provisioning_state: None, + } + } +} +#[doc = "List of InventoryItems."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InventoryItemsList { + #[doc = "Url to follow for getting next page of InventoryItems."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "Array of InventoryItems"] + pub value: Vec, +} +impl InventoryItemsList { + pub fn new(value: Vec) -> Self { + Self { next_link: None, value } + } +} +#[doc = "The inventory type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum InventoryType { + Cloud, + VirtualNetwork, + VirtualMachineTemplate, + VirtualMachine, +} +#[doc = "Network Interface model"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfaces { + #[doc = "Gets or sets the name of the network interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets the display name of the network interface as shown in the vmmServer. This is the fallback label for a NIC when the name is not set."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Gets or sets the nic ipv4 addresses."] + #[serde(rename = "ipv4Addresses", default, skip_serializing_if = "Vec::is_empty")] + pub ipv4_addresses: Vec, + #[doc = "Gets or sets the nic ipv6 addresses."] + #[serde(rename = "ipv6Addresses", default, skip_serializing_if = "Vec::is_empty")] + pub ipv6_addresses: Vec, + #[doc = "Gets or sets the nic MAC address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[doc = "Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to connect the nic."] + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[doc = "Gets or sets the name of the virtual network in vmmServer that the nic is connected to."] + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[doc = "Allocation method."] + #[serde(rename = "ipv4AddressType", default, skip_serializing_if = "Option::is_none")] + pub ipv4_address_type: Option, + #[doc = "Allocation method."] + #[serde(rename = "ipv6AddressType", default, skip_serializing_if = "Option::is_none")] + pub ipv6_address_type: Option, + #[doc = "Allocation method."] + #[serde(rename = "macAddressType", default, skip_serializing_if = "Option::is_none")] + pub mac_address_type: Option, + #[doc = "Gets or sets the nic id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, +} +impl NetworkInterfaces { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Network Interface model"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkInterfacesUpdate { + #[doc = "Gets or sets the name of the network interface."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets or sets the nic MAC address."] + #[serde(rename = "macAddress", default, skip_serializing_if = "Option::is_none")] + pub mac_address: Option, + #[doc = "Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to connect the nic."] + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[doc = "Allocation method."] + #[serde(rename = "ipv4AddressType", default, skip_serializing_if = "Option::is_none")] + pub ipv4_address_type: Option, + #[doc = "Allocation method."] + #[serde(rename = "ipv6AddressType", default, skip_serializing_if = "Option::is_none")] + pub ipv6_address_type: Option, + #[doc = "Allocation method."] + #[serde(rename = "macAddressType", default, skip_serializing_if = "Option::is_none")] + pub mac_address_type: Option, + #[doc = "Gets or sets the nic id."] + #[serde(rename = "nicId", default, skip_serializing_if = "Option::is_none")] + pub nic_id: Option, +} +impl NetworkInterfacesUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfile { + #[doc = "Gets or sets the list of network interfaces associated with the virtual machine."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, +} +impl NetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetworkProfileUpdate { + #[doc = "Gets or sets the list of network interfaces associated with the virtual machine."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, +} +impl NetworkProfileUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OsProfile { + #[doc = "Admin password of the virtual machine."] + #[serde(rename = "adminPassword", default, skip_serializing_if = "Option::is_none")] + pub admin_password: Option, + #[doc = "Gets or sets computer name."] + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[doc = "Defines the different types of VM guest operating systems."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Gets or sets os name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, +} +impl OsProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the different types of VM guest operating systems."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OsType { + Windows, + Linux, + Other, +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Object containing tags updates for patch operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourcePatch { + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl ResourcePatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Results of the request to list operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceProviderOperation { + #[doc = "Indicates whether the operation applies to data-plane."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Operation name, in format of {provider}/{resource}/{operation}."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Display metadata associated with the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +impl ResourceProviderOperation { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_provider_operation { + use super::*; + #[doc = "Display metadata associated with the operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The resource provider."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "Resource on which the operation is performed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "Type of operation: read, write, delete, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "Description of this operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Results of the request to list operations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceProviderOperationList { + #[doc = "List of Operations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ResourceProviderOperationList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the stop action properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StopVirtualMachineOptions { + #[doc = "Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false."] + #[serde(rename = "skipShutdown", default, skip_serializing_if = "Option::is_none")] + pub skip_shutdown: Option, +} +impl StopVirtualMachineOptions { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageProfile { + #[doc = "Gets or sets the list of virtual disks associated with the virtual machine."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +impl StorageProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageProfileUpdate { + #[doc = "Gets or sets the list of virtual disks associated with the virtual machine."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, +} +impl StorageProfileUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The StorageQoSPolicy definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageQoSPolicy { + #[doc = "The name of the policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the QoS policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The maximum IO operations per second."] + #[serde(rename = "iopsMaximum", default, skip_serializing_if = "Option::is_none")] + pub iops_maximum: Option, + #[doc = "The minimum IO operations per second."] + #[serde(rename = "iopsMinimum", default, skip_serializing_if = "Option::is_none")] + pub iops_minimum: Option, + #[doc = "The Bandwidth Limit for internet traffic."] + #[serde(rename = "bandwidthLimit", default, skip_serializing_if = "Option::is_none")] + pub bandwidth_limit: Option, + #[doc = "The underlying policy."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +impl StorageQoSPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The StorageQoSPolicyDetails definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StorageQoSPolicyDetails { + #[doc = "The name of the policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the QoS policy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl StorageQoSPolicyDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The VmmServers resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmServer { + #[doc = "Defines the resource properties."] + pub properties: VmmServerProperties, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation")] + pub extended_location: ExtendedLocation, +} +impl VmmServer { + pub fn new(properties: VmmServerProperties, location: String, extended_location: ExtendedLocation) -> Self { + Self { + properties, + id: None, + name: None, + type_: None, + location, + tags: None, + system_data: None, + extended_location, + } + } +} +#[doc = "List of VmmServers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VmmServerListResult { + #[doc = "List of VmmServers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VmmServerListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VmmServerProperties { + #[doc = "Credentials to connect to VMMServer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credentials: Option, + #[doc = "Fqdn is the hostname/ip of the vmmServer."] + pub fqdn: String, + #[doc = "Port is the port on which the vmmServer is listening."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Gets or sets the connection status to the vmmServer."] + #[serde(rename = "connectionStatus", default, skip_serializing_if = "Option::is_none")] + pub connection_status: Option, + #[doc = "Gets or sets any error message if connection to vmmServer is having any issue."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Unique ID of vmmServer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "Version is the version of the vmmSever."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VmmServerProperties { + pub fn new(fqdn: String) -> Self { + Self { + credentials: None, + fqdn, + port: None, + connection_status: None, + error_message: None, + uuid: None, + version: None, + provisioning_state: None, + } + } +} +pub mod vmm_server_properties { + use super::*; + #[doc = "Credentials to connect to VMMServer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Credentials { + #[doc = "Username to use to connect to VMMServer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "Credentials to use to connect to VMMServer."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + } + impl Credentials { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Virtual disk model"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualDisk { + #[doc = "Gets or sets the name of the disk."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets the display name of the virtual disk as shown in the vmmServer. This is the fallback label for a disk when the name is not set."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Gets or sets the disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "Gets or sets the disk total size."] + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[doc = "Gets or sets the max disk size."] + #[serde(rename = "maxDiskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub max_disk_size_gb: Option, + #[doc = "Gets or sets the disk bus."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bus: Option, + #[doc = "Gets or sets the disk lun."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[doc = "Gets or sets the disk bus type."] + #[serde(rename = "busType", default, skip_serializing_if = "Option::is_none")] + pub bus_type: Option, + #[doc = "Gets or sets the disk vhd type."] + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[doc = "Gets or sets the disk volume type."] + #[serde(rename = "volumeType", default, skip_serializing_if = "Option::is_none")] + pub volume_type: Option, + #[doc = "Gets the disk vhd format type."] + #[serde(rename = "vhdFormatType", default, skip_serializing_if = "Option::is_none")] + pub vhd_format_type: Option, + #[doc = "Gets or sets the disk id in the template."] + #[serde(rename = "templateDiskId", default, skip_serializing_if = "Option::is_none")] + pub template_disk_id: Option, + #[doc = "The StorageQoSPolicyDetails definition."] + #[serde(rename = "storageQoSPolicy", default, skip_serializing_if = "Option::is_none")] + pub storage_qo_s_policy: Option, + #[doc = "Gets or sets a value indicating diff disk."] + #[serde(rename = "createDiffDisk", default, skip_serializing_if = "Option::is_none")] + pub create_diff_disk: Option, +} +impl VirtualDisk { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_disk { + use super::*; + #[doc = "Gets or sets a value indicating diff disk."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateDiffDisk { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } +} +#[doc = "Virtual disk model"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualDiskUpdate { + #[doc = "Gets or sets the name of the disk."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Gets or sets the disk id."] + #[serde(rename = "diskId", default, skip_serializing_if = "Option::is_none")] + pub disk_id: Option, + #[doc = "Gets or sets the disk total size."] + #[serde(rename = "diskSizeGB", default, skip_serializing_if = "Option::is_none")] + pub disk_size_gb: Option, + #[doc = "Gets or sets the disk bus."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bus: Option, + #[doc = "Gets or sets the disk lun."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lun: Option, + #[doc = "Gets or sets the disk bus type."] + #[serde(rename = "busType", default, skip_serializing_if = "Option::is_none")] + pub bus_type: Option, + #[doc = "Gets or sets the disk vhd type."] + #[serde(rename = "vhdType", default, skip_serializing_if = "Option::is_none")] + pub vhd_type: Option, + #[doc = "The StorageQoSPolicyDetails definition."] + #[serde(rename = "storageQoSPolicy", default, skip_serializing_if = "Option::is_none")] + pub storage_qo_s_policy: Option, +} +impl VirtualDiskUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The VirtualMachines resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachine { + #[doc = "Defines the resource properties."] + pub properties: VirtualMachineProperties, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation")] + pub extended_location: ExtendedLocation, +} +impl VirtualMachine { + pub fn new(properties: VirtualMachineProperties, location: String, extended_location: ExtendedLocation) -> Self { + Self { + properties, + id: None, + name: None, + type_: None, + location, + tags: None, + system_data: None, + extended_location, + } + } +} +#[doc = "Defines the create checkpoint action properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineCreateCheckpoint { + #[doc = "Name of the checkpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Description of the checkpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl VirtualMachineCreateCheckpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the delete checkpoint action properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineDeleteCheckpoint { + #[doc = "ID of the checkpoint to be deleted."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl VirtualMachineDeleteCheckpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Virtual machine inventory item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineInventoryItem { + #[serde(flatten)] + pub inventory_item_properties: InventoryItemProperties, + #[doc = "Defines the different types of VM guest operating systems."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Gets or sets os name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "Gets the power state of the virtual machine."] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "Gets or sets the nic ip addresses."] + #[serde(rename = "ipAddresses", default, skip_serializing_if = "Vec::is_empty")] + pub ip_addresses: Vec, + #[doc = "Defines the resource properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cloud: Option, +} +impl VirtualMachineInventoryItem { + pub fn new(inventory_item_properties: InventoryItemProperties) -> Self { + Self { + inventory_item_properties, + os_type: None, + os_name: None, + power_state: None, + ip_addresses: Vec::new(), + cloud: None, + } + } +} +#[doc = "List of VirtualMachines."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineListResult { + #[doc = "List of VirtualMachines."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualMachineListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineProperties { + #[doc = "Gets or sets the inventory Item ID for the resource."] + #[serde(rename = "inventoryItemId", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_id: Option, + #[doc = "ARM Id of the vmmServer resource in which this resource resides."] + #[serde(rename = "vmmServerId", default, skip_serializing_if = "Option::is_none")] + pub vmm_server_id: Option, + #[doc = "ARM Id of the cloud resource to use for deploying the vm."] + #[serde(rename = "cloudId", default, skip_serializing_if = "Option::is_none")] + pub cloud_id: Option, + #[doc = "ARM Id of the template resource to use for deploying the vm."] + #[serde(rename = "templateId", default, skip_serializing_if = "Option::is_none")] + pub template_id: Option, + #[doc = "Type of checkpoint supported for the vm."] + #[serde(rename = "checkpointType", default, skip_serializing_if = "Option::is_none")] + pub checkpoint_type: Option, + #[doc = "Checkpoints in the vm."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub checkpoints: Vec, + #[doc = "Availability Sets in vm."] + #[serde(rename = "availabilitySets", default, skip_serializing_if = "Option::is_none")] + pub availability_sets: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "osProfile", default, skip_serializing_if = "Option::is_none")] + pub os_profile: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "hardwareProfile", default, skip_serializing_if = "Option::is_none")] + pub hardware_profile: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[doc = "VMName is the name of VM on the SCVMM server."] + #[serde(rename = "vmName", default, skip_serializing_if = "Option::is_none")] + pub vm_name: Option, + #[doc = "Unique ID of the virtual machine."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "Gets or sets the generation for the vm."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub generation: Option, + #[doc = "Gets the power state of the virtual machine."] + #[serde(rename = "powerState", default, skip_serializing_if = "Option::is_none")] + pub power_state: Option, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualMachineProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the restore checkpoint action properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineRestoreCheckpoint { + #[doc = "ID of the checkpoint to be restored to."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl VirtualMachineRestoreCheckpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The VirtualMachineTemplates resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineTemplate { + #[doc = "Defines the resource properties."] + pub properties: VirtualMachineTemplateProperties, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation")] + pub extended_location: ExtendedLocation, +} +impl VirtualMachineTemplate { + pub fn new(properties: VirtualMachineTemplateProperties, location: String, extended_location: ExtendedLocation) -> Self { + Self { + properties, + id: None, + name: None, + type_: None, + location, + tags: None, + system_data: None, + extended_location, + } + } +} +#[doc = "The Virtual machine template inventory item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualMachineTemplateInventoryItem { + #[serde(flatten)] + pub inventory_item_properties: InventoryItemProperties, + #[doc = "Gets or sets the desired number of vCPUs for the vm."] + #[serde(rename = "cpuCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_count: Option, + #[doc = "MemoryMB is the desired size of a virtual machine's memory, in MB."] + #[serde(rename = "memoryMB", default, skip_serializing_if = "Option::is_none")] + pub memory_mb: Option, + #[doc = "Defines the different types of VM guest operating systems."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Gets or sets os name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, +} +impl VirtualMachineTemplateInventoryItem { + pub fn new(inventory_item_properties: InventoryItemProperties) -> Self { + Self { + inventory_item_properties, + cpu_count: None, + memory_mb: None, + os_type: None, + os_name: None, + } + } +} +#[doc = "List of VirtualMachineTemplates."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineTemplateListResult { + #[doc = "List of VirtualMachineTemplates."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualMachineTemplateListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineTemplateProperties { + #[doc = "Gets or sets the inventory Item ID for the resource."] + #[serde(rename = "inventoryItemId", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_id: Option, + #[doc = "Unique ID of the virtual machine template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "ARM Id of the vmmServer resource in which this resource resides."] + #[serde(rename = "vmmServerId", default, skip_serializing_if = "Option::is_none")] + pub vmm_server_id: Option, + #[doc = "Defines the different types of VM guest operating systems."] + #[serde(rename = "osType", default, skip_serializing_if = "Option::is_none")] + pub os_type: Option, + #[doc = "Gets or sets os name."] + #[serde(rename = "osName", default, skip_serializing_if = "Option::is_none")] + pub os_name: Option, + #[doc = "Gets or sets computer name."] + #[serde(rename = "computerName", default, skip_serializing_if = "Option::is_none")] + pub computer_name: Option, + #[doc = "MemoryMB is the desired size of a virtual machine's memory, in MB."] + #[serde(rename = "memoryMB", default, skip_serializing_if = "Option::is_none")] + pub memory_mb: Option, + #[doc = "Gets or sets the desired number of vCPUs for the vm."] + #[serde(rename = "cpuCount", default, skip_serializing_if = "Option::is_none")] + pub cpu_count: Option, + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[serde(rename = "limitCpuForMigration", default, skip_serializing_if = "Option::is_none")] + pub limit_cpu_for_migration: Option, + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[serde(rename = "dynamicMemoryEnabled", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_enabled: Option, + #[doc = "Gets or sets a value indicating whether the vm template is customizable or not."] + #[serde(rename = "isCustomizable", default, skip_serializing_if = "Option::is_none")] + pub is_customizable: Option, + #[doc = "Gets or sets the max dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMaxMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_max_mb: Option, + #[doc = "Gets or sets the min dynamic memory for the vm."] + #[serde(rename = "dynamicMemoryMinMB", default, skip_serializing_if = "Option::is_none")] + pub dynamic_memory_min_mb: Option, + #[doc = "Gets highly available property."] + #[serde(rename = "isHighlyAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_highly_available: Option, + #[doc = "Gets or sets the generation for the vm."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub generation: Option, + #[doc = "Gets or sets the network interfaces of the template."] + #[serde(rename = "networkInterfaces", default, skip_serializing_if = "Vec::is_empty")] + pub network_interfaces: Vec, + #[doc = "Gets or sets the disks of the template."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub disks: Vec, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualMachineTemplateProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod virtual_machine_template_properties { + use super::*; + #[doc = "Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LimitCpuForMigration { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } + #[doc = "Gets or sets a value indicating whether to enable dynamic memory or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DynamicMemoryEnabled { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } + #[doc = "Gets or sets a value indicating whether the vm template is customizable or not."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum IsCustomizable { + #[serde(rename = "false")] + False, + #[serde(rename = "true")] + True, + } +} +#[doc = "Defines the virtualMachineUpdate."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineUpdate { + #[doc = "Defines the resource properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "Gets or sets the Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +impl VirtualMachineUpdate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualMachineUpdateProperties { + #[doc = "Defines the resource properties."] + #[serde(rename = "hardwareProfile", default, skip_serializing_if = "Option::is_none")] + pub hardware_profile: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "storageProfile", default, skip_serializing_if = "Option::is_none")] + pub storage_profile: Option, + #[doc = "Defines the resource properties."] + #[serde(rename = "networkProfile", default, skip_serializing_if = "Option::is_none")] + pub network_profile: Option, + #[doc = "Availability Sets in vm."] + #[serde(rename = "availabilitySets", default, skip_serializing_if = "Option::is_none")] + pub availability_sets: Option, +} +impl VirtualMachineUpdateProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The VirtualNetworks resource definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetwork { + #[doc = "Defines the resource properties."] + pub properties: VirtualNetworkProperties, + #[doc = "Resource Id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Resource Name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Resource Type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Gets or sets the location."] + pub location: String, + #[doc = "Resource tags"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, + #[doc = "The extended location."] + #[serde(rename = "extendedLocation")] + pub extended_location: ExtendedLocation, +} +impl VirtualNetwork { + pub fn new(properties: VirtualNetworkProperties, location: String, extended_location: ExtendedLocation) -> Self { + Self { + properties, + id: None, + name: None, + type_: None, + location, + tags: None, + system_data: None, + extended_location, + } + } +} +#[doc = "The Virtual network inventory item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkInventoryItem { + #[serde(flatten)] + pub inventory_item_properties: InventoryItemProperties, +} +impl VirtualNetworkInventoryItem { + pub fn new(inventory_item_properties: InventoryItemProperties) -> Self { + Self { inventory_item_properties } + } +} +#[doc = "List of VirtualNetworks."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkListResult { + #[doc = "List of VirtualNetworks."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Url to follow for getting next page of resources."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl VirtualNetworkListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Defines the resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkProperties { + #[doc = "Gets or sets the inventory Item ID for the resource."] + #[serde(rename = "inventoryItemId", default, skip_serializing_if = "Option::is_none")] + pub inventory_item_id: Option, + #[doc = "Unique ID of the virtual network."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[doc = "ARM Id of the vmmServer resource in which this resource resides."] + #[serde(rename = "vmmServerId", default, skip_serializing_if = "Option::is_none")] + pub vmm_server_id: Option, + #[doc = "Name of the virtual network in vmmServer."] + #[serde(rename = "networkName", default, skip_serializing_if = "Option::is_none")] + pub network_name: Option, + #[doc = "Gets or sets the provisioning state."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl VirtualNetworkProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/scvmm/src/package_2020_06_05_preview/operations.rs b/services/mgmt/scvmm/src/package_2020_06_05_preview/operations.rs new file mode 100644 index 0000000000..a81e64594b --- /dev/null +++ b/services/mgmt/scvmm/src/package_2020_06_05_preview/operations.rs @@ -0,0 +1,4770 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn availability_sets(&self) -> availability_sets::Client { + availability_sets::Client(self.clone()) + } + pub fn clouds(&self) -> clouds::Client { + clouds::Client(self.clone()) + } + pub fn inventory_items(&self) -> inventory_items::Client { + inventory_items::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } + pub fn virtual_machine_templates(&self) -> virtual_machine_templates::Client { + virtual_machine_templates::Client(self.clone()) + } + pub fn virtual_machines(&self) -> virtual_machines::Client { + virtual_machines::Client(self.clone()) + } + pub fn virtual_networks(&self) -> virtual_networks::Client { + virtual_networks::Client(self.clone()) + } + pub fn vmm_servers(&self) -> vmm_servers::Client { + vmm_servers::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + VmmServers_Get(#[from] vmm_servers::get::Error), + #[error(transparent)] + VmmServers_CreateOrUpdate(#[from] vmm_servers::create_or_update::Error), + #[error(transparent)] + VmmServers_Update(#[from] vmm_servers::update::Error), + #[error(transparent)] + VmmServers_Delete(#[from] vmm_servers::delete::Error), + #[error(transparent)] + VmmServers_ListByResourceGroup(#[from] vmm_servers::list_by_resource_group::Error), + #[error(transparent)] + VmmServers_ListBySubscription(#[from] vmm_servers::list_by_subscription::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), + #[error(transparent)] + Clouds_Get(#[from] clouds::get::Error), + #[error(transparent)] + Clouds_CreateOrUpdate(#[from] clouds::create_or_update::Error), + #[error(transparent)] + Clouds_Update(#[from] clouds::update::Error), + #[error(transparent)] + Clouds_Delete(#[from] clouds::delete::Error), + #[error(transparent)] + Clouds_ListByResourceGroup(#[from] clouds::list_by_resource_group::Error), + #[error(transparent)] + Clouds_ListBySubscription(#[from] clouds::list_by_subscription::Error), + #[error(transparent)] + VirtualNetworks_Get(#[from] virtual_networks::get::Error), + #[error(transparent)] + VirtualNetworks_CreateOrUpdate(#[from] virtual_networks::create_or_update::Error), + #[error(transparent)] + VirtualNetworks_Update(#[from] virtual_networks::update::Error), + #[error(transparent)] + VirtualNetworks_Delete(#[from] virtual_networks::delete::Error), + #[error(transparent)] + VirtualNetworks_ListByResourceGroup(#[from] virtual_networks::list_by_resource_group::Error), + #[error(transparent)] + VirtualNetworks_ListBySubscription(#[from] virtual_networks::list_by_subscription::Error), + #[error(transparent)] + VirtualMachines_Get(#[from] virtual_machines::get::Error), + #[error(transparent)] + VirtualMachines_CreateOrUpdate(#[from] virtual_machines::create_or_update::Error), + #[error(transparent)] + VirtualMachines_Update(#[from] virtual_machines::update::Error), + #[error(transparent)] + VirtualMachines_Delete(#[from] virtual_machines::delete::Error), + #[error(transparent)] + VirtualMachines_Stop(#[from] virtual_machines::stop::Error), + #[error(transparent)] + VirtualMachines_Start(#[from] virtual_machines::start::Error), + #[error(transparent)] + VirtualMachines_Restart(#[from] virtual_machines::restart::Error), + #[error(transparent)] + VirtualMachines_CreateCheckpoint(#[from] virtual_machines::create_checkpoint::Error), + #[error(transparent)] + VirtualMachines_DeleteCheckpoint(#[from] virtual_machines::delete_checkpoint::Error), + #[error(transparent)] + VirtualMachines_RestoreCheckpoint(#[from] virtual_machines::restore_checkpoint::Error), + #[error(transparent)] + VirtualMachines_ListByResourceGroup(#[from] virtual_machines::list_by_resource_group::Error), + #[error(transparent)] + VirtualMachines_ListBySubscription(#[from] virtual_machines::list_by_subscription::Error), + #[error(transparent)] + VirtualMachineTemplates_Get(#[from] virtual_machine_templates::get::Error), + #[error(transparent)] + VirtualMachineTemplates_CreateOrUpdate(#[from] virtual_machine_templates::create_or_update::Error), + #[error(transparent)] + VirtualMachineTemplates_Update(#[from] virtual_machine_templates::update::Error), + #[error(transparent)] + VirtualMachineTemplates_Delete(#[from] virtual_machine_templates::delete::Error), + #[error(transparent)] + VirtualMachineTemplates_ListByResourceGroup(#[from] virtual_machine_templates::list_by_resource_group::Error), + #[error(transparent)] + VirtualMachineTemplates_ListBySubscription(#[from] virtual_machine_templates::list_by_subscription::Error), + #[error(transparent)] + AvailabilitySets_Get(#[from] availability_sets::get::Error), + #[error(transparent)] + AvailabilitySets_CreateOrUpdate(#[from] availability_sets::create_or_update::Error), + #[error(transparent)] + AvailabilitySets_Update(#[from] availability_sets::update::Error), + #[error(transparent)] + AvailabilitySets_Delete(#[from] availability_sets::delete::Error), + #[error(transparent)] + AvailabilitySets_ListByResourceGroup(#[from] availability_sets::list_by_resource_group::Error), + #[error(transparent)] + AvailabilitySets_ListBySubscription(#[from] availability_sets::list_by_subscription::Error), + #[error(transparent)] + InventoryItems_Get(#[from] inventory_items::get::Error), + #[error(transparent)] + InventoryItems_Create(#[from] inventory_items::create::Error), + #[error(transparent)] + InventoryItems_Delete(#[from] inventory_items::delete::Error), + #[error(transparent)] + InventoryItems_ListByVmmServer(#[from] inventory_items::list_by_vmm_server::Error), +} +pub mod vmm_servers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a VMMServer."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + } + } + #[doc = "Implements VmmServers PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + body: body.into(), + } + } + #[doc = "Implements VmmServers PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + vmm_server_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + vmm_server_name: vmm_server_name.into(), + body: body.into(), + } + } + #[doc = "Implements VmmServers DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + force: None, + } + } + #[doc = "Implements GET VmmServers in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET VmmServers in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VmmServer), + Created201(models::VmmServer), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + pub(crate) body: models::VmmServer, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VmmServer), + Created201(models::VmmServer), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) vmm_server_name: String, + pub(crate) body: models::ResourcePatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServer = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/vmmServers", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VmmServerListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ScVmm/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ResourceProviderOperationList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod clouds { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a Cloud."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cloud_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cloud_name: cloud_name.into(), + } + } + #[doc = "Implements Clouds PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cloud_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cloud_name: cloud_name.into(), + body: body.into(), + } + } + #[doc = "Implements the Clouds PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + cloud_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + cloud_name: cloud_name.into(), + body: body.into(), + } + } + #[doc = "Implements Cloud resource DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + cloud_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + cloud_name: cloud_name.into(), + force: None, + } + } + #[doc = "Implements GET Clouds in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET Clouds in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cloud = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Cloud), + Created201(models::Cloud), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_name: String, + pub(crate) body: models::Cloud, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cloud = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cloud = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Cloud), + Created201(models::Cloud), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) cloud_name: String, + pub(crate) body: models::ResourcePatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cloud = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Cloud = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) cloud_name: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.cloud_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/clouds", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_networks { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a VirtualNetwork."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + } + } + #[doc = "Implements VirtualNetworks PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + body: body.into(), + } + } + #[doc = "Implements the VirtualNetworks PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_network_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_network_name: virtual_network_name.into(), + body: body.into(), + } + } + #[doc = "Implements VirtualNetwork DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_network_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_network_name: virtual_network_name.into(), + force: None, + } + } + #[doc = "Implements GET VirtualNetworks in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET VirtualNetworks in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetwork), + Created201(models::VirtualNetwork), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) body: models::VirtualNetwork, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualNetwork), + Created201(models::VirtualNetwork), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_network_name: String, + pub(crate) body: models::ResourcePatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetwork = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_network_name: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_network_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/virtualNetworks", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualNetworkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_machines { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a VirtualMachine."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + #[doc = "Implements VirtualMachines PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_name: virtual_machine_name.into(), + body: body.into(), + } + } + #[doc = "Implements the VirtualMachines PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + body: body.into(), + } + } + #[doc = "Implements VirtualMachine DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_name: virtual_machine_name.into(), + retain: None, + force: None, + } + } + #[doc = "Implements the operation to stop a virtual machine."] + pub fn stop( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + body: None, + } + } + #[doc = "Implements the operation to start a virtual machine."] + pub fn start( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> start::Builder { + start::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + #[doc = "Implements the operation to restart a virtual machine."] + pub fn restart( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> restart::Builder { + restart::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + } + } + #[doc = "Implements the operation to creates a checkpoint in a virtual machine."] + pub fn create_checkpoint( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> create_checkpoint::Builder { + create_checkpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + body: None, + } + } + #[doc = "Implements the operation to delete a checkpoint in a virtual machine."] + pub fn delete_checkpoint( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> delete_checkpoint::Builder { + delete_checkpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + body: None, + } + } + #[doc = "Implements the operation to restores to a checkpoint in a virtual machine."] + pub fn restore_checkpoint( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_name: impl Into, + ) -> restore_checkpoint::Builder { + restore_checkpoint::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_name: virtual_machine_name.into(), + body: None, + } + } + #[doc = "Implements GET VirtualMachines in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET VirtualMachines in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachine), + Created201(models::VirtualMachine), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: models::VirtualMachine, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachine), + Created201(models::VirtualMachine), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: models::VirtualMachineUpdate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachine = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_name: String, + pub(crate) retain: Option, + pub(crate) force: Option, + } + impl Builder { + pub fn retain(mut self, retain: bool) -> Self { + self.retain = Some(retain); + self + } + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(retain) = &self.retain { + url.query_pairs_mut().append_pair("retain", &retain.to_string()); + } + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/stop", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/start", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restart { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/restart", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_checkpoint { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/createCheckpoint", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_checkpoint { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/deleteCheckpoint", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod restore_checkpoint { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/restoreCheckpoint", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/virtualMachines", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod virtual_machine_templates { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a VirtualMachineTemplate."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_template_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_template_name: virtual_machine_template_name.into(), + } + } + #[doc = "Implements VirtualMachineTemplates PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_template_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_template_name: virtual_machine_template_name.into(), + body: body.into(), + } + } + #[doc = "Implements the VirtualMachineTemplate PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + virtual_machine_template_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + virtual_machine_template_name: virtual_machine_template_name.into(), + body: body.into(), + } + } + #[doc = "Implements VirtualMachineTemplate DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + virtual_machine_template_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + virtual_machine_template_name: virtual_machine_template_name.into(), + force: None, + } + } + #[doc = "Implements GET VirtualMachineTemplates in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET VirtualMachineTemplates in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_template_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineTemplate), + Created201(models::VirtualMachineTemplate), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_template_name: String, + pub(crate) body: models::VirtualMachineTemplate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::VirtualMachineTemplate), + Created201(models::VirtualMachineTemplate), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) virtual_machine_template_name: String, + pub(crate) body: models::ResourcePatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) virtual_machine_template_name: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.virtual_machine_template_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplateListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/virtualMachineTemplates", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::VirtualMachineTemplateListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod availability_sets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets an AvailabilitySet."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + availability_set_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + } + } + #[doc = "Implements AvailabilitySets PUT method."] + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + availability_set_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + body: body.into(), + } + } + #[doc = "Implements the AvailabilitySets PATCH method."] + pub fn update( + &self, + resource_group_name: impl Into, + subscription_id: impl Into, + availability_set_name: impl Into, + body: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + subscription_id: subscription_id.into(), + availability_set_name: availability_set_name.into(), + body: body.into(), + } + } + #[doc = "Implements AvailabilitySet DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + availability_set_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + availability_set_name: availability_set_name.into(), + force: None, + } + } + #[doc = "Implements GET AvailabilitySets in a resource group."] + pub fn list_by_resource_group( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + ) -> list_by_resource_group::Builder { + list_by_resource_group::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + } + } + #[doc = "Implements GET AvailabilitySets in a subscription."] + pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::Builder { + list_by_subscription::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AvailabilitySet), + Created201(models::AvailabilitySet), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) body: models::AvailabilitySet, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AvailabilitySet), + Created201(models::AvailabilitySet), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) subscription_id: String, + pub(crate) availability_set_name: String, + pub(crate) body: models::ResourcePatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySet = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) availability_set_name: String, + pub(crate) force: Option, + } + impl Builder { + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.availability_set_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + if let Some(force) = &self.force { + url.query_pairs_mut().append_pair("force", &force.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_resource_group { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_subscription { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.ScVmm/availabilitySets", + self.client.endpoint(), + &self.subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AvailabilitySetListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod inventory_items { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Implements GET InventoryItem method."] + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + inventory_item_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + inventory_item_name: inventory_item_name.into(), + } + } + #[doc = "Implements InventoryItem PUT method."] + pub fn create( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + inventory_item_name: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + inventory_item_name: inventory_item_name.into(), + body: None, + } + } + #[doc = "Implements inventoryItem DELETE method."] + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + inventory_item_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + inventory_item_name: inventory_item_name.into(), + } + } + #[doc = "Implements GET for the list of Inventory Items in the VMMServer."] + pub fn list_by_vmm_server( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + vmm_server_name: impl Into, + ) -> list_by_vmm_server::Builder { + list_by_vmm_server::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + vmm_server_name: vmm_server_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + pub(crate) inventory_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name, + &self.inventory_item_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InventoryItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + pub(crate) inventory_item_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name, + &self.inventory_item_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InventoryItem = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + pub(crate) inventory_item_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name, + &self.inventory_item_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_vmm_server { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) vmm_server_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.vmm_server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-06-05-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::InventoryItemsList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/search/Cargo.toml b/services/mgmt/search/Cargo.toml index e9d746b0ec..002d3fb2d6 100644 --- a/services/mgmt/search/Cargo.toml +++ b/services/mgmt/search/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_search" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/security/Cargo.toml b/services/mgmt/security/Cargo.toml index 103ed4eb72..141b0477bf 100644 --- a/services/mgmt/security/Cargo.toml +++ b/services/mgmt/security/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_security" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/security/src/package_2018_06_only/models.rs b/services/mgmt/security/src/package_2018_06_only/models.rs index 206d5bc741..3a943acf6d 100644 --- a/services/mgmt/security/src/package_2018_06_only/models.rs +++ b/services/mgmt/security/src/package_2018_06_only/models.rs @@ -53,7 +53,7 @@ impl ErrorAdditionalInfo { Self::default() } } -#[doc = "Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] +#[doc = "Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct Pricing { #[serde(flatten)] @@ -81,7 +81,7 @@ impl PricingList { #[doc = "Pricing properties for the relevant scope"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PricingProperties { - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[serde(rename = "pricingTier")] pub pricing_tier: pricing_properties::PricingTier, #[doc = "The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S)."] @@ -98,7 +98,7 @@ impl PricingProperties { } pub mod pricing_properties { use super::*; - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum PricingTier { Free, diff --git a/services/mgmt/security/src/package_2022_03/models.rs b/services/mgmt/security/src/package_2022_03/models.rs index db2b9757a3..d4bac9ed61 100644 --- a/services/mgmt/security/src/package_2022_03/models.rs +++ b/services/mgmt/security/src/package_2022_03/models.rs @@ -53,7 +53,7 @@ impl ErrorAdditionalInfo { Self::default() } } -#[doc = "Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] +#[doc = "Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct Pricing { #[serde(flatten)] @@ -81,7 +81,7 @@ impl PricingList { #[doc = "Pricing properties for the relevant scope"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PricingProperties { - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[serde(rename = "pricingTier")] pub pricing_tier: pricing_properties::PricingTier, #[doc = "The sub-plan selected for a Standard pricing configuration, when more than one sub-plan is available. Each sub-plan enables a set of security features. When not specified, full plan is applied."] @@ -102,7 +102,7 @@ impl PricingProperties { } pub mod pricing_properties { use super::*; - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum PricingTier { Free, diff --git a/services/mgmt/security/src/package_composite_v1/models.rs b/services/mgmt/security/src/package_composite_v1/models.rs index 80e78e7f9b..f6ad2d3f5c 100644 --- a/services/mgmt/security/src/package_composite_v1/models.rs +++ b/services/mgmt/security/src/package_composite_v1/models.rs @@ -808,7 +808,7 @@ pub mod automation_action { Workspace, } } -#[doc = "The target Event Hub to which event data will be exported. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionEventHub { #[serde(flatten)] @@ -833,7 +833,7 @@ impl AutomationActionEventHub { } } } -#[doc = "The logic app action that should be triggered. To learn more about Security Center's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] +#[doc = "The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionLogicApp { #[serde(flatten)] @@ -854,7 +854,7 @@ impl AutomationActionLogicApp { } } } -#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionWorkspace { #[serde(flatten)] diff --git a/services/mgmt/security/src/package_composite_v2/models.rs b/services/mgmt/security/src/package_composite_v2/models.rs index 4a3d8ed1a9..5a0ea3d9bb 100644 --- a/services/mgmt/security/src/package_composite_v2/models.rs +++ b/services/mgmt/security/src/package_composite_v2/models.rs @@ -791,7 +791,7 @@ pub mod automation_action { Workspace, } } -#[doc = "The target Event Hub to which event data will be exported. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionEventHub { #[serde(flatten)] @@ -816,7 +816,7 @@ impl AutomationActionEventHub { } } } -#[doc = "The logic app action that should be triggered. To learn more about Security Center's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] +#[doc = "The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionLogicApp { #[serde(flatten)] @@ -837,7 +837,7 @@ impl AutomationActionLogicApp { } } } -#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionWorkspace { #[serde(flatten)] @@ -3160,7 +3160,7 @@ pub enum PermissionProperty { GcpSecurityCenterAdminViewer, } pub type PortNumber = i64; -#[doc = "Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] +#[doc = "Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct Pricing { #[serde(flatten)] @@ -3188,7 +3188,7 @@ impl PricingList { #[doc = "Pricing properties for the relevant scope"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PricingProperties { - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[serde(rename = "pricingTier")] pub pricing_tier: pricing_properties::PricingTier, #[doc = "The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S)."] @@ -3205,7 +3205,7 @@ impl PricingProperties { } pub mod pricing_properties { use super::*; - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum PricingTier { Free, diff --git a/services/mgmt/security/src/package_composite_v3/models.rs b/services/mgmt/security/src/package_composite_v3/models.rs index 5a958ef957..15e838ce74 100644 --- a/services/mgmt/security/src/package_composite_v3/models.rs +++ b/services/mgmt/security/src/package_composite_v3/models.rs @@ -966,7 +966,7 @@ pub mod automation_action { Workspace, } } -#[doc = "The target Event Hub to which event data will be exported. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionEventHub { #[serde(flatten)] @@ -991,7 +991,7 @@ impl AutomationActionEventHub { } } } -#[doc = "The logic app action that should be triggered. To learn more about Security Center's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] +#[doc = "The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionLogicApp { #[serde(flatten)] @@ -1012,7 +1012,7 @@ impl AutomationActionLogicApp { } } } -#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Security Center continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] +#[doc = "The\u{a0}Log\u{a0}Analytics\u{a0}Workspace\u{a0}to\u{a0}which\u{a0}event data will be exported. Security alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AutomationActionWorkspace { #[serde(flatten)] @@ -3452,7 +3452,7 @@ pub enum PermissionProperty { GcpSecurityCenterAdminViewer, } pub type PortNumber = i64; -#[doc = "Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] +#[doc = "Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct Pricing { #[serde(flatten)] @@ -3480,7 +3480,7 @@ impl PricingList { #[doc = "Pricing properties for the relevant scope"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PricingProperties { - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[serde(rename = "pricingTier")] pub pricing_tier: pricing_properties::PricingTier, #[doc = "The sub-plan selected for a Standard pricing configuration, when more than one sub-plan is available. Each sub-plan enables a set of security features. When not specified, full plan is applied."] @@ -3501,7 +3501,7 @@ impl PricingProperties { } pub mod pricing_properties { use super::*; - #[doc = "The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] + #[doc = "The pricing tier value. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum PricingTier { Free, diff --git a/services/mgmt/securityandcompliance/Cargo.toml b/services/mgmt/securityandcompliance/Cargo.toml index b18604a851..65bc575aa0 100644 --- a/services/mgmt/securityandcompliance/Cargo.toml +++ b/services/mgmt/securityandcompliance/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_securityandcompliance" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/securityinsights/Cargo.toml b/services/mgmt/securityinsights/Cargo.toml index 23f2495c8a..ee6d99a999 100644 --- a/services/mgmt/securityinsights/Cargo.toml +++ b/services/mgmt/securityinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_securityinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/securityinsights/src/package_2020_01/models.rs b/services/mgmt/securityinsights/src/package_2020_01/models.rs index 15c2cdf6a4..32bac9de97 100644 --- a/services/mgmt/securityinsights/src/package_2020_01/models.rs +++ b/services/mgmt/securityinsights/src/package_2020_01/models.rs @@ -699,6 +699,9 @@ pub struct FusionAlertRuleTemplateProperties { #[doc = "The display name for alert rule template."] #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] pub display_name: Option, + #[doc = "The time that this alert rule template was last updated."] + #[serde(rename = "lastUpdatedDateUTC", default, skip_serializing_if = "Option::is_none")] + pub last_updated_date_utc: Option, #[doc = "The required data connectors for this template"] #[serde(rename = "requiredDataConnectors", default, skip_serializing_if = "Vec::is_empty")] pub required_data_connectors: Vec, @@ -1189,6 +1192,9 @@ pub struct MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties { #[doc = "The display name for alert rule template."] #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] pub display_name: Option, + #[doc = "The time that this alert rule template was last updated."] + #[serde(rename = "lastUpdatedDateUTC", default, skip_serializing_if = "Option::is_none")] + pub last_updated_date_utc: Option, #[doc = "The required data connectors for this template"] #[serde(rename = "requiredDataConnectors", default, skip_serializing_if = "Vec::is_empty")] pub required_data_connectors: Vec, @@ -1215,6 +1221,7 @@ impl MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties { created_date_utc: None, description: None, display_name: None, + last_updated_date_utc: None, required_data_connectors: Vec::new(), status: None, display_names_filter: Vec::new(), @@ -1546,6 +1553,9 @@ pub struct ScheduledAlertRuleTemplateProperties { #[doc = "The display name for alert rule template."] #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] pub display_name: Option, + #[doc = "The time that this alert rule template was last updated."] + #[serde(rename = "lastUpdatedDateUTC", default, skip_serializing_if = "Option::is_none")] + pub last_updated_date_utc: Option, #[doc = "The required data connectors for this template"] #[serde(rename = "requiredDataConnectors", default, skip_serializing_if = "Vec::is_empty")] pub required_data_connectors: Vec, diff --git a/services/mgmt/serialconsole/Cargo.toml b/services/mgmt/serialconsole/Cargo.toml index 8f8d958984..bb77b2a77f 100644 --- a/services/mgmt/serialconsole/Cargo.toml +++ b/services/mgmt/serialconsole/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_serialconsole" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/servicebus/Cargo.toml b/services/mgmt/servicebus/Cargo.toml index 7fb55ea34f..822ad1c451 100644 --- a/services/mgmt/servicebus/Cargo.toml +++ b/services/mgmt/servicebus/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_servicebus" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/servicefabricmesh/Cargo.toml b/services/mgmt/servicefabricmesh/Cargo.toml index f3742c3461..d3f27a00da 100644 --- a/services/mgmt/servicefabricmesh/Cargo.toml +++ b/services/mgmt/servicefabricmesh/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_servicefabricmesh" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/servicelinker/Cargo.toml b/services/mgmt/servicelinker/Cargo.toml index 02ce5de029..57f9576358 100644 --- a/services/mgmt/servicelinker/Cargo.toml +++ b/services/mgmt/servicelinker/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_servicelinker" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,12 +24,13 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-11-01-preview"] +features = ["no-default-tag", "package-2021-11-01-preview", "package-2022-01-01-preview"] [features] -default = ["package-2022-01-01-preview", "enable_reqwest"] +default = ["package-2022-05-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] "package-2021-11-01-preview" = [] "package-2022-01-01-preview" = [] +"package-2022-05-01" = [] diff --git a/services/mgmt/servicelinker/README.md b/services/mgmt/servicelinker/README.md index 520e6a3434..2891355dff 100644 --- a/services/mgmt/servicelinker/README.md +++ b/services/mgmt/servicelinker/README.md @@ -6,9 +6,10 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/servicelin To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2022-01-01-preview`. +The default tag is `package-2022-05-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: - `package-2021-11-01-preview` has 8 operations from 1 API versions: `2021-11-01-preview`. Use crate feature `package-2021-11-01-preview` to enable. The operations will be in the `package_2021_11_01_preview` module. -- `package-2022-01-01-preview` has 8 operations from 1 API versions: `2022-01-01-preview`. Use crate feature `package-2022-01-01-preview` to enable. The operations will be in the `package_2022_01_01_preview` module. \ No newline at end of file +- `package-2022-01-01-preview` has 8 operations from 1 API versions: `2022-01-01-preview`. Use crate feature `package-2022-01-01-preview` to enable. The operations will be in the `package_2022_01_01_preview` module. +- `package-2022-05-01` has 8 operations from 1 API versions: `2022-05-01`. Use crate feature `package-2022-05-01` to enable. The operations will be in the `package_2022_05_01` module. \ No newline at end of file diff --git a/services/mgmt/servicelinker/src/lib.rs b/services/mgmt/servicelinker/src/lib.rs index f16ce37f67..cde29106a8 100644 --- a/services/mgmt/servicelinker/src/lib.rs +++ b/services/mgmt/servicelinker/src/lib.rs @@ -11,3 +11,7 @@ pub use package_2021_11_01_preview::{models, operations, operations::Client, ope pub mod package_2022_01_01_preview; #[cfg(all(feature = "package-2022-01-01-preview", not(feature = "no-default-tag")))] pub use package_2022_01_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-05-01")] +pub mod package_2022_05_01; +#[cfg(all(feature = "package-2022-05-01", not(feature = "no-default-tag")))] +pub use package_2022_05_01::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; diff --git a/services/mgmt/servicelinker/src/package_2022_05_01/mod.rs b/services/mgmt/servicelinker/src/package_2022_05_01/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/mgmt/servicelinker/src/package_2022_05_01/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/mgmt/servicelinker/src/package_2022_05_01/models.rs b/services/mgmt/servicelinker/src/package_2022_05_01/models.rs new file mode 100644 index 0000000000..f51b9f2d8b --- /dev/null +++ b/services/mgmt/servicelinker/src/package_2022_05_01/models.rs @@ -0,0 +1,756 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The authentication info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthInfoBase { + #[doc = "The authentication type."] + #[serde(rename = "authType")] + pub auth_type: AuthType, +} +impl AuthInfoBase { + pub fn new(auth_type: AuthType) -> Self { + Self { auth_type } + } +} +#[doc = "The authentication type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AuthType { + #[serde(rename = "systemAssignedIdentity")] + SystemAssignedIdentity, + #[serde(rename = "userAssignedIdentity")] + UserAssignedIdentity, + #[serde(rename = "servicePrincipalSecret")] + ServicePrincipalSecret, + #[serde(rename = "servicePrincipalCertificate")] + ServicePrincipalCertificate, + #[serde(rename = "secret")] + Secret, +} +#[doc = "The resource properties when type is Azure Key Vault"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureKeyVaultProperties { + #[serde(flatten)] + pub azure_resource_properties_base: AzureResourcePropertiesBase, + #[doc = "True if connect via Kubernetes CSI Driver."] + #[serde(rename = "connectAsKubernetesCsiDriver", default, skip_serializing_if = "Option::is_none")] + pub connect_as_kubernetes_csi_driver: Option, +} +impl AzureKeyVaultProperties { + pub fn new(azure_resource_properties_base: AzureResourcePropertiesBase) -> Self { + Self { + azure_resource_properties_base, + connect_as_kubernetes_csi_driver: None, + } + } +} +#[doc = "The azure resource info when target service type is AzureResource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResource { + #[serde(flatten)] + pub target_service_base: TargetServiceBase, + #[doc = "The Id of azure resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The azure resource properties"] + #[serde(rename = "resourceProperties", default, skip_serializing_if = "Option::is_none")] + pub resource_properties: Option, +} +impl AzureResource { + pub fn new(target_service_base: TargetServiceBase) -> Self { + Self { + target_service_base, + id: None, + resource_properties: None, + } + } +} +#[doc = "The azure resource properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourcePropertiesBase { + #[doc = "The azure resource type."] + #[serde(rename = "type")] + pub type_: AzureResourceType, +} +impl AzureResourcePropertiesBase { + pub fn new(type_: AzureResourceType) -> Self { + Self { type_ } + } +} +#[doc = "The azure resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureResourceType { + KeyVault, +} +#[doc = "The service properties when target service type is ConfluentBootstrapServer"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfluentBootstrapServer { + #[serde(flatten)] + pub target_service_base: TargetServiceBase, + #[doc = "The endpoint of service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl ConfluentBootstrapServer { + pub fn new(target_service_base: TargetServiceBase) -> Self { + Self { + target_service_base, + endpoint: None, + } + } +} +#[doc = "The service properties when target service type is ConfluentSchemaRegistry"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfluentSchemaRegistry { + #[serde(flatten)] + pub target_service_base: TargetServiceBase, + #[doc = "The endpoint of service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl ConfluentSchemaRegistry { + pub fn new(target_service_base: TargetServiceBase) -> Self { + Self { + target_service_base, + endpoint: None, + } + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error detail."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetail { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorDetail { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error detail."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The secret info when type is keyVaultSecretReference. It's for scenario that user provides a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultSecretReferenceSecretInfo { + #[serde(flatten)] + pub secret_info_base: SecretInfoBase, + #[doc = "Name of the Key Vault secret."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Version of the Key Vault secret."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl KeyVaultSecretReferenceSecretInfo { + pub fn new(secret_info_base: SecretInfoBase) -> Self { + Self { + secret_info_base, + name: None, + version: None, + } + } +} +#[doc = "The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct KeyVaultSecretUriSecretInfo { + #[serde(flatten)] + pub secret_info_base: SecretInfoBase, + #[doc = "URI to the keyvault secret"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl KeyVaultSecretUriSecretInfo { + pub fn new(secret_info_base: SecretInfoBase) -> Self { + Self { + secret_info_base, + value: None, + } + } +} +#[doc = "The list of Linker."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkerList { + #[doc = "The link used to get the next page of Linker list."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "The list of Linkers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl LinkerList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A linker to be updated."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkerPatch { + #[doc = "The properties of the linker."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl LinkerPatch { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of the linker."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkerProperties { + #[doc = "The target service properties"] + #[serde(rename = "targetService", default, skip_serializing_if = "Option::is_none")] + pub target_service: Option, + #[doc = "The authentication info"] + #[serde(rename = "authInfo", default, skip_serializing_if = "Option::is_none")] + pub auth_info: Option, + #[doc = "The application client type"] + #[serde(rename = "clientType", default, skip_serializing_if = "Option::is_none")] + pub client_type: Option, + #[doc = "The provisioning state. "] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "The VNet solution for linker"] + #[serde(rename = "vNetSolution", default, skip_serializing_if = "Option::is_none")] + pub v_net_solution: Option, + #[doc = "An option to store secret value in secure place"] + #[serde(rename = "secretStore", default, skip_serializing_if = "Option::is_none")] + pub secret_store: Option, + #[doc = "connection scope in source service."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, +} +impl LinkerProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod linker_properties { + use super::*; + #[doc = "The application client type"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClientType { + #[serde(rename = "none")] + None, + #[serde(rename = "dotnet")] + Dotnet, + #[serde(rename = "java")] + Java, + #[serde(rename = "python")] + Python, + #[serde(rename = "go")] + Go, + #[serde(rename = "php")] + Php, + #[serde(rename = "ruby")] + Ruby, + #[serde(rename = "django")] + Django, + #[serde(rename = "nodejs")] + Nodejs, + #[serde(rename = "springBoot")] + SpringBoot, + } +} +#[doc = "Linker of source and target resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkerResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "The properties of the linker."] + pub properties: LinkerProperties, + #[doc = "Metadata pertaining to creation and last modification of the resource."] + #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] + pub system_data: Option, +} +impl LinkerResource { + pub fn new(properties: LinkerProperties) -> Self { + Self { + proxy_resource: ProxyResource::default(), + properties, + system_data: None, + } + } +} +#[doc = "Details of a REST API operation, returned from the Resource Provider Operations API"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Operation { + #[doc = "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations."] + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[doc = "Localized display information for this particular operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[serde(rename = "actionType", default, skip_serializing_if = "Option::is_none")] + pub action_type: Option, +} +impl Operation { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation { + use super::*; + #[doc = "Localized display information for this particular operation."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Display { + #[doc = "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[doc = "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[doc = "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\"."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[doc = "The short, localized friendly description of the operation; suitable for tool tips and detailed views."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } + impl Display { + pub fn new() -> Self { + Self::default() + } + } + #[doc = "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\""] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Origin { + #[serde(rename = "user")] + User, + #[serde(rename = "system")] + System, + #[serde(rename = "user,system")] + UserSystem, + } + #[doc = "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ActionType { + Internal, + } +} +#[doc = "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationListResult { + #[doc = "List of operations supported by the resource provider"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "URL to get the next set of operation list results (if there are any)."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OperationListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The authentication info when authType is secret"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretAuthInfo { + #[serde(flatten)] + pub auth_info_base: AuthInfoBase, + #[doc = "Username or account name for secret auth."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The secret info"] + #[serde(rename = "secretInfo", default, skip_serializing_if = "Option::is_none")] + pub secret_info: Option, +} +impl SecretAuthInfo { + pub fn new(auth_info_base: AuthInfoBase) -> Self { + Self { + auth_info_base, + name: None, + secret_info: None, + } + } +} +#[doc = "The secret info"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretInfoBase { + #[doc = "The secret type."] + #[serde(rename = "secretType")] + pub secret_type: SecretType, +} +impl SecretInfoBase { + pub fn new(secret_type: SecretType) -> Self { + Self { secret_type } + } +} +#[doc = "An option to store secret value in secure place"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SecretStore { + #[doc = "The key vault id to store secret"] + #[serde(rename = "keyVaultId", default, skip_serializing_if = "Option::is_none")] + pub key_vault_id: Option, +} +impl SecretStore { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The secret type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SecretType { + #[serde(rename = "rawValue")] + RawValue, + #[serde(rename = "keyVaultSecretUri")] + KeyVaultSecretUri, + #[serde(rename = "keyVaultSecretReference")] + KeyVaultSecretReference, +} +#[doc = "The authentication info when authType is servicePrincipal certificate"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicePrincipalCertificateAuthInfo { + #[serde(flatten)] + pub auth_info_base: AuthInfoBase, + #[doc = "Application clientId for servicePrincipal auth."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Principal Id for servicePrincipal auth."] + #[serde(rename = "principalId")] + pub principal_id: String, + #[doc = "ServicePrincipal certificate for servicePrincipal auth."] + pub certificate: String, +} +impl ServicePrincipalCertificateAuthInfo { + pub fn new(auth_info_base: AuthInfoBase, client_id: String, principal_id: String, certificate: String) -> Self { + Self { + auth_info_base, + client_id, + principal_id, + certificate, + } + } +} +#[doc = "The authentication info when authType is servicePrincipal secret"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicePrincipalSecretAuthInfo { + #[serde(flatten)] + pub auth_info_base: AuthInfoBase, + #[doc = "ServicePrincipal application clientId for servicePrincipal auth."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Principal Id for servicePrincipal auth."] + #[serde(rename = "principalId")] + pub principal_id: String, + #[doc = "Secret for servicePrincipal auth."] + pub secret: String, +} +impl ServicePrincipalSecretAuthInfo { + pub fn new(auth_info_base: AuthInfoBase, client_id: String, principal_id: String, secret: String) -> Self { + Self { + auth_info_base, + client_id, + principal_id, + secret, + } + } +} +#[doc = "A configuration item for source resource"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SourceConfiguration { + #[doc = "The name of setting."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The value of setting"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SourceConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Configurations for source resource, include appSettings, connectionString and serviceBindings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SourceConfigurationResult { + #[doc = "The configuration properties for source resource."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub configurations: Vec, +} +impl SourceConfigurationResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The authentication info when authType is systemAssignedIdentity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemAssignedIdentityAuthInfo { + #[serde(flatten)] + pub auth_info_base: AuthInfoBase, +} +impl SystemAssignedIdentityAuthInfo { + pub fn new(auth_info_base: AuthInfoBase) -> Self { + Self { auth_info_base } + } +} +#[doc = "The target service properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetServiceBase { + #[doc = "The target service type."] + #[serde(rename = "type")] + pub type_: TargetServiceType, +} +impl TargetServiceBase { + pub fn new(type_: TargetServiceType) -> Self { + Self { type_ } + } +} +#[doc = "The target service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TargetServiceType { + AzureResource, + ConfluentBootstrapServer, + ConfluentSchemaRegistry, +} +#[doc = "The authentication info when authType is userAssignedIdentity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserAssignedIdentityAuthInfo { + #[serde(flatten)] + pub auth_info_base: AuthInfoBase, + #[doc = "Client Id for userAssignedIdentity."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Subscription id for userAssignedIdentity."] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +impl UserAssignedIdentityAuthInfo { + pub fn new(auth_info_base: AuthInfoBase) -> Self { + Self { + auth_info_base, + client_id: None, + subscription_id: None, + } + } +} +#[doc = "The VNet solution for linker"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VNetSolution { + #[doc = "Type of VNet solution."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl VNetSolution { + pub fn new() -> Self { + Self::default() + } +} +pub mod v_net_solution { + use super::*; + #[doc = "Type of VNet solution."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "serviceEndpoint")] + ServiceEndpoint, + #[serde(rename = "privateLink")] + PrivateLink, + } +} +#[doc = "The validation result for a linker."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidateResult { + #[doc = "The linker name."] + #[serde(rename = "linkerName", default, skip_serializing_if = "Option::is_none")] + pub linker_name: Option, + #[doc = "A boolean value indicating whether the connection is available or not"] + #[serde(rename = "isConnectionAvailable", default, skip_serializing_if = "Option::is_none")] + pub is_connection_available: Option, + #[doc = "The start time of the validation report."] + #[serde(rename = "reportStartTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub report_start_time_utc: Option, + #[doc = "The end time of the validation report."] + #[serde(rename = "reportEndTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub report_end_time_utc: Option, + #[doc = "The resource id of the linker source application."] + #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")] + pub source_id: Option, + #[doc = "The resource Id of target service."] + #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")] + pub target_id: Option, + #[doc = "The authentication type."] + #[serde(rename = "authType", default, skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + #[doc = "The detail of validation result"] + #[serde(rename = "validationDetail", default, skip_serializing_if = "Vec::is_empty")] + pub validation_detail: Vec, +} +impl ValidateResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The validation item for a linker."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ValidationResultItem { + #[doc = "The validation item name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The display name of validation item"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The result of validation"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub result: Option, + #[doc = "The error message of validation result"] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "The error code of validation result"] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, +} +impl ValidationResultItem { + pub fn new() -> Self { + Self::default() + } +} +pub mod validation_result_item { + use super::*; + #[doc = "The result of validation"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Result { + #[serde(rename = "success")] + Success, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "warning")] + Warning, + } +} +#[doc = "The secret info when type is rawValue. It's for scenarios that user input the secret."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValueSecretInfo { + #[serde(flatten)] + pub secret_info_base: SecretInfoBase, + #[doc = "The actual value of the secret."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl ValueSecretInfo { + pub fn new(secret_info_base: SecretInfoBase) -> Self { + Self { + secret_info_base, + value: None, + } + } +} +#[doc = "Metadata pertaining to creation and last modification of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemData { + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The type of identity that created the resource."] + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[doc = "The timestamp of resource creation (UTC)."] + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[doc = "The identity that last modified the resource."] + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[doc = "The type of identity that last modified the resource."] + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[doc = "The timestamp of resource last modification (UTC)"] + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemData { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_data { + use super::*; + #[doc = "The type of identity that created the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[doc = "The type of identity that last modified the resource."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/servicelinker/src/package_2022_05_01/operations.rs b/services/mgmt/servicelinker/src/package_2022_05_01/operations.rs new file mode 100644 index 0000000000..7c8f97f340 --- /dev/null +++ b/services/mgmt/servicelinker/src/package_2022_05_01/operations.rs @@ -0,0 +1,807 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn linker(&self) -> linker::Client { + linker::Client(self.clone()) + } + pub fn operations(&self) -> operations::Client { + operations::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Linker_List(#[from] linker::list::Error), + #[error(transparent)] + Linker_Get(#[from] linker::get::Error), + #[error(transparent)] + Linker_CreateOrUpdate(#[from] linker::create_or_update::Error), + #[error(transparent)] + Linker_Update(#[from] linker::update::Error), + #[error(transparent)] + Linker_Delete(#[from] linker::delete::Error), + #[error(transparent)] + Linker_Validate(#[from] linker::validate::Error), + #[error(transparent)] + Linker_ListConfigurations(#[from] linker::list_configurations::Error), + #[error(transparent)] + Operations_List(#[from] operations::list::Error), +} +pub mod linker { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self, resource_uri: impl Into) -> list::Builder { + list::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + } + } + pub fn get(&self, resource_uri: impl Into, linker_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + } + } + pub fn create_or_update( + &self, + resource_uri: impl Into, + linker_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + parameters: parameters.into(), + } + } + pub fn update( + &self, + resource_uri: impl Into, + linker_name: impl Into, + parameters: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + parameters: parameters.into(), + } + } + pub fn delete(&self, resource_uri: impl Into, linker_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + } + } + pub fn validate(&self, resource_uri: impl Into, linker_name: impl Into) -> validate::Builder { + validate::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + } + } + pub fn list_configurations(&self, resource_uri: impl Into, linker_name: impl Into) -> list_configurations::Builder { + list_configurations::Builder { + client: self.0.clone(), + resource_uri: resource_uri.into(), + linker_name: linker_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers", + self.client.endpoint(), + &self.resource_uri + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LinkerResource), + Created201(models::LinkerResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + pub(crate) parameters: models::LinkerResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LinkerResource), + Created201(models::LinkerResource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + pub(crate) parameters: models::LinkerPatch, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod validate { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ValidateResult), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}/validateLinker", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ValidateResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_configurations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_uri: String, + pub(crate) linker_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/{}/providers/Microsoft.ServiceLinker/linkers/{}/listConfigurations", + self.client.endpoint(), + &self.resource_uri, + &self.linker_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SourceConfigurationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod operations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/providers/Microsoft.ServiceLinker/operations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-05-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/mgmt/signalr/Cargo.toml b/services/mgmt/signalr/Cargo.toml index 1eed545657..94ac943fc9 100644 --- a/services/mgmt/signalr/Cargo.toml +++ b/services/mgmt/signalr/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_signalr" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/softwareplan/Cargo.toml b/services/mgmt/softwareplan/Cargo.toml index fb27652afc..d2149581b5 100644 --- a/services/mgmt/softwareplan/Cargo.toml +++ b/services/mgmt/softwareplan/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_softwareplan" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/solutions/Cargo.toml b/services/mgmt/solutions/Cargo.toml index 1db0929481..6f2174dbec 100644 --- a/services/mgmt/solutions/Cargo.toml +++ b/services/mgmt/solutions/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_solutions" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/sql/Cargo.toml b/services/mgmt/sql/Cargo.toml index 7ab7461b55..9958cb6492 100644 --- a/services/mgmt/sql/Cargo.toml +++ b/services/mgmt/sql/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_sql" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/sql/README.md b/services/mgmt/sql/README.md index 69929e353d..443c153014 100644 --- a/services/mgmt/sql/README.md +++ b/services/mgmt/sql/README.md @@ -11,7 +11,7 @@ The default tag is `package-composite-v5`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: - `package-preview-2021-11` has 442 operations from 1 API versions: `2021-11-01-preview`. Use crate feature `package-preview-2021-11` to enable. The operations will be in the `package_preview_2021_11` module. -- `package-composite-v5` has 455 operations from 6 API versions: `2014-04-01`, `2020-11-01-preview`, `2021-02-01-preview`, `2021-05-01-preview`, `2021-08-01-preview`, `2021-11-01-preview`. Use crate feature `package-composite-v5` to enable. The operations will be in the `package_composite_v5` module. +- `package-composite-v5` has 451 operations from 6 API versions: `2014-04-01`, `2020-11-01-preview`, `2021-02-01-preview`, `2021-05-01-preview`, `2021-08-01-preview`, `2021-11-01-preview`. Use crate feature `package-composite-v5` to enable. The operations will be in the `package_composite_v5` module. - `package-composite-v4` has 372 operations from 9 API versions: `2014-04-01`, `2015-05-01-preview`, `2017-03-01-preview`, `2017-10-01-preview`, `2018-06-01-preview`, `2019-06-01-preview`, `2020-02-02-preview`, `2020-08-01-preview`, `2020-11-01-preview`. Use crate feature `package-composite-v4` to enable. The operations will be in the `package_composite_v4` module. - `package-composite-v3` has 364 operations from 8 API versions: `2014-04-01`, `2015-05-01-preview`, `2017-03-01-preview`, `2017-10-01-preview`, `2018-06-01-preview`, `2019-06-01-preview`, `2020-02-02-preview`, `2020-11-01-preview`. Use crate feature `package-composite-v3` to enable. The operations will be in the `package_composite_v3` module. - `package-composite-v2` has 362 operations from 8 API versions: `2014-04-01`, `2015-05-01-preview`, `2017-03-01-preview`, `2017-10-01-preview`, `2018-06-01-preview`, `2019-06-01-preview`, `2020-02-02-preview`, `2020-11-01-preview`. Use crate feature `package-composite-v2` to enable. The operations will be in the `package_composite_v2` module. diff --git a/services/mgmt/sql/src/package_composite_v5/models.rs b/services/mgmt/sql/src/package_composite_v5/models.rs index 1b01f71bb7..f8a9b570c9 100644 --- a/services/mgmt/sql/src/package_composite_v5/models.rs +++ b/services/mgmt/sql/src/package_composite_v5/models.rs @@ -2848,6 +2848,47 @@ pub mod encryption_protector_properties { AzureKeyVault, } } +#[doc = "Certificate used on an endpoint on the Managed Instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointCertificate { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "The properties of an endpoint certificate."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl EndpointCertificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of endpoint certificates on the target instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointCertificateListResult { + #[doc = "Array of results."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Link to retrieve next page of results."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl EndpointCertificateListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The properties of an endpoint certificate."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EndpointCertificateProperties { + #[doc = "The certificate public blob"] + #[serde(rename = "publicBlob", default, skip_serializing_if = "Option::is_none")] + pub public_blob: Option, +} +impl EndpointCertificateProperties { + pub fn new() -> Self { + Self::default() + } +} #[doc = "Contains the information necessary to perform export database operation."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ExportDatabaseDefinition { @@ -6470,73 +6511,6 @@ impl ManagedInstanceVulnerabilityAssessmentProperties { } } } -#[doc = "A managed server DNS alias."] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] -pub struct ManagedServerDnsAlias { - #[serde(flatten)] - pub proxy_resource: ProxyResource, - #[doc = "Properties of a managed server DNS alias."] - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -impl ManagedServerDnsAlias { - pub fn new() -> Self { - Self::default() - } -} -#[doc = "A managed server DNS alias acquisition request."] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ManagedServerDnsAliasAcquisition { - #[doc = "The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead."] - #[serde(rename = "oldManagedServerDnsAliasResourceId")] - pub old_managed_server_dns_alias_resource_id: String, -} -impl ManagedServerDnsAliasAcquisition { - pub fn new(old_managed_server_dns_alias_resource_id: String) -> Self { - Self { - old_managed_server_dns_alias_resource_id, - } - } -} -#[doc = "A managed server dns alias creation request."] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] -pub struct ManagedServerDnsAliasCreation { - #[doc = "Whether or not DNS record should be created for this alias."] - #[serde(rename = "createDnsRecord", default, skip_serializing_if = "Option::is_none")] - pub create_dns_record: Option, -} -impl ManagedServerDnsAliasCreation { - pub fn new() -> Self { - Self::default() - } -} -#[doc = "A list of managed server DNS aliases."] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] -pub struct ManagedServerDnsAliasListResult { - #[doc = "Array of results."] - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[doc = "Link to retrieve next page of results."] - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -impl ManagedServerDnsAliasListResult { - pub fn new() -> Self { - Self::default() - } -} -#[doc = "Properties of a managed server DNS alias."] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] -pub struct ManagedServerDnsAliasProperties { - #[doc = "The fully qualified DNS record for managed server alias"] - #[serde(rename = "azureDnsRecord", default, skip_serializing_if = "Option::is_none")] - pub azure_dns_record: Option, -} -impl ManagedServerDnsAliasProperties { - pub fn new() -> Self { - Self::default() - } -} #[doc = "A managed server security alert policy."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct ManagedServerSecurityAlertPolicy { @@ -9412,7 +9386,7 @@ impl ServerTrustCertificateProperties { Self::default() } } -#[doc = "A list of the server trust certificates which are used for secure communication between SQL On-Prem instance and the given Sql Managed Instance."] +#[doc = "A list of server trust certificates in instance."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct ServerTrustCertificatesListResult { #[doc = "Array of results."] @@ -10780,6 +10754,18 @@ pub mod transparent_data_encryption_properties { Disabled, } } +#[doc = "Represents the parameters for Unlink Replication Link request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UnlinkParameters { + #[doc = "Determines whether link will be terminated in a forced or a friendly way."] + #[serde(rename = "forcedTermination", default, skip_serializing_if = "Option::is_none")] + pub forced_termination: Option, +} +impl UnlinkParameters { + pub fn new() -> Self { + Self::default() + } +} #[doc = "Contains the information necessary to perform long term retention backup update operation."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct UpdateLongTermRetentionBackupParameters { diff --git a/services/mgmt/sql/src/package_composite_v5/operations.rs b/services/mgmt/sql/src/package_composite_v5/operations.rs index b5508b2b0f..7a4d1fc44f 100644 --- a/services/mgmt/sql/src/package_composite_v5/operations.rs +++ b/services/mgmt/sql/src/package_composite_v5/operations.rs @@ -155,6 +155,9 @@ impl Client { pub fn encryption_protectors(&self) -> encryption_protectors::Client { encryption_protectors::Client(self.clone()) } + pub fn endpoint_certificates(&self) -> endpoint_certificates::Client { + endpoint_certificates::Client(self.clone()) + } pub fn extended_database_blob_auditing_policies(&self) -> extended_database_blob_auditing_policies::Client { extended_database_blob_auditing_policies::Client(self.clone()) } @@ -309,9 +312,6 @@ impl Client { ) -> 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(&self) -> managed_server_dns_aliases::Client { - managed_server_dns_aliases::Client(self.clone()) - } pub fn managed_server_security_alert_policies(&self) -> managed_server_security_alert_policies::Client { managed_server_security_alert_policies::Client(self.clone()) } @@ -476,6 +476,14 @@ pub enum Error { #[error(transparent)] ElasticPools_ListMetricDefinitions(#[from] elastic_pools::list_metric_definitions::Error), #[error(transparent)] + ReplicationLinks_Delete(#[from] replication_links::delete::Error), + #[error(transparent)] + ReplicationLinks_Failover(#[from] replication_links::failover::Error), + #[error(transparent)] + ReplicationLinks_FailoverAllowDataLoss(#[from] replication_links::failover_allow_data_loss::Error), + #[error(transparent)] + ReplicationLinks_Unlink(#[from] replication_links::unlink::Error), + #[error(transparent)] ServerCommunicationLinks_Get(#[from] server_communication_links::get::Error), #[error(transparent)] ServerCommunicationLinks_CreateOrUpdate(#[from] server_communication_links::create_or_update::Error), @@ -1306,14 +1314,14 @@ pub enum Error { #[error(transparent)] DistributedAvailabilityGroups_Delete(#[from] distributed_availability_groups::delete::Error), #[error(transparent)] + ServerTrustCertificates_ListByInstance(#[from] server_trust_certificates::list_by_instance::Error), + #[error(transparent)] ServerTrustCertificates_Get(#[from] server_trust_certificates::get::Error), #[error(transparent)] ServerTrustCertificates_CreateOrUpdate(#[from] server_trust_certificates::create_or_update::Error), #[error(transparent)] ServerTrustCertificates_Delete(#[from] server_trust_certificates::delete::Error), #[error(transparent)] - ServerTrustCertificates_ListByInstance(#[from] server_trust_certificates::list_by_instance::Error), - #[error(transparent)] ElasticPools_ListByServer(#[from] elastic_pools::list_by_server::Error), #[error(transparent)] ElasticPools_Get(#[from] elastic_pools::get::Error), @@ -1334,28 +1342,16 @@ pub enum Error { #[error(transparent)] IPv6FirewallRules_Delete(#[from] i_pv6_firewall_rules::delete::Error), #[error(transparent)] - ReplicationLinks_ListByDatabase(#[from] replication_links::list_by_database::Error), - #[error(transparent)] - ReplicationLinks_Get(#[from] replication_links::get::Error), + EndpointCertificates_ListByInstance(#[from] endpoint_certificates::list_by_instance::Error), #[error(transparent)] - ReplicationLinks_Delete(#[from] replication_links::delete::Error), + EndpointCertificates_Get(#[from] endpoint_certificates::get::Error), #[error(transparent)] - ReplicationLinks_Failover(#[from] replication_links::failover::Error), + ReplicationLinks_ListByDatabase(#[from] replication_links::list_by_database::Error), #[error(transparent)] - ReplicationLinks_FailoverAllowDataLoss(#[from] replication_links::failover_allow_data_loss::Error), + ReplicationLinks_Get(#[from] replication_links::get::Error), #[error(transparent)] ReplicationLinks_ListByServer(#[from] replication_links::list_by_server::Error), #[error(transparent)] - ManagedDatabaseSensitivityLabels_ListCurrentByDatabase(#[from] managed_database_sensitivity_labels::list_current_by_database::Error), - #[error(transparent)] - ManagedDatabaseSensitivityLabels_Update(#[from] managed_database_sensitivity_labels::update::Error), - #[error(transparent)] - ManagedDatabaseSensitivityLabels_ListRecommendedByDatabase( - #[from] managed_database_sensitivity_labels::list_recommended_by_database::Error, - ), - #[error(transparent)] - ManagedDatabaseRecommendedSensitivityLabels_Update(#[from] managed_database_recommended_sensitivity_labels::update::Error), - #[error(transparent)] ManagedDatabaseSensitivityLabels_Get(#[from] managed_database_sensitivity_labels::get::Error), #[error(transparent)] ManagedDatabaseSensitivityLabels_CreateOrUpdate(#[from] managed_database_sensitivity_labels::create_or_update::Error), @@ -1366,17 +1362,15 @@ pub enum Error { #[error(transparent)] ManagedDatabaseSensitivityLabels_EnableRecommendation(#[from] managed_database_sensitivity_labels::enable_recommendation::Error), #[error(transparent)] - ManagedDatabaseSensitivityLabels_ListByDatabase(#[from] managed_database_sensitivity_labels::list_by_database::Error), - #[error(transparent)] - ManagedServerDnsAliases_ListByManagedInstance(#[from] managed_server_dns_aliases::list_by_managed_instance::Error), - #[error(transparent)] - ManagedServerDnsAliases_Get(#[from] managed_server_dns_aliases::get::Error), + ManagedDatabaseSensitivityLabels_ListCurrentByDatabase(#[from] managed_database_sensitivity_labels::list_current_by_database::Error), #[error(transparent)] - ManagedServerDnsAliases_CreateOrUpdate(#[from] managed_server_dns_aliases::create_or_update::Error), + ManagedDatabaseSensitivityLabels_Update(#[from] managed_database_sensitivity_labels::update::Error), #[error(transparent)] - ManagedServerDnsAliases_Delete(#[from] managed_server_dns_aliases::delete::Error), + ManagedDatabaseSensitivityLabels_ListRecommendedByDatabase( + #[from] managed_database_sensitivity_labels::list_recommended_by_database::Error, + ), #[error(transparent)] - ManagedServerDnsAliases_Acquire(#[from] managed_server_dns_aliases::acquire::Error), + ManagedDatabaseRecommendedSensitivityLabels_Update(#[from] managed_database_recommended_sensitivity_labels::update::Error), #[error(transparent)] SensitivityLabels_ListCurrentByDatabase(#[from] sensitivity_labels::list_current_by_database::Error), #[error(transparent)] @@ -1386,17 +1380,15 @@ pub enum Error { #[error(transparent)] RecommendedSensitivityLabels_Update(#[from] recommended_sensitivity_labels::update::Error), #[error(transparent)] + SensitivityLabels_EnableRecommendation(#[from] sensitivity_labels::enable_recommendation::Error), + #[error(transparent)] + SensitivityLabels_DisableRecommendation(#[from] sensitivity_labels::disable_recommendation::Error), + #[error(transparent)] SensitivityLabels_Get(#[from] sensitivity_labels::get::Error), #[error(transparent)] SensitivityLabels_CreateOrUpdate(#[from] sensitivity_labels::create_or_update::Error), #[error(transparent)] SensitivityLabels_Delete(#[from] sensitivity_labels::delete::Error), - #[error(transparent)] - SensitivityLabels_DisableRecommendation(#[from] sensitivity_labels::disable_recommendation::Error), - #[error(transparent)] - SensitivityLabels_EnableRecommendation(#[from] sensitivity_labels::enable_recommendation::Error), - #[error(transparent)] - SensitivityLabels_ListByDatabase(#[from] sensitivity_labels::list_by_database::Error), } pub mod recoverable_databases { use super::models; @@ -4422,73 +4414,133 @@ pub mod elastic_pools { } } } -pub mod server_communication_links { +pub mod replication_links { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn get( + pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, server_name: impl Into, - communication_link_name: impl Into, - ) -> get::Builder { - get::Builder { + database_name: impl Into, + link_id: impl Into, + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), - communication_link_name: communication_link_name.into(), + database_name: database_name.into(), + link_id: link_id.into(), } } - pub fn create_or_update( + pub fn failover( &self, subscription_id: impl Into, resource_group_name: impl Into, server_name: impl Into, - communication_link_name: impl Into, - parameters: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + database_name: impl Into, + link_id: impl Into, + ) -> failover::Builder { + failover::Builder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), - communication_link_name: communication_link_name.into(), - parameters: parameters.into(), + database_name: database_name.into(), + link_id: link_id.into(), } } - pub fn delete( + pub fn failover_allow_data_loss( &self, subscription_id: impl Into, resource_group_name: impl Into, server_name: impl Into, - communication_link_name: impl Into, - ) -> delete::Builder { - delete::Builder { + database_name: impl Into, + link_id: impl Into, + ) -> failover_allow_data_loss::Builder { + failover_allow_data_loss::Builder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), - communication_link_name: communication_link_name.into(), + database_name: database_name.into(), + link_id: link_id.into(), } } - pub fn list_by_server( + pub fn unlink( &self, subscription_id: impl Into, resource_group_name: impl Into, server_name: impl Into, + database_name: impl Into, + link_id: impl Into, + parameters: impl Into, + ) -> unlink::Builder { + unlink::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + database_name: database_name.into(), + link_id: link_id.into(), + parameters: parameters.into(), + } + } + pub fn list_by_database( + &self, + resource_group_name: impl Into, + server_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> list_by_database::Builder { + list_by_database::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + database_name: database_name.into(), + subscription_id: subscription_id.into(), + } + } + pub fn get( + &self, + resource_group_name: impl Into, + server_name: impl Into, + database_name: impl Into, + link_id: impl Into, + subscription_id: impl Into, + ) -> get::Builder { + get::Builder { + 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(), + } + } + pub fn list_by_server( + &self, + resource_group_name: impl Into, + server_name: impl Into, + subscription_id: impl Into, ) -> list_by_server::Builder { list_by_server::Builder { client: self.0.clone(), - subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), + subscription_id: subscription_id.into(), } } } - pub mod get { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("Unexpected HTTP status code {}", status_code)] @@ -4514,22 +4566,24 @@ pub mod server_communication_links { pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) server_name: String, - pub(crate) communication_link_name: String, + pub(crate) database_name: String, + pub(crate) link_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/communicationLinks/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, &self.server_name, - &self.communication_link_name + &self.database_name, + &self.link_id ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4543,12 +4597,8 @@ pub mod server_communication_links { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServerCommunicationLink = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; Err(Error::UnexpectedResponse { @@ -4561,11 +4611,11 @@ pub mod server_communication_links { } } } - pub mod create_or_update { + pub mod failover { use super::models; #[derive(Debug)] pub enum Response { - Created201(models::ServerCommunicationLink), + NoContent204, Accepted202, } #[derive(Debug, thiserror :: Error)] @@ -4593,23 +4643,16 @@ pub mod server_communication_links { pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) server_name: String, - pub(crate) communication_link_name: String, - pub(crate) parameters: models::ServerCommunicationLink, + pub(crate) database_name: String, + pub(crate) link_id: String, } impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/communicationLinks/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.server_name, - &self.communication_link_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/failover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . link_id) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) @@ -4617,19 +4660,84 @@ pub mod server_communication_links { .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); url.query_pairs_mut().append_pair("api-version", "2014-04-01"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::CREATED => { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServerCommunicationLink = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) } + } + }) + } + } + } + pub mod failover_allow_data_loss { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) server_name: String, + pub(crate) database_name: String, + pub(crate) link_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/forceFailoverAllowDataLoss" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . link_id) ; + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2014-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), http::StatusCode::ACCEPTED => Ok(Response::Accepted202), status_code => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; @@ -4643,7 +4751,512 @@ pub mod server_communication_links { } } } - pub mod delete { + pub mod unlink { + use super::models; + #[derive(Debug)] + pub enum Response { + NoContent204, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) server_name: String, + pub(crate) database_name: String, + pub(crate) link_id: String, + pub(crate) parameters: models::UnlinkParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/unlink", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name, + &self.database_name, + &self.link_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2014-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod list_by_database { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + 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 Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name, + &self.database_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationLinkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::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 Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name, + &self.database_name, + &self.link_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationLink = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } + pub mod list_by_server { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) server_name: String, + pub(crate) subscription_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/replicationLinks", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ReplicationLinkListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) + } + } + } +} +pub mod server_communication_links { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + server_name: impl Into, + communication_link_name: impl Into, + ) -> get::Builder { + get::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + communication_link_name: communication_link_name.into(), + } + } + pub fn create_or_update( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + server_name: impl Into, + communication_link_name: impl Into, + parameters: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + communication_link_name: communication_link_name.into(), + parameters: parameters.into(), + } + } + pub fn delete( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + server_name: impl Into, + communication_link_name: impl Into, + ) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + communication_link_name: communication_link_name.into(), + } + } + pub fn list_by_server( + &self, + subscription_id: impl Into, + resource_group_name: impl Into, + server_name: impl Into, + ) -> list_by_server::Builder { + list_by_server::Builder { + client: self.0.clone(), + subscription_id: subscription_id.into(), + resource_group_name: resource_group_name.into(), + server_name: server_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) server_name: String, + pub(crate) communication_link_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/communicationLinks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name, + &self.communication_link_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2014-04-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServerCommunicationLink = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Created201(models::ServerCommunicationLink), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) subscription_id: String, + pub(crate) resource_group_name: String, + pub(crate) server_name: String, + pub(crate) communication_link_name: String, + pub(crate) parameters: models::ServerCommunicationLink, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/communicationLinks/{}", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.server_name, + &self.communication_link_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2014-04-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServerCommunicationLink = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -38466,7 +39079,7 @@ pub mod distributed_availability_groups { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -38529,7 +39142,7 @@ pub mod distributed_availability_groups { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -38597,7 +39210,7 @@ pub mod distributed_availability_groups { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -38672,7 +39285,7 @@ pub mod distributed_availability_groups { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -38741,7 +39354,7 @@ pub mod distributed_availability_groups { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -38762,6 +39375,19 @@ pub mod server_trust_certificates { use super::models; pub struct Client(pub(crate) super::Client); impl Client { + pub fn list_by_instance( + &self, + resource_group_name: impl Into, + managed_instance_name: impl Into, + subscription_id: impl Into, + ) -> list_by_instance::Builder { + list_by_instance::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + managed_instance_name: managed_instance_name.into(), + subscription_id: subscription_id.into(), + } + } pub fn get( &self, resource_group_name: impl Into, @@ -38809,21 +39435,8 @@ pub mod server_trust_certificates { subscription_id: subscription_id.into(), } } - pub fn list_by_instance( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - subscription_id: impl Into, - ) -> list_by_instance::Builder { - list_by_instance::Builder { - 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 get { + pub mod list_by_instance { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -38849,19 +39462,19 @@ pub mod server_trust_certificates { 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.managed_instance_name, - &self.certificate_name + &self.managed_instance_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -38872,7 +39485,7 @@ pub mod server_trust_certificates { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -38881,7 +39494,7 @@ pub mod server_trust_certificates { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServerTrustCertificate = + let rsp_value: models::ServerTrustCertificatesListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -38891,14 +39504,8 @@ pub mod server_trust_certificates { } } } - pub mod create_or_update { + pub mod get { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ServerTrustCertificate), - Accepted202, - Created201(models::ServerTrustCertificate), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -38924,11 +39531,10 @@ pub mod server_trust_certificates { 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}", @@ -38940,16 +39546,15 @@ pub mod server_trust_certificates { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -38959,14 +39564,7 @@ pub mod server_trust_certificates { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; let rsp_value: models::ServerTrustCertificate = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServerTrustCertificate = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) + Ok(rsp_value) } status_code => Err(Error::DefaultResponse { status_code }), } @@ -38974,13 +39572,13 @@ pub mod server_trust_certificates { } } } - pub mod delete { + pub mod create_or_update { use super::models; #[derive(Debug)] pub enum Response { - Ok200, + Ok200(models::ServerTrustCertificate), Accepted202, - NoContent204, + Created201(models::ServerTrustCertificate), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -39007,6 +39605,7 @@ pub mod server_trust_certificates { 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 Builder { @@ -39022,31 +39621,48 @@ pub mod server_trust_certificates { ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); - let req_body = azure_core::EMPTY_BODY; + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServerTrustCertificate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ServerTrustCertificate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } status_code => Err(Error::DefaultResponse { status_code }), } }) } } } - pub mod list_by_instance { + pub mod delete { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -39071,42 +39687,39 @@ pub mod server_trust_certificates { 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 Builder { - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/serverTrustCertificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.managed_instance_name + &self.managed_instance_name, + &self.certificate_name ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ServerTrustCertificatesListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), status_code => Err(Error::DefaultResponse { status_code }), } }) @@ -39466,108 +40079,108 @@ pub mod i_pv6_firewall_rules { } } } -pub mod replication_links { +pub mod endpoint_certificates { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_by_database( + pub fn list_by_instance( &self, resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, + managed_instance_name: impl Into, subscription_id: impl Into, - ) -> list_by_database::Builder { - list_by_database::Builder { + ) -> list_by_instance::Builder { + list_by_instance::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), - server_name: server_name.into(), - database_name: database_name.into(), + managed_instance_name: managed_instance_name.into(), subscription_id: subscription_id.into(), } } pub fn get( &self, resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, - link_id: impl Into, + managed_instance_name: impl Into, + endpoint_type: impl Into, subscription_id: impl Into, ) -> get::Builder { get::Builder { 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(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, - link_id: impl Into, - subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { - 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(), + managed_instance_name: managed_instance_name.into(), + endpoint_type: endpoint_type.into(), subscription_id: subscription_id.into(), } } - pub fn failover( - &self, - resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, - link_id: impl Into, - subscription_id: impl Into, - ) -> failover::Builder { - failover::Builder { - 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(), - } + } + pub mod list_by_instance { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { status_code: http::StatusCode }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), } - pub fn failover_allow_data_loss( - &self, - resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, - link_id: impl Into, - subscription_id: impl Into, - ) -> failover_allow_data_loss::Builder { - failover_allow_data_loss::Builder { - 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(), - } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) resource_group_name: String, + pub(crate) managed_instance_name: String, + pub(crate) subscription_id: String, } - pub fn list_by_server( - &self, - resource_group_name: impl Into, - server_name: impl Into, - subscription_id: impl Into, - ) -> list_by_server::Builder { - list_by_server::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - server_name: server_name.into(), - subscription_id: subscription_id.into(), + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/endpointCertificates", + self.client.endpoint(), + &self.subscription_id, + &self.resource_group_name, + &self.managed_instance_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EndpointCertificateListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => Err(Error::DefaultResponse { status_code }), + } + }) } } } - pub mod list_by_database { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -39592,359 +40205,20 @@ pub mod replication_links { pub struct Builder { 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.server_name, - &self.database_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ReplicationLinkListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod get { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.server_name, - &self.database_name, - &self.link_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ReplicationLink = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod delete { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.server_name, - &self.database_name, - &self.link_id - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(()), - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod failover { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ReplicationLink), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/failover" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . link_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ReplicationLink = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod failover_allow_data_loss { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ReplicationLink), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/replicationLinks/{}/forceFailoverAllowDataLoss" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . link_id) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ReplicationLink = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod list_by_server { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::super::Client, - pub(crate) resource_group_name: String, - pub(crate) server_name: String, + pub(crate) managed_instance_name: String, + pub(crate) endpoint_type: String, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/replicationLinks", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/endpointCertificates/{}", self.client.endpoint(), &self.subscription_id, &self.resource_group_name, - &self.server_name + &self.managed_instance_name, + &self.endpoint_type ); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); @@ -39964,7 +40238,7 @@ pub mod replication_links { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ReplicationLinkListResult = + let rsp_value: models::EndpointCertificate = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -39979,59 +40253,6 @@ pub mod managed_database_sensitivity_labels { use super::models; pub struct Client(pub(crate) super::Client); impl Client { - pub fn list_current_by_database( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - database_name: impl Into, - subscription_id: impl Into, - ) -> list_current_by_database::Builder { - list_current_by_database::Builder { - 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, - } - } - pub fn update( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - database_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - managed_instance_name: managed_instance_name.into(), - database_name: database_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn list_recommended_by_database( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - database_name: impl Into, - subscription_id: impl Into, - ) -> list_recommended_by_database::Builder { - list_recommended_by_database::Builder { - 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, - } - } pub fn get( &self, resource_group_name: impl Into, @@ -40148,254 +40369,58 @@ pub mod managed_database_sensitivity_labels { sensitivity_label_source: sensitivity_label_source.into(), subscription_id: subscription_id.into(), } - } - pub fn list_by_database( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - database_name: impl Into, - subscription_id: impl Into, - ) -> list_by_database::Builder { - list_by_database::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - 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; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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, - pub(crate) count: Option, - pub(crate) filter: Option, - } - impl Builder { - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn count(mut self, count: bool) -> Self { - self.count = Some(count); - self - } - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - if let Some(count) = &self.count { - url.query_pairs_mut().append_pair("$count", &count.to_string()); - } - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabelListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod update { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(()), - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod list_recommended_by_database { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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, - pub(crate) include_disabled_recommendations: Option, - pub(crate) filter: Option, - } - impl Builder { - pub fn skip_token(mut self, skip_token: impl Into) -> Self { - self.skip_token = Some(skip_token.into()); - self - } - pub fn include_disabled_recommendations(mut self, include_disabled_recommendations: bool) -> Self { - self.include_disabled_recommendations = Some(include_disabled_recommendations); - self + } + pub fn list_current_by_database( + &self, + resource_group_name: impl Into, + managed_instance_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> list_current_by_database::Builder { + list_current_by_database::Builder { + 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, } - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self + } + pub fn update( + &self, + resource_group_name: impl Into, + managed_instance_name: impl Into, + database_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + managed_instance_name: managed_instance_name.into(), + database_name: database_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - if let Some(skip_token) = &self.skip_token { - url.query_pairs_mut().append_pair("$skipToken", skip_token); - } - if let Some(include_disabled_recommendations) = &self.include_disabled_recommendations { - url.query_pairs_mut() - .append_pair("includeDisabledRecommendations", &include_disabled_recommendations.to_string()); - } - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabelListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) + } + pub fn list_recommended_by_database( + &self, + resource_group_name: impl Into, + managed_instance_name: impl Into, + database_name: impl Into, + subscription_id: impl Into, + ) -> list_recommended_by_database::Builder { + list_recommended_by_database::Builder { + 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, } } } @@ -40445,7 +40470,7 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -40516,7 +40541,7 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -40588,7 +40613,7 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -40648,7 +40673,7 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); @@ -40709,7 +40734,7 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); @@ -40724,7 +40749,7 @@ pub mod managed_database_sensitivity_labels { } } } - pub mod list_by_database { + pub mod list_current_by_database { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -40752,9 +40777,19 @@ pub mod managed_database_sensitivity_labels { pub(crate) managed_instance_name: String, pub(crate) database_name: String, pub(crate) subscription_id: String, + pub(crate) skip_token: Option, + pub(crate) count: Option, pub(crate) filter: Option, } impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn count(mut self, count: bool) -> Self { + self.count = Some(count); + self + } pub fn filter(mut self, filter: impl Into) -> Self { self.filter = Some(filter.into()); self @@ -40763,14 +40798,7 @@ pub mod managed_database_sensitivity_labels { self, ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/sensitivityLabels", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name, - &self.database_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -40780,7 +40808,13 @@ pub mod managed_database_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + if let Some(count) = &self.count { + url.query_pairs_mut().append_pair("$count", &count.to_string()); + } if let Some(filter) = &self.filter { url.query_pairs_mut().append_pair("$filter", filter); } @@ -40802,29 +40836,6 @@ pub mod managed_database_sensitivity_labels { } } } -} -pub mod managed_database_recommended_sensitivity_labels { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn update( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - database_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> update::Builder { - update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - 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; #[derive(Debug, thiserror :: Error)] @@ -40852,13 +40863,13 @@ pub mod managed_database_recommended_sensitivity_labels { pub(crate) resource_group_name: String, pub(crate) managed_instance_name: String, pub(crate) database_name: String, - pub(crate) parameters: models::RecommendedSensitivityLabelUpdateList, + pub(crate) parameters: models::SensitivityLabelUpdateList, pub(crate) subscription_id: String, } impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/currentSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PATCH); @@ -40868,7 +40879,7 @@ pub mod managed_database_recommended_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -40883,90 +40894,7 @@ pub mod managed_database_recommended_sensitivity_labels { } } } -} -pub mod managed_server_dns_aliases { - use super::models; - pub struct Client(pub(crate) super::Client); - impl Client { - pub fn list_by_managed_instance( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - subscription_id: impl Into, - ) -> list_by_managed_instance::Builder { - list_by_managed_instance::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - managed_instance_name: managed_instance_name.into(), - subscription_id: subscription_id.into(), - } - } - pub fn get( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - dns_alias_name: impl Into, - subscription_id: impl Into, - ) -> get::Builder { - get::Builder { - 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(), - } - } - pub fn create_or_update( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - dns_alias_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - managed_instance_name: managed_instance_name.into(), - dns_alias_name: dns_alias_name.into(), - parameters: parameters.into(), - subscription_id: subscription_id.into(), - } - } - pub fn delete( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - dns_alias_name: impl Into, - subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { - 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(), - } - } - pub fn acquire( - &self, - resource_group_name: impl Into, - managed_instance_name: impl Into, - dns_alias_name: impl Into, - parameters: impl Into, - subscription_id: impl Into, - ) -> acquire::Builder { - acquire::Builder { - 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 { + pub mod list_recommended_by_database { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -40992,20 +40920,30 @@ pub mod managed_server_dns_aliases { 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, + pub(crate) include_disabled_recommendations: Option, + pub(crate) filter: Option, } impl Builder { + pub fn skip_token(mut self, skip_token: impl Into) -> Self { + self.skip_token = Some(skip_token.into()); + self + } + pub fn include_disabled_recommendations(mut self, include_disabled_recommendations: bool) -> Self { + self.include_disabled_recommendations = Some(include_disabled_recommendations); + self + } + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } pub fn into_future( self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { + ) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -41015,75 +40953,17 @@ pub mod managed_server_dns_aliases { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ManagedServerDnsAliasListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); + if let Some(skip_token) = &self.skip_token { + url.query_pairs_mut().append_pair("$skipToken", skip_token); + } + if let Some(include_disabled_recommendations) = &self.include_disabled_recommendations { + url.query_pairs_mut() + .append_pair("includeDisabledRecommendations", &include_disabled_recommendations.to_string()); + } + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); } - }) - } - } - } - pub mod get { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name, - &self.dns_alias_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; @@ -41092,7 +40972,7 @@ pub mod managed_server_dns_aliases { match rsp_status { http::StatusCode::OK => { let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ManagedServerDnsAlias = + let rsp_value: models::SensitivityLabelListResult = serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -41102,167 +40982,31 @@ pub mod managed_server_dns_aliases { } } } - pub mod create_or_update { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ManagedServerDnsAlias), - Accepted202, - Created201(models::ManagedServerDnsAlias), - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - pub(crate) client: super::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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name, - &self.dns_alias_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ManagedServerDnsAlias = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ManagedServerDnsAlias = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } - pub mod delete { - use super::models; - #[derive(Debug)] - pub enum Response { - Ok200, - Accepted202, - NoContent204, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name, - &self.dns_alias_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => Ok(Response::Ok200), - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), - http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), - status_code => Err(Error::DefaultResponse { status_code }), - } - }) +} +pub mod managed_database_recommended_sensitivity_labels { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn update( + &self, + resource_group_name: impl Into, + managed_instance_name: impl Into, + database_name: impl Into, + parameters: impl Into, + subscription_id: impl Into, + ) -> update::Builder { + update::Builder { + client: self.0.clone(), + resource_group_name: resource_group_name.into(), + managed_instance_name: managed_instance_name.into(), + database_name: database_name.into(), + parameters: parameters.into(), + subscription_id: subscription_id.into(), } } } - pub mod acquire { + pub mod update { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::ManagedServerDnsAlias), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -41287,31 +41031,24 @@ pub mod managed_server_dns_aliases { 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) database_name: String, + pub(crate) parameters: models::RecommendedSensitivityLabelUpdateList, pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/dnsAliases/{}/acquire", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.managed_instance_name, - &self.dns_alias_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/managedInstances/{}/databases/{}/recommendedSensitivityLabels" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . managed_instance_name , & self . database_name) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::PATCH); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -41319,13 +41056,7 @@ pub mod managed_server_dns_aliases { let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::ManagedServerDnsAlias = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => Ok(()), status_code => Err(Error::DefaultResponse { status_code }), } }) @@ -41390,7 +41121,7 @@ pub mod sensitivity_labels { filter: None, } } - pub fn get( + pub fn enable_recommendation( &self, resource_group_name: impl Into, server_name: impl Into, @@ -41400,8 +41131,8 @@ pub mod sensitivity_labels { column_name: impl Into, sensitivity_label_source: impl Into, subscription_id: impl Into, - ) -> get::Builder { - get::Builder { + ) -> enable_recommendation::Builder { + enable_recommendation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), @@ -41413,7 +41144,7 @@ pub mod sensitivity_labels { subscription_id: subscription_id.into(), } } - pub fn create_or_update( + pub fn disable_recommendation( &self, resource_group_name: impl Into, server_name: impl Into, @@ -41422,10 +41153,9 @@ pub mod sensitivity_labels { table_name: impl Into, column_name: impl Into, sensitivity_label_source: impl Into, - parameters: impl Into, subscription_id: impl Into, - ) -> create_or_update::Builder { - create_or_update::Builder { + ) -> disable_recommendation::Builder { + disable_recommendation::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), @@ -41434,11 +41164,10 @@ pub mod sensitivity_labels { 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(), } } - pub fn delete( + pub fn get( &self, resource_group_name: impl Into, server_name: impl Into, @@ -41448,8 +41177,8 @@ pub mod sensitivity_labels { column_name: impl Into, sensitivity_label_source: impl Into, subscription_id: impl Into, - ) -> delete::Builder { - delete::Builder { + ) -> get::Builder { + get::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), @@ -41461,7 +41190,7 @@ pub mod sensitivity_labels { subscription_id: subscription_id.into(), } } - pub fn disable_recommendation( + pub fn create_or_update( &self, resource_group_name: impl Into, server_name: impl Into, @@ -41470,9 +41199,10 @@ pub mod sensitivity_labels { table_name: impl Into, column_name: impl Into, sensitivity_label_source: impl Into, + parameters: impl Into, subscription_id: impl Into, - ) -> disable_recommendation::Builder { - disable_recommendation::Builder { + ) -> create_or_update::Builder { + create_or_update::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), @@ -41481,10 +41211,11 @@ pub mod sensitivity_labels { 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(), } } - pub fn enable_recommendation( + pub fn delete( &self, resource_group_name: impl Into, server_name: impl Into, @@ -41494,8 +41225,8 @@ pub mod sensitivity_labels { column_name: impl Into, sensitivity_label_source: impl Into, subscription_id: impl Into, - ) -> enable_recommendation::Builder { - enable_recommendation::Builder { + ) -> delete::Builder { + delete::Builder { client: self.0.clone(), resource_group_name: resource_group_name.into(), server_name: server_name.into(), @@ -41507,22 +41238,6 @@ pub mod sensitivity_labels { subscription_id: subscription_id.into(), } } - pub fn list_by_database( - &self, - resource_group_name: impl Into, - server_name: impl Into, - database_name: impl Into, - subscription_id: impl Into, - ) -> list_by_database::Builder { - list_by_database::Builder { - client: self.0.clone(), - resource_group_name: resource_group_name.into(), - 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; @@ -41590,7 +41305,7 @@ pub mod sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); if let Some(skip_token) = &self.skip_token { url.query_pairs_mut().append_pair("$skipToken", skip_token); } @@ -41668,7 +41383,7 @@ pub mod sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); @@ -41742,7 +41457,7 @@ pub mod sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); if let Some(skip_token) = &self.skip_token { url.query_pairs_mut().append_pair("$skipToken", skip_token); } @@ -41771,7 +41486,7 @@ pub mod sensitivity_labels { } } } - pub mod get { + pub mod enable_recommendation { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -41805,44 +41520,35 @@ pub mod sensitivity_labels { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/enable" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabel = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(()), status_code => Err(Error::DefaultResponse { status_code }), } }) } } } - pub mod create_or_update { + pub mod disable_recommendation { use super::models; - #[derive(Debug)] - pub enum Response { - Ok200(models::SensitivityLabel), - Created201(models::SensitivityLabel), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -41872,49 +41578,37 @@ pub mod sensitivity_labels { 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/disable" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); + req_builder = req_builder.method(http::Method::POST); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - req_builder = req_builder.header("content-type", "application/json"); - let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabel = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Ok200(rsp_value)) - } - http::StatusCode::CREATED => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabel = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(Response::Created201(rsp_value)) - } + http::StatusCode::OK => Ok(()), status_code => Err(Error::DefaultResponse { status_code }), } }) } } } - pub mod delete { + pub mod get { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -41948,34 +41642,44 @@ pub mod sensitivity_labels { pub(crate) subscription_id: String, } impl Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); + req_builder = req_builder.method(http::Method::GET); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SensitivityLabel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => Err(Error::DefaultResponse { status_code }), } }) } } } - pub mod disable_recommendation { + pub mod create_or_update { use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SensitivityLabel), + Created201(models::SensitivityLabel), + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -42005,37 +41709,49 @@ pub mod sensitivity_labels { 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 Builder { - pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/disable" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::PUT); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); match rsp_status { - http::StatusCode::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SensitivityLabel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SensitivityLabel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } status_code => Err(Error::DefaultResponse { status_code }), } }) } } } - pub mod enable_recommendation { + pub mod delete { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -42071,19 +41787,18 @@ pub mod sensitivity_labels { impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}/enable" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/schemas/{}/tables/{}/columns/{}/sensitivityLabels/{}" , self . client . endpoint () , & self . subscription_id , & self . resource_group_name , & self . server_name , & self . database_name , & self . schema_name , & self . table_name , & self . column_name , & self . sensitivity_label_source) ; let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::DELETE); let credential = self.client.token_credential(); let token_response = credential .get_token(&self.client.scopes().join(" ")) .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -42096,84 +41811,6 @@ pub mod sensitivity_labels { } } } - pub mod list_by_database { - use super::models; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { status_code: http::StatusCode }, - #[error("Failed to parse request URL")] - ParseUrl(#[source] url::ParseError), - #[error("Failed to build request")] - BuildRequest(#[source] http::Error), - #[error("Failed to serialize request body")] - Serialize(#[source] serde_json::Error), - #[error("Failed to get access token")] - GetToken(#[source] azure_core::Error), - #[error("Failed to execute request")] - SendRequest(#[source] azure_core::error::Error), - #[error("Failed to get response bytes")] - ResponseBytes(#[source] azure_core::error::Error), - #[error("Failed to deserialize response, body: {1:?}")] - Deserialize(#[source] serde_json::Error, bytes::Bytes), - } - #[derive(Clone)] - pub struct Builder { - 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, - } - impl Builder { - pub fn filter(mut self, filter: impl Into) -> Self { - self.filter = Some(filter.into()); - self - } - pub fn into_future( - self, - ) -> futures::future::BoxFuture<'static, std::result::Result> { - Box::pin(async move { - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Sql/servers/{}/databases/{}/sensitivityLabels", - self.client.endpoint(), - &self.subscription_id, - &self.resource_group_name, - &self.server_name, - &self.database_name - ); - let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - let credential = self.client.token_credential(); - let token_response = credential - .get_token(&self.client.scopes().join(" ")) - .await - .map_err(Error::GetToken)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); - if let Some(filter) = &self.filter { - url.query_pairs_mut().append_pair("$filter", filter); - } - let req_body = azure_core::EMPTY_BODY; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; - let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; - let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); - match rsp_status { - http::StatusCode::OK => { - let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; - let rsp_value: models::SensitivityLabelListResult = - serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => Err(Error::DefaultResponse { status_code }), - } - }) - } - } - } } pub mod recommended_sensitivity_labels { use super::models; @@ -42240,7 +41877,7 @@ pub mod recommended_sensitivity_labels { .await .map_err(Error::GetToken)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + url.query_pairs_mut().append_pair("api-version", "2020-11-01-preview"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.parameters).map_err(Error::Serialize)?; req_builder = req_builder.uri(url.as_str()); diff --git a/services/mgmt/sqlvirtualmachine/Cargo.toml b/services/mgmt/sqlvirtualmachine/Cargo.toml index 5151d684b4..066c67b5af 100644 --- a/services/mgmt/sqlvirtualmachine/Cargo.toml +++ b/services/mgmt/sqlvirtualmachine/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_sqlvirtualmachine" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/stack/Cargo.toml b/services/mgmt/stack/Cargo.toml index 8d13b69ca2..a93d32a706 100644 --- a/services/mgmt/stack/Cargo.toml +++ b/services/mgmt/stack/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_stack" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storage/Cargo.toml b/services/mgmt/storage/Cargo.toml index 7188a4d3f3..3e4fe4b4af 100644 --- a/services/mgmt/storage/Cargo.toml +++ b/services/mgmt/storage/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storage" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storagecache/Cargo.toml b/services/mgmt/storagecache/Cargo.toml index 9d074cd17b..9a365ff93f 100644 --- a/services/mgmt/storagecache/Cargo.toml +++ b/services/mgmt/storagecache/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storagecache" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storageimportexport/Cargo.toml b/services/mgmt/storageimportexport/Cargo.toml index 1f33871679..f05ef7ea8b 100644 --- a/services/mgmt/storageimportexport/Cargo.toml +++ b/services/mgmt/storageimportexport/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storageimportexport" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storagepool/Cargo.toml b/services/mgmt/storagepool/Cargo.toml index a252417973..9a8574f80d 100644 --- a/services/mgmt/storagepool/Cargo.toml +++ b/services/mgmt/storagepool/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storagepool" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storagesync/Cargo.toml b/services/mgmt/storagesync/Cargo.toml index 63ed1d5e1b..3d9bd0f488 100644 --- a/services/mgmt/storagesync/Cargo.toml +++ b/services/mgmt/storagesync/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storagesync" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storsimple1200series/Cargo.toml b/services/mgmt/storsimple1200series/Cargo.toml index 2313a0c03a..5dfe76f3e3 100644 --- a/services/mgmt/storsimple1200series/Cargo.toml +++ b/services/mgmt/storsimple1200series/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storsimple1200series" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/storsimple8000series/Cargo.toml b/services/mgmt/storsimple8000series/Cargo.toml index 2603d7e538..d3cfdffaf5 100644 --- a/services/mgmt/storsimple8000series/Cargo.toml +++ b/services/mgmt/storsimple8000series/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_storsimple8000series" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/streamanalytics/Cargo.toml b/services/mgmt/streamanalytics/Cargo.toml index 690143ed88..8017bb7674 100644 --- a/services/mgmt/streamanalytics/Cargo.toml +++ b/services/mgmt/streamanalytics/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_streamanalytics" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/subscription/Cargo.toml b/services/mgmt/subscription/Cargo.toml index 29fd379882..de04bf034d 100644 --- a/services/mgmt/subscription/Cargo.toml +++ b/services/mgmt/subscription/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_subscription" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/support/Cargo.toml b/services/mgmt/support/Cargo.toml index 5f311d0725..04b9865f26 100644 --- a/services/mgmt/support/Cargo.toml +++ b/services/mgmt/support/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_support" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/synapse/Cargo.toml b/services/mgmt/synapse/Cargo.toml index a115be83be..667cd221d2 100644 --- a/services/mgmt/synapse/Cargo.toml +++ b/services/mgmt/synapse/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_synapse" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/testbase/Cargo.toml b/services/mgmt/testbase/Cargo.toml index 9a74270f0b..4b846ef51a 100644 --- a/services/mgmt/testbase/Cargo.toml +++ b/services/mgmt/testbase/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_testbase" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/timeseriesinsights/Cargo.toml b/services/mgmt/timeseriesinsights/Cargo.toml index 9695718fb0..e7da104256 100644 --- a/services/mgmt/timeseriesinsights/Cargo.toml +++ b/services/mgmt/timeseriesinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_timeseriesinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/trafficmanager/Cargo.toml b/services/mgmt/trafficmanager/Cargo.toml index 8f7e9524bb..6838102f1b 100644 --- a/services/mgmt/trafficmanager/Cargo.toml +++ b/services/mgmt/trafficmanager/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_trafficmanager" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/vi/Cargo.toml b/services/mgmt/vi/Cargo.toml index 7d07fde308..ce719f3cb8 100644 --- a/services/mgmt/vi/Cargo.toml +++ b/services/mgmt/vi/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_vi" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/videoanalyzer/Cargo.toml b/services/mgmt/videoanalyzer/Cargo.toml index b60c8b9cc8..a51b010459 100644 --- a/services/mgmt/videoanalyzer/Cargo.toml +++ b/services/mgmt/videoanalyzer/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_videoanalyzer" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/visualstudio/Cargo.toml b/services/mgmt/visualstudio/Cargo.toml index 5fde1e680d..0ef2a5054d 100644 --- a/services/mgmt/visualstudio/Cargo.toml +++ b/services/mgmt/visualstudio/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_visualstudio" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/vmware/Cargo.toml b/services/mgmt/vmware/Cargo.toml index a21a7ed913..b6277d4ca6 100644 --- a/services/mgmt/vmware/Cargo.toml +++ b/services/mgmt/vmware/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_vmware" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/vmwarecloudsimple/Cargo.toml b/services/mgmt/vmwarecloudsimple/Cargo.toml index 3f247854ea..687bdc64a0 100644 --- a/services/mgmt/vmwarecloudsimple/Cargo.toml +++ b/services/mgmt/vmwarecloudsimple/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_vmwarecloudsimple" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/web/Cargo.toml b/services/mgmt/web/Cargo.toml index 5a393950a2..e75ae4de9c 100644 --- a/services/mgmt/web/Cargo.toml +++ b/services/mgmt/web/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_web" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/webpubsub/Cargo.toml b/services/mgmt/webpubsub/Cargo.toml index 80be6cd083..668e4ec625 100644 --- a/services/mgmt/webpubsub/Cargo.toml +++ b/services/mgmt/webpubsub/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_webpubsub" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/windowsesu/Cargo.toml b/services/mgmt/windowsesu/Cargo.toml index b765f8db02..0ed9a2f60b 100644 --- a/services/mgmt/windowsesu/Cargo.toml +++ b/services/mgmt/windowsesu/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_windowsesu" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/windowsiot/Cargo.toml b/services/mgmt/windowsiot/Cargo.toml index 2e39cedbb8..70052cae7a 100644 --- a/services/mgmt/windowsiot/Cargo.toml +++ b/services/mgmt/windowsiot/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_windowsiot" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/mgmt/workloadmonitor/Cargo.toml b/services/mgmt/workloadmonitor/Cargo.toml index 00d76379f6..d3966125ca 100644 --- a/services/mgmt/workloadmonitor/Cargo.toml +++ b/services/mgmt/workloadmonitor/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_mgmt_workloadmonitor" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/appconfiguration/Cargo.toml b/services/svc/appconfiguration/Cargo.toml index fe78f189b6..46713b203c 100644 --- a/services/svc/appconfiguration/Cargo.toml +++ b/services/svc/appconfiguration/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_appconfiguration" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/applicationinsights/Cargo.toml b/services/svc/applicationinsights/Cargo.toml index 0107dd02d5..bc90086af9 100644 --- a/services/svc/applicationinsights/Cargo.toml +++ b/services/svc/applicationinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_applicationinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/attestation/Cargo.toml b/services/svc/attestation/Cargo.toml index c26cae5de4..5b32654f66 100644 --- a/services/svc/attestation/Cargo.toml +++ b/services/svc/attestation/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_attestation" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/batch/Cargo.toml b/services/svc/batch/Cargo.toml index 61f5de6c6a..22134af806 100644 --- a/services/svc/batch/Cargo.toml +++ b/services/svc/batch/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_batch" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/blobstorage/Cargo.toml b/services/svc/blobstorage/Cargo.toml index ca6aa6bb27..10c50c97ad 100644 --- a/services/svc/blobstorage/Cargo.toml +++ b/services/svc/blobstorage/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_blobstorage" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/confidentialledger/Cargo.toml b/services/svc/confidentialledger/Cargo.toml index c443156377..a5eb5ac8e1 100644 --- a/services/svc/confidentialledger/Cargo.toml +++ b/services/svc/confidentialledger/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_confidentialledger" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/containerregistry/Cargo.toml b/services/svc/containerregistry/Cargo.toml index 2993979db3..92d887eeca 100644 --- a/services/svc/containerregistry/Cargo.toml +++ b/services/svc/containerregistry/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_containerregistry" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/cosmosdb/Cargo.toml b/services/svc/cosmosdb/Cargo.toml index 54ddbfb85e..9f8881282a 100644 --- a/services/svc/cosmosdb/Cargo.toml +++ b/services/svc/cosmosdb/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_cosmosdb" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/datalakeanalytics/Cargo.toml b/services/svc/datalakeanalytics/Cargo.toml index 49a95b44c6..2a2e8ceced 100644 --- a/services/svc/datalakeanalytics/Cargo.toml +++ b/services/svc/datalakeanalytics/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_datalakeanalytics" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/deviceprovisioningservices/Cargo.toml b/services/svc/deviceprovisioningservices/Cargo.toml index b14894bda3..2c1db76c93 100644 --- a/services/svc/deviceprovisioningservices/Cargo.toml +++ b/services/svc/deviceprovisioningservices/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_deviceprovisioningservices" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/deviceupdate/Cargo.toml b/services/svc/deviceupdate/Cargo.toml index 6ad8d3631b..94ca90935d 100644 --- a/services/svc/deviceupdate/Cargo.toml +++ b/services/svc/deviceupdate/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_deviceupdate" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/digitaltwins/Cargo.toml b/services/svc/digitaltwins/Cargo.toml index 8d96600b04..ee3da99790 100644 --- a/services/svc/digitaltwins/Cargo.toml +++ b/services/svc/digitaltwins/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_digitaltwins" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/eventgrid/Cargo.toml b/services/svc/eventgrid/Cargo.toml index 2989a38788..020655cf04 100644 --- a/services/svc/eventgrid/Cargo.toml +++ b/services/svc/eventgrid/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_eventgrid" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/eventgrid/src/package_2018_01/models.rs b/services/svc/eventgrid/src/package_2018_01/models.rs index 613a2a59f3..42e519959b 100644 --- a/services/svc/eventgrid/src/package_2018_01/models.rs +++ b/services/svc/eventgrid/src/package_2018_01/models.rs @@ -1510,8 +1510,18 @@ impl EventHubCaptureFileCreatedEventData { #[doc = "Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceCreated event."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HealthcareFhirResourceCreatedEventData { - #[serde(flatten)] - pub healthcare_fhir_resource_event_base_properties: HealthcareFhirResourceEventBaseProperties, + #[doc = "Schema of FHIR resource type enumeration."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Domain name of FHIR account for this resource."] + #[serde(rename = "resourceFhirAccount", default, skip_serializing_if = "Option::is_none")] + pub resource_fhir_account: Option, + #[doc = "Id of HL7 FHIR resource."] + #[serde(rename = "resourceFhirId", default, skip_serializing_if = "Option::is_none")] + pub resource_fhir_id: Option, + #[doc = "VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion)."] + #[serde(rename = "resourceVersionId", default, skip_serializing_if = "Option::is_none")] + pub resource_version_id: Option, } impl HealthcareFhirResourceCreatedEventData { pub fn new() -> Self { @@ -1521,17 +1531,6 @@ impl HealthcareFhirResourceCreatedEventData { #[doc = "Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceDeleted event."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HealthcareFhirResourceDeletedEventData { - #[serde(flatten)] - pub healthcare_fhir_resource_event_base_properties: HealthcareFhirResourceEventBaseProperties, -} -impl HealthcareFhirResourceDeletedEventData { - pub fn new() -> Self { - Self::default() - } -} -#[doc = "Schema of common properties of all FhirResource events"] -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] -pub struct HealthcareFhirResourceEventBaseProperties { #[doc = "Schema of FHIR resource type enumeration."] #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] pub resource_type: Option, @@ -1545,7 +1544,7 @@ pub struct HealthcareFhirResourceEventBaseProperties { #[serde(rename = "resourceVersionId", default, skip_serializing_if = "Option::is_none")] pub resource_version_id: Option, } -impl HealthcareFhirResourceEventBaseProperties { +impl HealthcareFhirResourceDeletedEventData { pub fn new() -> Self { Self::default() } @@ -1718,8 +1717,18 @@ pub enum HealthcareFhirResourceType { #[doc = "Schema of the Data property of an EventGridEvent for a Microsoft.HealthcareApis.FhirResourceUpdated event."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct HealthcareFhirResourceUpdatedEventData { - #[serde(flatten)] - pub healthcare_fhir_resource_event_base_properties: HealthcareFhirResourceEventBaseProperties, + #[doc = "Schema of FHIR resource type enumeration."] + #[serde(rename = "resourceType", default, skip_serializing_if = "Option::is_none")] + pub resource_type: Option, + #[doc = "Domain name of FHIR account for this resource."] + #[serde(rename = "resourceFhirAccount", default, skip_serializing_if = "Option::is_none")] + pub resource_fhir_account: Option, + #[doc = "Id of HL7 FHIR resource."] + #[serde(rename = "resourceFhirId", default, skip_serializing_if = "Option::is_none")] + pub resource_fhir_id: Option, + #[doc = "VersionId of HL7 FHIR resource. It changes when the resource is created, updated, or deleted(soft-deletion)."] + #[serde(rename = "resourceVersionId", default, skip_serializing_if = "Option::is_none")] + pub resource_version_id: Option, } impl HealthcareFhirResourceUpdatedEventData { pub fn new() -> Self { diff --git a/services/svc/eventgrid/src/package_2018_01/operations.rs b/services/svc/eventgrid/src/package_2018_01/operations.rs index 9e3e3c753a..ba9337d9a2 100644 --- a/services/svc/eventgrid/src/package_2018_01/operations.rs +++ b/services/svc/eventgrid/src/package_2018_01/operations.rs @@ -79,14 +79,20 @@ impl Client { #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { + #[error(transparent)] + PublishEventGridEvents(#[from] publish_event_grid_events::Error), #[error(transparent)] PublishCloudEventEvents(#[from] publish_cloud_event_events::Error), #[error(transparent)] PublishCustomEventEvents(#[from] publish_custom_event_events::Error), - #[error(transparent)] - PublishEvents(#[from] publish_events::Error), } impl Client { + pub fn publish_event_grid_events(&self, events: impl Into>) -> publish_event_grid_events::Builder { + publish_event_grid_events::Builder { + client: self.clone(), + events: events.into(), + } + } pub fn publish_cloud_event_events(&self, events: impl Into>) -> publish_cloud_event_events::Builder { publish_cloud_event_events::Builder { client: self.clone(), @@ -100,14 +106,8 @@ impl Client { events: events.into(), } } - pub fn publish_events(&self, events: impl Into>) -> publish_events::Builder { - publish_events::Builder { - client: self.clone(), - events: events.into(), - } - } } -pub mod publish_cloud_event_events { +pub mod publish_event_grid_events { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -131,17 +131,12 @@ pub mod publish_cloud_event_events { #[derive(Clone)] pub struct Builder { pub(crate) client: super::Client, - pub(crate) events: Vec, - pub(crate) aeg_channel_name: Option, + pub(crate) events: Vec, } impl Builder { - pub fn aeg_channel_name(mut self, aeg_channel_name: impl Into) -> Self { - self.aeg_channel_name = Some(aeg_channel_name.into()); - self - } pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = &format!("{}/api/events?overload=cloudEvent", self.client.endpoint(),); + let url_str = &format!("{}?overload=EventGridEvent", self.client.endpoint(),); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -154,9 +149,6 @@ pub mod publish_cloud_event_events { url.query_pairs_mut().append_pair("api-version", "2018-01-01"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.events).map_err(Error::Serialize)?; - if let Some(aeg_channel_name) = &self.aeg_channel_name { - req_builder = req_builder.header("aeg-channel-name", aeg_channel_name); - } req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -169,7 +161,7 @@ pub mod publish_cloud_event_events { } } } -pub mod publish_custom_event_events { +pub mod publish_cloud_event_events { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -193,12 +185,17 @@ pub mod publish_custom_event_events { #[derive(Clone)] pub struct Builder { pub(crate) client: super::Client, - pub(crate) events: Vec, + pub(crate) events: Vec, + pub(crate) aeg_channel_name: Option, } impl Builder { + pub fn aeg_channel_name(mut self, aeg_channel_name: impl Into) -> Self { + self.aeg_channel_name = Some(aeg_channel_name.into()); + self + } pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = &format!("{}/api/events?overload=customEvent", self.client.endpoint(),); + let url_str = &format!("{}?overload=cloudEvent", self.client.endpoint(),); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); @@ -211,6 +208,9 @@ pub mod publish_custom_event_events { url.query_pairs_mut().append_pair("api-version", "2018-01-01"); req_builder = req_builder.header("content-type", "application/json"); let req_body = azure_core::to_json(&self.events).map_err(Error::Serialize)?; + if let Some(aeg_channel_name) = &self.aeg_channel_name { + req_builder = req_builder.header("aeg-channel-name", aeg_channel_name); + } req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; @@ -223,7 +223,7 @@ pub mod publish_custom_event_events { } } } -pub mod publish_events { +pub mod publish_custom_event_events { use super::models; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -247,12 +247,12 @@ pub mod publish_events { #[derive(Clone)] pub struct Builder { pub(crate) client: super::Client, - pub(crate) events: Vec, + pub(crate) events: Vec, } impl Builder { pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { Box::pin(async move { - let url_str = &format!("{}/api/events", self.client.endpoint(),); + let url_str = &format!("{}?overload=customEvent", self.client.endpoint(),); let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); diff --git a/services/svc/filestorage/Cargo.toml b/services/svc/filestorage/Cargo.toml index fea447432b..8d51c5c686 100644 --- a/services/svc/filestorage/Cargo.toml +++ b/services/svc/filestorage/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_filestorage" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/graphrbac/Cargo.toml b/services/svc/graphrbac/Cargo.toml index 79bd42b5ef..d3290acea1 100644 --- a/services/svc/graphrbac/Cargo.toml +++ b/services/svc/graphrbac/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_graphrbac" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/imds/Cargo.toml b/services/svc/imds/Cargo.toml index 7fe80292df..e30115098f 100644 --- a/services/svc/imds/Cargo.toml +++ b/services/svc/imds/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_imds" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/iotcentral/Cargo.toml b/services/svc/iotcentral/Cargo.toml index 884b79edc2..36649f9903 100644 --- a/services/svc/iotcentral/Cargo.toml +++ b/services/svc/iotcentral/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_iotcentral" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-04-30-preview", "package-1_0"] +features = ["no-default-tag", "package-1_1-preview", "package-2021-04-30-preview", "package-1_0"] [features] -default = ["package-1_1-preview", "enable_reqwest"] +default = ["package-1_2-preview", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-1_2-preview" = [] "package-1_1-preview" = [] "package-2021-04-30-preview" = [] "package-1_0" = [] diff --git a/services/svc/iotcentral/README.md b/services/svc/iotcentral/README.md index f2110abfb7..20ea4a2585 100644 --- a/services/svc/iotcentral/README.md +++ b/services/svc/iotcentral/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/iotcentral To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-1.1-preview`. +The default tag is `package-1.2-preview`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-1.2-preview` has 92 operations from 1 API versions: `1.2-preview`. Use crate feature `package-1_2-preview` to enable. The operations will be in the `package_1_2_preview` module. - `package-1.1-preview` has 88 operations from 1 API versions: `1.1-preview`. Use crate feature `package-1_1-preview` to enable. The operations will be in the `package_1_1_preview` module. - `package-2021-04-30-preview` has 71 operations from 1 API versions: `preview`. Use crate feature `package-2021-04-30-preview` to enable. The operations will be in the `package_2021_04_30_preview` module. - `package-1.0` has 53 operations from 1 API versions: `1.0`. Use crate feature `package-1_0` to enable. The operations will be in the `package_1_0` module. \ No newline at end of file diff --git a/services/svc/iotcentral/src/lib.rs b/services/svc/iotcentral/src/lib.rs index bc321af07e..ca1dd62b58 100644 --- a/services/svc/iotcentral/src/lib.rs +++ b/services/svc/iotcentral/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-1_2-preview")] +pub mod package_1_2_preview; +#[cfg(all(feature = "package-1_2-preview", not(feature = "no-default-tag")))] +pub use package_1_2_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-1_1-preview")] pub mod package_1_1_preview; #[cfg(all(feature = "package-1_1-preview", not(feature = "no-default-tag")))] diff --git a/services/svc/iotcentral/src/package_1_2_preview/mod.rs b/services/svc/iotcentral/src/package_1_2_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/iotcentral/src/package_1_2_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/iotcentral/src/package_1_2_preview/models.rs b/services/svc/iotcentral/src/package_1_2_preview/models.rs new file mode 100644 index 0000000000..f7cf67516e --- /dev/null +++ b/services/svc/iotcentral/src/package_1_2_preview/models.rs @@ -0,0 +1,1647 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The active directory group user definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdGroupUser { + #[serde(flatten)] + pub user: User, + #[doc = "The AAD tenant ID of the AD Group."] + #[serde(rename = "tenantId")] + pub tenant_id: String, + #[doc = "The AAD object ID of the AD Group."] + #[serde(rename = "objectId")] + pub object_id: String, +} +impl AdGroupUser { + pub fn new(user: User, tenant_id: String, object_id: String) -> Self { + Self { + user, + tenant_id, + object_id, + } + } +} +#[doc = "Can be anything: string, number, array, object, etc. (except `null`)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AnyValue {} +impl AnyValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The access token definition for public API."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiToken { + #[serde(flatten)] + pub permission: Permission, + #[doc = "Unique ID of the API token."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Value of the API token."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub token: Option, + #[doc = "String-formatted date representing the time when the token expires."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expiry: Option, +} +impl ApiToken { + pub fn new(permission: Permission) -> Self { + Self { + permission, + id: None, + token: None, + expiry: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiTokenCollection { + #[doc = "The collection of API tokens."] + pub value: Vec, + #[doc = "URL to get the next page of API tokens."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ApiTokenCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The device attestation information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Attestation { + #[doc = "Type of the attestation."] + #[serde(rename = "type")] + pub type_: String, +} +impl Attestation { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The blob storage destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobStorageV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The authentication definition of blob storage destination."] + pub authorization: BlobStorageV1DestinationAuth, +} +impl BlobStorageV1Destination { + pub fn new(destination: Destination, authorization: BlobStorageV1DestinationAuth) -> Self { + Self { + destination, + authorization, + } + } +} +#[doc = "The authentication definition of blob storage destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobStorageV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl BlobStorageV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The authentication definition with connection string of blob storage destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobStorageV1DestinationConnectionStringAuth { + #[serde(flatten)] + pub blob_storage_v1_destination_auth: BlobStorageV1DestinationAuth, + #[doc = "The connection string for accessing the blob storage account."] + #[serde(rename = "connectionString")] + pub connection_string: String, + #[doc = "Name of the container where data should be written in the storage account."] + #[serde(rename = "containerName")] + pub container_name: String, +} +impl BlobStorageV1DestinationConnectionStringAuth { + pub fn new(blob_storage_v1_destination_auth: BlobStorageV1DestinationAuth, connection_string: String, container_name: String) -> Self { + Self { + blob_storage_v1_destination_auth, + connection_string, + container_name, + } + } +} +#[doc = "The authentication definition with system assigned managed identity of blob storage destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobStorageV1DestinationSystemAssignedManagedIdentityAuth { + #[serde(flatten)] + pub blob_storage_v1_destination_auth: BlobStorageV1DestinationAuth, + #[doc = "The storage account's blob service endpoint URL."] + #[serde(rename = "endpointUri")] + pub endpoint_uri: String, + #[doc = "Name of the container where data should be written in the storage account."] + #[serde(rename = "containerName")] + pub container_name: String, +} +impl BlobStorageV1DestinationSystemAssignedManagedIdentityAuth { + pub fn new(blob_storage_v1_destination_auth: BlobStorageV1DestinationAuth, endpoint_uri: String, container_name: String) -> Self { + Self { + blob_storage_v1_destination_auth, + endpoint_uri, + container_name, + } + } +} +#[doc = "The capability job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CapabilityJobData { + #[doc = "The device template which defines the target capability for the job."] + pub target: String, + #[doc = "The path to the target capability within the device template."] + pub path: String, + #[doc = "Can be anything: string, number, array, object, etc. (except `null`)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl CapabilityJobData { + pub fn new(target: String, path: String) -> Self { + Self { target, path, value: None } + } +} +#[doc = "The cloud property job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudPropertyJobData { + #[serde(flatten)] + pub job_data: JobData, + #[serde(flatten)] + pub capability_job_data: CapabilityJobData, +} +impl CloudPropertyJobData { + pub fn new(job_data: JobData, capability_job_data: CapabilityJobData) -> Self { + Self { + job_data, + capability_job_data, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Collection { + #[doc = "The collection of entities."] + pub value: Vec, + #[doc = "URL to get the next page of entities."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl Collection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The command job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommandJobData { + #[serde(flatten)] + pub job_data: JobData, + #[serde(flatten)] + pub capability_job_data: CapabilityJobData, +} +impl CommandJobData { + pub fn new(job_data: JobData, capability_job_data: CapabilityJobData) -> Self { + Self { + job_data, + capability_job_data, + } + } +} +#[doc = "The azure data explorer destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataExplorerV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The resource URI of the Data Explorer instance."] + #[serde(rename = "clusterUrl")] + pub cluster_url: String, + #[doc = "Name Data Explorer database where data should be written."] + pub database: String, + #[doc = "The table within the Data Explorer database that will receive the data."] + pub table: String, + #[doc = "The authentication definition of azure data explorer destination."] + pub authorization: DataExplorerV1DestinationAuth, +} +impl DataExplorerV1Destination { + pub fn new( + destination: Destination, + cluster_url: String, + database: String, + table: String, + authorization: DataExplorerV1DestinationAuth, + ) -> Self { + Self { + destination, + cluster_url, + database, + table, + authorization, + } + } +} +#[doc = "The authentication definition of azure data explorer destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataExplorerV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl DataExplorerV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The authentication definition with service principal of azure data explorer destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataExplorerV1DestinationServicePrincipalAuth { + #[serde(flatten)] + pub data_explorer_v1_destination_auth: DataExplorerV1DestinationAuth, + #[doc = "Service Principal client ID."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "Service Principal tenant ID."] + #[serde(rename = "tenantId")] + pub tenant_id: String, + #[doc = "Service Principal client secret."] + #[serde(rename = "clientSecret")] + pub client_secret: String, +} +impl DataExplorerV1DestinationServicePrincipalAuth { + pub fn new( + data_explorer_v1_destination_auth: DataExplorerV1DestinationAuth, + client_id: String, + tenant_id: String, + client_secret: String, + ) -> Self { + Self { + data_explorer_v1_destination_auth, + client_id, + tenant_id, + client_secret, + } + } +} +#[doc = "The authentication definition with system assigned managed identity of azure data explorer destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataExplorerV1DestinationSystemAssignedManagedIdentityAuth { + #[serde(flatten)] + pub data_explorer_v1_destination_auth: DataExplorerV1DestinationAuth, +} +impl DataExplorerV1DestinationSystemAssignedManagedIdentityAuth { + pub fn new(data_explorer_v1_destination_auth: DataExplorerV1DestinationAuth) -> Self { + Self { + data_explorer_v1_destination_auth, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataExportError { + #[doc = "The code for the error that occurred."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The description of the error that occurred."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl DataExportError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The data export status definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataExportStatus { + #[doc = "Indication of the current health and operation of the export or destination."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Errors encountered by the export or destination."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub errors: Vec, + #[doc = "The timestamp of the last message that was sent to the export or destination."] + #[serde(rename = "lastExportTime", default, skip_serializing_if = "Option::is_none")] + pub last_export_time: Option, +} +impl DataExportStatus { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Destination { + #[serde(flatten)] + pub data_export_status: DataExportStatus, + #[doc = "Unique ID of the destination."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the destination."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "The type of destination configuration."] + #[serde(rename = "type")] + pub type_: String, +} +impl Destination { + pub fn new(display_name: String, type_: String) -> Self { + Self { + data_export_status: DataExportStatus::default(), + id: None, + display_name, + type_, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DestinationCollection { + #[doc = "The collection of destinations."] + pub value: Vec, + #[doc = "URL to get the next page of destinations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DestinationCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The destination export definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DestinationExport { + #[serde(flatten)] + pub export: Export, + #[doc = "Query for transforming the message structure to a particular output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub transform: Option, +} +impl DestinationExport { + pub fn new(export: Export) -> Self { + Self { export, transform: None } + } +} +#[doc = "The destination reference definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DestinationReference { + #[doc = "The ID of the destination where data should be sent."] + pub id: String, + #[doc = "Query for transforming the message structure to a particular output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub transform: Option, +} +impl DestinationReference { + pub fn new(id: String) -> Self { + Self { id, transform: None } + } +} +#[doc = "The device definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Device { + #[doc = "Unique ID of the device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "ETag used to prevent conflict in device updates."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Display name of the device."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The device template definition for the device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub template: Option, + #[doc = "Whether the device connection to IoT Central has been enabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "Whether resources have been allocated for the device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provisioned: Option, + #[doc = "Whether the device is simulated."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub simulated: Option, + #[doc = "List of organization IDs that the device is a part of."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub organizations: Vec, +} +impl Device { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceCollection { + #[doc = "The collection of devices."] + pub value: Vec, + #[doc = "URL to get the next page of devices."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeviceCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The device command definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceCommand { + #[doc = "The request ID of the device command execution."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Connection timeout in seconds to wait for a disconnected device to come online. Defaults to 0 seconds."] + #[serde(rename = "connectionTimeout", default, skip_serializing_if = "Option::is_none")] + pub connection_timeout: Option, + #[doc = "Response timeout in seconds to wait for a command completion on a device. Defaults to 30 seconds."] + #[serde(rename = "responseTimeout", default, skip_serializing_if = "Option::is_none")] + pub response_timeout: Option, + #[doc = "The payload for the device command."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub request: Option, + #[doc = "The payload of the device command response."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub response: Option, + #[doc = "The status code of the device command response."] + #[serde(rename = "responseCode", default, skip_serializing_if = "Option::is_none")] + pub response_code: Option, +} +impl DeviceCommand { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceCommandCollection { + #[doc = "The collection of device command executions."] + pub value: Vec, + #[doc = "URL to get the next page of device command executions."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeviceCommandCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The device credentials definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceCredentials { + #[doc = "ID scope for connecting to the IoT Central application."] + #[serde(rename = "idScope")] + pub id_scope: String, + #[doc = "The symmetric key definition."] + #[serde(rename = "symmetricKey", default, skip_serializing_if = "Option::is_none")] + pub symmetric_key: Option, + #[doc = "The X509 definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub x509: Option, + #[doc = "The trusted platform module definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tpm: Option, +} +impl DeviceCredentials { + pub fn new(id_scope: String) -> Self { + Self { + id_scope, + symmetric_key: None, + x509: None, + tpm: None, + } + } +} +#[doc = "The device group definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceGroup { + #[doc = "Unique ID of the device group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the device group."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Query defining which devices should be in this group, [Query Language Reference](https://aka.ms/iotcquery)."] + pub filter: String, + #[doc = "Short summary of device group."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "ETag used to prevent conflict in device group updates."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "List of organization IDs of the device group."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub organizations: Vec, +} +impl DeviceGroup { + pub fn new(display_name: String, filter: String) -> Self { + Self { + id: None, + display_name, + filter, + description: None, + etag: None, + organizations: Vec::new(), + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceGroupCollection { + #[doc = "The collection of device groups."] + pub value: Vec, + #[doc = "URL to get the next page of device groups."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeviceGroupCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Property values associated with the device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceProperties {} +impl DeviceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An object representing the relationship between an upstream and a downstream device."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceRelationship { + #[doc = "The unique identifier of this relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name which describes this relationship between given devices from source device template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The device ID of the source (parent) device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The device ID of the target (child) device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl DeviceRelationship { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceRelationshipCollection { + #[doc = "The collection of device relationships."] + pub value: Vec, + #[doc = "URL to get the next page of device relationships."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeviceRelationshipCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The device telemetry definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeviceTelemetry { + #[doc = "The last known value of this device telemetry."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "String-formatted date representing the time when the telemetry value was sent."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timestamp: Option, +} +impl DeviceTelemetry { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The device template definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceTemplate { + #[doc = "Unique ID of the device template."] + #[serde(rename = "@id", default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The JSON-LD types of this device template."] + #[serde(rename = "@type")] + pub type_: Vec, + #[doc = "ETag used to prevent conflict in device template updates."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Display name of the device template."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Detailed description of the device template."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The capability model utilized by this device template."] + #[serde(rename = "capabilityModel")] + pub capability_model: serde_json::Value, + #[doc = "Deployment manifest associated to this device template."] + #[serde(rename = "deploymentManifest", default, skip_serializing_if = "Option::is_none")] + pub deployment_manifest: Option, +} +impl DeviceTemplate { + pub fn new(type_: Vec, capability_model: serde_json::Value) -> Self { + Self { + id: None, + type_, + etag: None, + display_name: None, + description: None, + capability_model, + deployment_manifest: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceTemplateCollection { + #[doc = "The collection of device templates."] + pub value: Vec, + #[doc = "URL to get the next page of device templates."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DeviceTemplateCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The device template migration job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeviceTemplateMigrationJobData { + #[serde(flatten)] + pub job_data: JobData, + #[doc = "The target device template to which devices will be migrated."] + pub template: String, +} +impl DeviceTemplateMigrationJobData { + pub fn new(job_data: JobData, template: String) -> Self { + Self { job_data, template } + } +} +#[doc = "The email user definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EmailUser { + #[serde(flatten)] + pub user: User, + #[doc = "Email address of the user."] + pub email: String, +} +impl EmailUser { + pub fn new(user: User, email: String) -> Self { + Self { user, email } + } +} +#[doc = "The enrichment definition for data export."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Enrichment { + #[doc = "The device template or interface which defines the target capability for the enrichment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The path to the target capability within the device template or the system property to use."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The raw value used for the enrichment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl Enrichment { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error model definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Error { + #[doc = "The error details definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl Error { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The error details definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorDetails { + #[doc = "Error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Error message details."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "Correlation Id for current request."] + #[serde(rename = "requestId", default, skip_serializing_if = "Option::is_none")] + pub request_id: Option, + #[doc = "The time that request failed."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, +} +impl ErrorDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The event hub destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventHubsV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The authentication definition for event hub destination."] + pub authorization: EventHubsV1DestinationAuth, +} +impl EventHubsV1Destination { + pub fn new(destination: Destination, authorization: EventHubsV1DestinationAuth) -> Self { + Self { + destination, + authorization, + } + } +} +#[doc = "The authentication definition for event hub destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventHubsV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl EventHubsV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The authentication definition with connection string for event hub destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventHubsV1DestinationConnectionStringAuth { + #[serde(flatten)] + pub event_hubs_v1_destination_auth: EventHubsV1DestinationAuth, + #[doc = "The connection string for accessing the Event Hubs namespace, including the `EntityPath` of the event hub."] + #[serde(rename = "connectionString")] + pub connection_string: String, +} +impl EventHubsV1DestinationConnectionStringAuth { + pub fn new(event_hubs_v1_destination_auth: EventHubsV1DestinationAuth, connection_string: String) -> Self { + Self { + event_hubs_v1_destination_auth, + connection_string, + } + } +} +#[doc = "The authentication definition with system assigned managed identity for event hub destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EventHubsV1DestinationSystemAssignedManagedIdentityAuth { + #[serde(flatten)] + pub event_hubs_v1_destination_auth: EventHubsV1DestinationAuth, + #[doc = "The host name of the Event Hubs namespace."] + #[serde(rename = "hostName")] + pub host_name: String, + #[doc = "The Event Hubs instance name."] + #[serde(rename = "eventHubName")] + pub event_hub_name: String, +} +impl EventHubsV1DestinationSystemAssignedManagedIdentityAuth { + pub fn new(event_hubs_v1_destination_auth: EventHubsV1DestinationAuth, host_name: String, event_hub_name: String) -> Self { + Self { + event_hubs_v1_destination_auth, + host_name, + event_hub_name, + } + } +} +#[doc = "The data export definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Export { + #[serde(flatten)] + pub data_export_status: DataExportStatus, + #[doc = "Unique ID of the export."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the export."] + #[serde(rename = "displayName")] + pub display_name: String, + #[doc = "Toggle to start/stop an export from sending data."] + pub enabled: bool, + #[doc = "The type of data to export."] + pub source: export::Source, + #[doc = "Query defining which events from the source should be exported."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[doc = "Additional pieces of information to include with each sent message. Data is represented as a set of key/value pairs, where the key is the name of the enrichment that will appear in the output message and the value identifies the data to send."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enrichments: Option, + #[doc = "The list of destinations to which the export should send data."] + pub destinations: Vec, +} +impl Export { + pub fn new(display_name: String, enabled: bool, source: export::Source, destinations: Vec) -> Self { + Self { + data_export_status: DataExportStatus::default(), + id: None, + display_name, + enabled, + source, + filter: None, + enrichments: None, + destinations, + } + } +} +pub mod export { + use super::*; + #[doc = "The type of data to export."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Source { + #[serde(rename = "telemetry")] + Telemetry, + #[serde(rename = "properties")] + Properties, + #[serde(rename = "deviceLifecycle")] + DeviceLifecycle, + #[serde(rename = "deviceTemplateLifecycle")] + DeviceTemplateLifecycle, + #[serde(rename = "deviceConnectivity")] + DeviceConnectivity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportCollection { + #[doc = "The collection of exports."] + pub value: Vec, + #[doc = "URL to get the next page of exports."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl ExportCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The export destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportDestination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "Query for transforming the message structure to a particular output."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub transform: Option, +} +impl ExportDestination { + pub fn new(destination: Destination) -> Self { + Self { + destination, + transform: None, + } + } +} +#[doc = "The file upload configuration for application."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileUpload { + #[doc = "The storage account name where to upload the file to"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub account: Option, + #[doc = "The connection string used to configure the storage account"] + #[serde(rename = "connectionString")] + pub connection_string: String, + #[doc = "The name of the container inside the storage account"] + pub container: String, + #[doc = "ISO 8601 duration standard, The amount of time the device’s request to upload a file is valid before it expires."] + #[serde(rename = "sasTtl", default, skip_serializing_if = "Option::is_none")] + pub sas_ttl: Option, + #[doc = "The state of the file upload configuration"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "ETag used to prevent conflict with multiple uploads"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl FileUpload { + pub fn new(connection_string: String, container: String) -> Self { + Self { + account: None, + connection_string, + container, + sas_ttl: None, + state: None, + etag: None, + } + } +} +pub mod file_upload { + use super::*; + #[doc = "The state of the file upload configuration"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "pending")] + Pending, + #[serde(rename = "updating")] + Updating, + #[serde(rename = "deleting")] + Deleting, + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, + } +} +#[doc = "The job definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Job { + #[doc = "Unique ID of the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the job."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "Detailed description of the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The ID of the device group on which to execute the job."] + pub group: String, + #[doc = "The job batch definition for job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub batch: Option, + #[doc = "The job cancellation threshold definition for job."] + #[serde(rename = "cancellationThreshold", default, skip_serializing_if = "Option::is_none")] + pub cancellation_threshold: Option, + #[doc = "The capabilities being updated by the job and the values with which they are being updated."] + pub data: Vec, + #[doc = "Indicates whether the job is starting, running, etc."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "List of organizations of the job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub organizations: Vec, +} +impl Job { + pub fn new(group: String, data: Vec) -> Self { + Self { + id: None, + display_name: None, + description: None, + group, + batch: None, + cancellation_threshold: None, + data, + status: None, + organizations: Vec::new(), + } + } +} +#[doc = "The job batch definition for job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobBatch { + #[doc = "Whether batching is done on a specified number of devices or a percentage of the total devices."] + #[serde(rename = "type")] + pub type_: job_batch::Type, + #[doc = "The number or percentage of devices on which batching is done."] + pub value: f64, +} +impl JobBatch { + pub fn new(type_: job_batch::Type, value: f64) -> Self { + Self { type_, value } + } +} +pub mod job_batch { + use super::*; + #[doc = "Whether batching is done on a specified number of devices or a percentage of the total devices."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "number")] + Number, + #[serde(rename = "percentage")] + Percentage, + } +} +#[doc = "The job cancellation threshold definition for job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobCancellationThreshold { + #[doc = "Whether the cancellation threshold is per a specified number of devices or a percentage of the total devices."] + #[serde(rename = "type")] + pub type_: job_cancellation_threshold::Type, + #[doc = "The number or percentage of devices on which the cancellation threshold is applied."] + pub value: f64, + #[doc = "Whether the cancellation threshold applies per-batch or to the overall job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub batch: Option, +} +impl JobCancellationThreshold { + pub fn new(type_: job_cancellation_threshold::Type, value: f64) -> Self { + Self { type_, value, batch: None } + } +} +pub mod job_cancellation_threshold { + use super::*; + #[doc = "Whether the cancellation threshold is per a specified number of devices or a percentage of the total devices."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "number")] + Number, + #[serde(rename = "percentage")] + Percentage, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobCollection { + #[doc = "The collection of jobs."] + pub value: Vec, + #[doc = "URL to get the next page of jobs."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl JobCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobData { + #[doc = "Type of the job data."] + #[serde(rename = "type")] + pub type_: String, +} +impl JobData { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The job status definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct JobDeviceStatus { + #[doc = "ID of the device whose job status is being provided."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Indicates whether the job is starting, running, etc. for the given device."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl JobDeviceStatus { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobDeviceStatusCollection { + #[doc = "The collection of job device statuses."] + pub value: Vec, + #[doc = "URL to get the next page of job device statuses."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl JobDeviceStatusCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The organization definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Organization { + #[doc = "Unique ID of the organization."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the organization."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "ID of the parent of the organization, for creation of top level organizations, this field is not required."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parent: Option, +} +impl Organization { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrganizationCollection { + #[doc = "The collection of organizations."] + pub value: Vec, + #[doc = "URL to get the next page of organizations."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl OrganizationCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The permission definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Permission { + #[doc = "List of role assignments that specify the permissions to access the application."] + pub roles: Vec, +} +impl Permission { + pub fn new(roles: Vec) -> Self { + Self { roles } + } +} +#[doc = "The property job data definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PropertyJobData { + #[serde(flatten)] + pub job_data: JobData, + #[serde(flatten)] + pub capability_job_data: CapabilityJobData, +} +impl PropertyJobData { + pub fn new(job_data: JobData, capability_job_data: CapabilityJobData) -> Self { + Self { + job_data, + capability_job_data, + } + } +} +#[doc = "The query request payload definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryRequest { + #[doc = "Query to be executed."] + pub query: String, +} +impl QueryRequest { + pub fn new(query: String) -> Self { + Self { query } + } +} +#[doc = "The query response payload definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QueryResponse { + pub results: Vec, +} +impl QueryResponse { + pub fn new(results: Vec) -> Self { + Self { results } + } +} +#[doc = "The user role definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Role { + #[doc = "Unique ID of the role."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Display name of the role."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, +} +impl Role { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The user role assignment definition associated with user."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleAssignment { + #[doc = "ID of the role for this role assignment."] + pub role: String, + #[doc = "ID of the organization for this role assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization: Option, +} +impl RoleAssignment { + pub fn new(role: String) -> Self { + Self { role, organization: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleCollection { + #[doc = "The collection of roles."] + pub value: Vec, + #[doc = "URL to get the next page of roles."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RoleCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The service bus queue destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusQueueV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The authentication definition for service bus queue destination."] + pub authorization: ServiceBusQueueV1DestinationAuth, +} +impl ServiceBusQueueV1Destination { + pub fn new(destination: Destination, authorization: ServiceBusQueueV1DestinationAuth) -> Self { + Self { + destination, + authorization, + } + } +} +#[doc = "The authentication definition for service bus queue destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusQueueV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl ServiceBusQueueV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The authentication definition with connection string for service bus queue destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusQueueV1DestinationConnectionStringAuth { + #[serde(flatten)] + pub service_bus_queue_v1_destination_auth: ServiceBusQueueV1DestinationAuth, + #[doc = "The connection string for accessing the Service Bus namespace, including the `EntityPath` of the queue."] + #[serde(rename = "connectionString")] + pub connection_string: String, +} +impl ServiceBusQueueV1DestinationConnectionStringAuth { + pub fn new(service_bus_queue_v1_destination_auth: ServiceBusQueueV1DestinationAuth, connection_string: String) -> Self { + Self { + service_bus_queue_v1_destination_auth, + connection_string, + } + } +} +#[doc = "The authentication definition with system assigned managed identity for service bus queue destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusQueueV1DestinationSystemAssignedManagedIdentityAuth { + #[serde(flatten)] + pub service_bus_queue_v1_destination_auth: ServiceBusQueueV1DestinationAuth, + #[doc = "The host name of the Service Bus namespace."] + #[serde(rename = "hostName")] + pub host_name: String, + #[doc = "The Service Bus queue name."] + #[serde(rename = "queueName")] + pub queue_name: String, +} +impl ServiceBusQueueV1DestinationSystemAssignedManagedIdentityAuth { + pub fn new(service_bus_queue_v1_destination_auth: ServiceBusQueueV1DestinationAuth, host_name: String, queue_name: String) -> Self { + Self { + service_bus_queue_v1_destination_auth, + host_name, + queue_name, + } + } +} +#[doc = "The service bus topic destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusTopicV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The authentication definition for service bus topic destination."] + pub authorization: ServiceBusTopicV1DestinationAuth, +} +impl ServiceBusTopicV1Destination { + pub fn new(destination: Destination, authorization: ServiceBusTopicV1DestinationAuth) -> Self { + Self { + destination, + authorization, + } + } +} +#[doc = "The authentication definition for service bus topic destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusTopicV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl ServiceBusTopicV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The authentication definition with connection string for service bus topic destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusTopicV1DestinationConnectionStringAuth { + #[serde(flatten)] + pub service_bus_topic_v1_destination_auth: ServiceBusTopicV1DestinationAuth, + #[doc = "The connection string for accessing the Service Bus namespace, including the `EntityPath` of the topic."] + #[serde(rename = "connectionString")] + pub connection_string: String, +} +impl ServiceBusTopicV1DestinationConnectionStringAuth { + pub fn new(service_bus_topic_v1_destination_auth: ServiceBusTopicV1DestinationAuth, connection_string: String) -> Self { + Self { + service_bus_topic_v1_destination_auth, + connection_string, + } + } +} +#[doc = "The authentication definition with system assigned managed identity for service bus topic destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceBusTopicV1DestinationSystemAssignedManagedIdentityAuth { + #[serde(flatten)] + pub service_bus_topic_v1_destination_auth: ServiceBusTopicV1DestinationAuth, + #[doc = "The host name of the Service Bus namespace."] + #[serde(rename = "hostName")] + pub host_name: String, + #[doc = "The Service Bus topic name."] + #[serde(rename = "topicName")] + pub topic_name: String, +} +impl ServiceBusTopicV1DestinationSystemAssignedManagedIdentityAuth { + pub fn new(service_bus_topic_v1_destination_auth: ServiceBusTopicV1DestinationAuth, host_name: String, topic_name: String) -> Self { + Self { + service_bus_topic_v1_destination_auth, + host_name, + topic_name, + } + } +} +#[doc = "The service principal user destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicePrincipalUser { + #[serde(flatten)] + pub user: User, + #[doc = "The AAD tenant ID of the service principal."] + #[serde(rename = "tenantId")] + pub tenant_id: String, + #[doc = "The AAD object ID of the service principal."] + #[serde(rename = "objectId")] + pub object_id: String, +} +impl ServicePrincipalUser { + pub fn new(user: User, tenant_id: String, object_id: String) -> Self { + Self { + user, + tenant_id, + object_id, + } + } +} +#[doc = "The symmetric key definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SymmetricKey { + #[doc = "The primary key for this credential."] + #[serde(rename = "primaryKey")] + pub primary_key: String, + #[doc = "The secondary key for this credential."] + #[serde(rename = "secondaryKey")] + pub secondary_key: String, +} +impl SymmetricKey { + pub fn new(primary_key: String, secondary_key: String) -> Self { + Self { + primary_key, + secondary_key, + } + } +} +#[doc = "The symmetric key attestation definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SymmetricKeyAttestation { + #[serde(flatten)] + pub attestation: Attestation, + #[doc = "The symmetric key definition."] + #[serde(rename = "symmetricKey")] + pub symmetric_key: SymmetricKey, +} +impl SymmetricKeyAttestation { + pub fn new(attestation: Attestation, symmetric_key: SymmetricKey) -> Self { + Self { + attestation, + symmetric_key, + } + } +} +#[doc = "The trusted platform module definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Tpm { + #[doc = "The TPM endorsement key for this credential."] + #[serde(rename = "endorsementKey")] + pub endorsement_key: String, +} +impl Tpm { + pub fn new(endorsement_key: String) -> Self { + Self { endorsement_key } + } +} +#[doc = "The trusted platform module attestation definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TpmAttestation { + #[serde(flatten)] + pub attestation: Attestation, + #[doc = "The trusted platform module definition."] + pub tpm: Tpm, +} +impl TpmAttestation { + pub fn new(attestation: Attestation, tpm: Tpm) -> Self { + Self { attestation, tpm } + } +} +#[doc = "The user definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct User { + #[serde(flatten)] + pub permission: Permission, + #[doc = "Unique ID of the user."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Type of the user."] + #[serde(rename = "type")] + pub type_: String, +} +impl User { + pub fn new(permission: Permission, type_: String) -> Self { + Self { + permission, + id: None, + type_, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserCollection { + #[doc = "The collection of users."] + pub value: Vec, + #[doc = "URL to get the next page of users."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl UserCollection { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The webhook destination definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookV1Destination { + #[serde(flatten)] + pub destination: Destination, + #[doc = "The URL to invoke when exporting data."] + pub url: String, + #[doc = "Additional query parameters that should be added to each request."] + #[serde(rename = "queryCustomizations", default, skip_serializing_if = "Option::is_none")] + pub query_customizations: Option, + #[doc = "Additional headers that should be added to each request."] + #[serde(rename = "headerCustomizations", default, skip_serializing_if = "Option::is_none")] + pub header_customizations: Option, + #[doc = "The authentication definition for webhook destination."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authorization: Option, +} +impl WebhookV1Destination { + pub fn new(destination: Destination, url: String) -> Self { + Self { + destination, + url, + query_customizations: None, + header_customizations: None, + authorization: None, + } + } +} +#[doc = "The authentication definition for webhook destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookV1DestinationAuth { + #[doc = "The kind of authentication to use."] + #[serde(rename = "type")] + pub type_: String, +} +impl WebhookV1DestinationAuth { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The customization definition for webhook destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookV1DestinationCustomization { + #[doc = "The value to use for this webhook customization."] + pub value: String, + #[doc = "Whether to consider the value to be a secret and hide it when retrieving the destination configuration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret: Option, +} +impl WebhookV1DestinationCustomization { + pub fn new(value: String) -> Self { + Self { value, secret: None } + } +} +#[doc = "The authentication definition with header for webhook destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookV1DestinationHeaderAuth { + #[serde(flatten)] + pub webhook_v1_destination_auth: WebhookV1DestinationAuth, + #[doc = "Value to use for the Authorization header when making requests."] + pub value: String, +} +impl WebhookV1DestinationHeaderAuth { + pub fn new(webhook_v1_destination_auth: WebhookV1DestinationAuth, value: String) -> Self { + Self { + webhook_v1_destination_auth, + value, + } + } +} +#[doc = "The authentication definition with OAuth for webhook destination."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebhookV1DestinationOAuthAuth { + #[serde(flatten)] + pub webhook_v1_destination_auth: WebhookV1DestinationAuth, + #[doc = "URL where an access token can be retrieved."] + #[serde(rename = "tokenUrl")] + pub token_url: String, + #[doc = "OAuth2 client ID used when retrieving the token."] + #[serde(rename = "clientId")] + pub client_id: String, + #[doc = "OAuth2 client secret used to retrieve the token."] + #[serde(rename = "clientSecret")] + pub client_secret: String, + #[doc = "OAuth2 audience."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[doc = "OAuth2 scope."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[doc = "Content-Type for the token request."] + #[serde(rename = "requestType", default, skip_serializing_if = "Option::is_none")] + pub request_type: Option, +} +impl WebhookV1DestinationOAuthAuth { + pub fn new(webhook_v1_destination_auth: WebhookV1DestinationAuth, token_url: String, client_id: String, client_secret: String) -> Self { + Self { + webhook_v1_destination_auth, + token_url, + client_id, + client_secret, + audience: None, + scope: None, + request_type: None, + } + } +} +pub mod webhook_v1_destination_o_auth_auth { + use super::*; + #[doc = "Content-Type for the token request."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RequestType { + #[serde(rename = "auto")] + Auto, + #[serde(rename = "json")] + Json, + #[serde(rename = "urlencoded")] + Urlencoded, + } +} +#[doc = "The X509 definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct X509 { + #[doc = "The X509 certificates definition."] + #[serde(rename = "clientCertificates", default, skip_serializing_if = "Option::is_none")] + pub client_certificates: Option, +} +impl X509 { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The X509 attestation definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct X509Attestation { + #[serde(flatten)] + pub attestation: Attestation, + #[doc = "The X509 definition."] + pub x509: X509, +} +impl X509Attestation { + pub fn new(attestation: Attestation, x509: X509) -> Self { + Self { attestation, x509 } + } +} +#[doc = "The X509 certificate definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct X509Certificate { + #[doc = "The string representation of this certificate."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub certificate: Option, + #[doc = "The X509 certificate information definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl X509Certificate { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The X509 certificate information definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct X509CertificateInfo { + #[doc = "The SHA-1 hash value of the certificate."] + #[serde(rename = "sha1Thumbprint")] + pub sha1_thumbprint: String, +} +impl X509CertificateInfo { + pub fn new(sha1_thumbprint: String) -> Self { + Self { sha1_thumbprint } + } +} +#[doc = "The X509 certificates definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct X509Certificates { + #[doc = "The X509 certificate definition."] + pub primary: X509Certificate, + #[doc = "The X509 certificate definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secondary: Option, +} +impl X509Certificates { + pub fn new(primary: X509Certificate) -> Self { + Self { primary, secondary: None } + } +} diff --git a/services/svc/iotcentral/src/package_1_2_preview/operations.rs b/services/svc/iotcentral/src/package_1_2_preview/operations.rs new file mode 100644 index 0000000000..e79e50d024 --- /dev/null +++ b/services/svc/iotcentral/src/package_1_2_preview/operations.rs @@ -0,0 +1,7803 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn api_tokens(&self) -> api_tokens::Client { + api_tokens::Client(self.clone()) + } + pub fn destinations(&self) -> destinations::Client { + destinations::Client(self.clone()) + } + pub fn device_groups(&self) -> device_groups::Client { + device_groups::Client(self.clone()) + } + pub fn device_templates(&self) -> device_templates::Client { + device_templates::Client(self.clone()) + } + pub fn devices(&self) -> devices::Client { + devices::Client(self.clone()) + } + pub fn exports(&self) -> exports::Client { + exports::Client(self.clone()) + } + pub fn file_uploads(&self) -> file_uploads::Client { + file_uploads::Client(self.clone()) + } + pub fn jobs(&self) -> jobs::Client { + jobs::Client(self.clone()) + } + pub fn organizations(&self) -> organizations::Client { + organizations::Client(self.clone()) + } + pub fn query(&self) -> query::Client { + query::Client(self.clone()) + } + pub fn roles(&self) -> roles::Client { + roles::Client(self.clone()) + } + pub fn users(&self) -> users::Client { + users::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + ApiTokens_List(#[from] api_tokens::list::Error), + #[error(transparent)] + ApiTokens_Get(#[from] api_tokens::get::Error), + #[error(transparent)] + ApiTokens_Create(#[from] api_tokens::create::Error), + #[error(transparent)] + ApiTokens_Remove(#[from] api_tokens::remove::Error), + #[error(transparent)] + Destinations_List(#[from] destinations::list::Error), + #[error(transparent)] + Destinations_Get(#[from] destinations::get::Error), + #[error(transparent)] + Destinations_Create(#[from] destinations::create::Error), + #[error(transparent)] + Destinations_Update(#[from] destinations::update::Error), + #[error(transparent)] + Destinations_Remove(#[from] destinations::remove::Error), + #[error(transparent)] + Destinations_ListExports(#[from] destinations::list_exports::Error), + #[error(transparent)] + Exports_List(#[from] exports::list::Error), + #[error(transparent)] + Exports_Get(#[from] exports::get::Error), + #[error(transparent)] + Exports_Create(#[from] exports::create::Error), + #[error(transparent)] + Exports_Update(#[from] exports::update::Error), + #[error(transparent)] + Exports_Remove(#[from] exports::remove::Error), + #[error(transparent)] + Exports_ListDestinations(#[from] exports::list_destinations::Error), + #[error(transparent)] + DeviceGroups_List(#[from] device_groups::list::Error), + #[error(transparent)] + DeviceGroups_Get(#[from] device_groups::get::Error), + #[error(transparent)] + DeviceGroups_Create(#[from] device_groups::create::Error), + #[error(transparent)] + DeviceGroups_Update(#[from] device_groups::update::Error), + #[error(transparent)] + DeviceGroups_Remove(#[from] device_groups::remove::Error), + #[error(transparent)] + DeviceTemplates_List(#[from] device_templates::list::Error), + #[error(transparent)] + DeviceTemplates_Get(#[from] device_templates::get::Error), + #[error(transparent)] + DeviceTemplates_Create(#[from] device_templates::create::Error), + #[error(transparent)] + DeviceTemplates_Update(#[from] device_templates::update::Error), + #[error(transparent)] + DeviceTemplates_Remove(#[from] device_templates::remove::Error), + #[error(transparent)] + Devices_List(#[from] devices::list::Error), + #[error(transparent)] + Devices_Get(#[from] devices::get::Error), + #[error(transparent)] + Devices_Create(#[from] devices::create::Error), + #[error(transparent)] + Devices_Update(#[from] devices::update::Error), + #[error(transparent)] + Devices_Remove(#[from] devices::remove::Error), + #[error(transparent)] + Devices_GetAttestation(#[from] devices::get_attestation::Error), + #[error(transparent)] + Devices_CreateAttestation(#[from] devices::create_attestation::Error), + #[error(transparent)] + Devices_UpdateAttestation(#[from] devices::update_attestation::Error), + #[error(transparent)] + Devices_RemoveAttestation(#[from] devices::remove_attestation::Error), + #[error(transparent)] + Devices_GetCommandHistory(#[from] devices::get_command_history::Error), + #[error(transparent)] + Devices_RunCommand(#[from] devices::run_command::Error), + #[error(transparent)] + Devices_ListComponents(#[from] devices::list_components::Error), + #[error(transparent)] + Devices_GetComponentCommandHistory(#[from] devices::get_component_command_history::Error), + #[error(transparent)] + Devices_RunComponentCommand(#[from] devices::run_component_command::Error), + #[error(transparent)] + Devices_GetComponentProperties(#[from] devices::get_component_properties::Error), + #[error(transparent)] + Devices_ReplaceComponentProperties(#[from] devices::replace_component_properties::Error), + #[error(transparent)] + Devices_UpdateComponentProperties(#[from] devices::update_component_properties::Error), + #[error(transparent)] + Devices_GetComponentTelemetryValue(#[from] devices::get_component_telemetry_value::Error), + #[error(transparent)] + Devices_GetCredentials(#[from] devices::get_credentials::Error), + #[error(transparent)] + Devices_ListModules(#[from] devices::list_modules::Error), + #[error(transparent)] + Devices_GetModuleCommandHistory(#[from] devices::get_module_command_history::Error), + #[error(transparent)] + Devices_RunModuleCommand(#[from] devices::run_module_command::Error), + #[error(transparent)] + Devices_ListModuleComponents(#[from] devices::list_module_components::Error), + #[error(transparent)] + Devices_GetModuleComponentCommandHistory(#[from] devices::get_module_component_command_history::Error), + #[error(transparent)] + Devices_RunModuleComponentCommand(#[from] devices::run_module_component_command::Error), + #[error(transparent)] + Devices_GetModuleComponentProperties(#[from] devices::get_module_component_properties::Error), + #[error(transparent)] + Devices_ReplaceModuleComponentProperties(#[from] devices::replace_module_component_properties::Error), + #[error(transparent)] + Devices_UpdateModuleComponentProperties(#[from] devices::update_module_component_properties::Error), + #[error(transparent)] + Devices_GetModuleComponentTelemetryValue(#[from] devices::get_module_component_telemetry_value::Error), + #[error(transparent)] + Devices_GetModuleProperties(#[from] devices::get_module_properties::Error), + #[error(transparent)] + Devices_ReplaceModuleProperties(#[from] devices::replace_module_properties::Error), + #[error(transparent)] + Devices_UpdateModuleProperties(#[from] devices::update_module_properties::Error), + #[error(transparent)] + Devices_GetModuleTelemetryValue(#[from] devices::get_module_telemetry_value::Error), + #[error(transparent)] + Devices_GetProperties(#[from] devices::get_properties::Error), + #[error(transparent)] + Devices_ReplaceProperties(#[from] devices::replace_properties::Error), + #[error(transparent)] + Devices_UpdateProperties(#[from] devices::update_properties::Error), + #[error(transparent)] + Devices_ListRelationships(#[from] devices::list_relationships::Error), + #[error(transparent)] + Devices_GetRelationship(#[from] devices::get_relationship::Error), + #[error(transparent)] + Devices_CreateRelationship(#[from] devices::create_relationship::Error), + #[error(transparent)] + Devices_UpdateRelationship(#[from] devices::update_relationship::Error), + #[error(transparent)] + Devices_RemoveRelationship(#[from] devices::remove_relationship::Error), + #[error(transparent)] + Devices_GetTelemetryValue(#[from] devices::get_telemetry_value::Error), + #[error(transparent)] + FileUploads_Get(#[from] file_uploads::get::Error), + #[error(transparent)] + FileUploads_Create(#[from] file_uploads::create::Error), + #[error(transparent)] + FileUploads_Update(#[from] file_uploads::update::Error), + #[error(transparent)] + FileUploads_Remove(#[from] file_uploads::remove::Error), + #[error(transparent)] + Jobs_List(#[from] jobs::list::Error), + #[error(transparent)] + Jobs_Get(#[from] jobs::get::Error), + #[error(transparent)] + Jobs_Create(#[from] jobs::create::Error), + #[error(transparent)] + Jobs_GetDevices(#[from] jobs::get_devices::Error), + #[error(transparent)] + Jobs_Rerun(#[from] jobs::rerun::Error), + #[error(transparent)] + Jobs_Resume(#[from] jobs::resume::Error), + #[error(transparent)] + Jobs_Stop(#[from] jobs::stop::Error), + #[error(transparent)] + Organizations_List(#[from] organizations::list::Error), + #[error(transparent)] + Organizations_Get(#[from] organizations::get::Error), + #[error(transparent)] + Organizations_Create(#[from] organizations::create::Error), + #[error(transparent)] + Organizations_Update(#[from] organizations::update::Error), + #[error(transparent)] + Organizations_Remove(#[from] organizations::remove::Error), + #[error(transparent)] + Query_Run(#[from] query::run::Error), + #[error(transparent)] + Roles_List(#[from] roles::list::Error), + #[error(transparent)] + Roles_Get(#[from] roles::get::Error), + #[error(transparent)] + Users_List(#[from] users::list::Error), + #[error(transparent)] + Users_Get(#[from] users::get::Error), + #[error(transparent)] + Users_Create(#[from] users::create::Error), + #[error(transparent)] + Users_Update(#[from] users::update::Error), + #[error(transparent)] + Users_Remove(#[from] users::remove::Error), +} +pub mod api_tokens { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of API tokens in an application. The token value will never be returned for security reasons."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get an API token by ID."] + pub fn get(&self, token_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + token_id: token_id.into(), + } + } + #[doc = "Create a new API token in the application to use in the IoT Central public API. The token value will be returned in the response, and won't be returned again in subsequent requests."] + pub fn create(&self, token_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + token_id: token_id.into(), + body: body.into(), + } + } + #[doc = "Delete an API token."] + pub fn remove(&self, token_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + token_id: token_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/apiTokens", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiTokenCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) token_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/apiTokens/{}", self.client.endpoint(), &self.token_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiToken = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) token_id: String, + pub(crate) body: models::ApiToken, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/apiTokens/{}", self.client.endpoint(), &self.token_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ApiToken = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) token_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/apiTokens/{}", self.client.endpoint(), &self.token_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod destinations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of destinations in an application."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get a destination by ID."] + pub fn get(&self, destination_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + destination_id: destination_id.into(), + } + } + #[doc = "Create or update a destination"] + pub fn create(&self, destination_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + destination_id: destination_id.into(), + body: body.into(), + } + } + #[doc = "Patch a destination."] + pub fn update(&self, destination_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + destination_id: destination_id.into(), + body: body.into(), + } + } + #[doc = "Delete a destination."] + pub fn remove(&self, destination_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + destination_id: destination_id.into(), + } + } + #[doc = "List all exports connected to the given destination."] + pub fn list_exports(&self, destination_id: impl Into) -> list_exports::Builder { + list_exports::Builder { + client: self.0.clone(), + destination_id: destination_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/destinations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DestinationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) destination_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/destinations/{}", self.client.endpoint(), &self.destination_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Destination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) destination_id: String, + pub(crate) body: models::Destination, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/destinations/{}", self.client.endpoint(), &self.destination_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Destination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) destination_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/destinations/{}", self.client.endpoint(), &self.destination_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Destination = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) destination_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/destinations/{}", self.client.endpoint(), &self.destination_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_exports { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) destination_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/dataExport/destinations/{}/exports", + self.client.endpoint(), + &self.destination_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod exports { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of exports in an application."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get an export by ID."] + pub fn get(&self, export_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + export_id: export_id.into(), + } + } + #[doc = "Create or update an export"] + pub fn create(&self, export_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + export_id: export_id.into(), + body: body.into(), + } + } + #[doc = "Patch an export."] + pub fn update(&self, export_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + export_id: export_id.into(), + body: body.into(), + } + } + #[doc = "Delete an export."] + pub fn remove(&self, export_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + export_id: export_id.into(), + } + } + #[doc = "List all destinations connected to the given export."] + pub fn list_destinations(&self, export_id: impl Into) -> list_destinations::Builder { + list_destinations::Builder { + client: self.0.clone(), + export_id: export_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ExportCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) export_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports/{}", self.client.endpoint(), &self.export_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) export_id: String, + pub(crate) body: models::Export, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports/{}", self.client.endpoint(), &self.export_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) export_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports/{}", self.client.endpoint(), &self.export_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Export = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) export_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports/{}", self.client.endpoint(), &self.export_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_destinations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) export_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataExport/exports/{}/destinations", self.client.endpoint(), &self.export_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DestinationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod device_groups { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of device groups in an application."] + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + filter: None, + top: None, + orderby: None, + } + } + #[doc = "Get the device group by ID."] + pub fn get(&self, device_group_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_group_id: device_group_id.into(), + } + } + #[doc = "Create or update a device group"] + pub fn create(&self, device_group_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + device_group_id: device_group_id.into(), + body: body.into(), + } + } + #[doc = "Update a device group via patch"] + pub fn update(&self, device_group_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + device_group_id: device_group_id.into(), + body: body.into(), + } + } + #[doc = "Delete a device group."] + pub fn remove(&self, device_group_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + device_group_id: device_group_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i64) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceGroups", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceGroupCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_group_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceGroups/{}", self.client.endpoint(), &self.device_group_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_group_id: String, + pub(crate) body: models::DeviceGroup, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceGroups/{}", self.client.endpoint(), &self.device_group_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_group_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceGroups/{}", self.client.endpoint(), &self.device_group_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceGroup = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_group_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/deviceGroups/{}", self.client.endpoint(), &self.device_group_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod device_templates { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of device templates in an application with basic ODATA support (top, filter, orderby), [more details](https://aka.ms/iotcentralodatasupport)."] + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + filter: None, + top: None, + orderby: None, + } + } + #[doc = "Get a device template by ID"] + pub fn get(&self, device_template_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_template_id: device_template_id.into(), + } + } + #[doc = "Publish a new device template. Default views will be automatically generated for new device templates created this way."] + pub fn create(&self, device_template_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + device_template_id: device_template_id.into(), + body: body.into(), + } + } + #[doc = "Update the cloud properties and overrides of an existing device template via patch."] + pub fn update(&self, device_template_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + device_template_id: device_template_id.into(), + body: body.into(), + } + } + #[doc = "Delete a device template"] + pub fn remove(&self, device_template_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + device_template_id: device_template_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i64) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceTemplates", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTemplateCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_template_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceTemplates/{}", self.client.endpoint(), &self.device_template_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_template_id: String, + pub(crate) body: models::DeviceTemplate, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceTemplates/{}", self.client.endpoint(), &self.device_template_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_template_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/deviceTemplates/{}", self.client.endpoint(), &self.device_template_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTemplate = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_template_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/deviceTemplates/{}", self.client.endpoint(), &self.device_template_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod devices { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of devices in an application with basic ODATA support (top, filter, orderby), [more details](https://aka.ms/iotcentralodatasupport)."] + pub fn list(&self) -> list::Builder { + list::Builder { + client: self.0.clone(), + filter: None, + top: None, + orderby: None, + } + } + #[doc = "Get a device by ID"] + pub fn get(&self, device_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Create or update a device"] + pub fn create(&self, device_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Update a device via patch"] + pub fn update(&self, device_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Delete a device"] + pub fn remove(&self, device_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Get device attestation"] + pub fn get_attestation(&self, device_id: impl Into) -> get_attestation::Builder { + get_attestation::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Create an individual device attestation"] + pub fn create_attestation( + &self, + device_id: impl Into, + body: impl Into, + ) -> create_attestation::Builder { + create_attestation::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Update an individual device attestation via patch"] + pub fn update_attestation(&self, device_id: impl Into, body: impl Into) -> update_attestation::Builder { + update_attestation::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Remove an individual device attestation"] + pub fn remove_attestation(&self, device_id: impl Into) -> remove_attestation::Builder { + remove_attestation::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Get device command history"] + pub fn get_command_history(&self, device_id: impl Into, command_name: impl Into) -> get_command_history::Builder { + get_command_history::Builder { + client: self.0.clone(), + device_id: device_id.into(), + command_name: command_name.into(), + } + } + #[doc = "Run a device command"] + pub fn run_command( + &self, + device_id: impl Into, + command_name: impl Into, + body: impl Into, + ) -> run_command::Builder { + run_command::Builder { + client: self.0.clone(), + device_id: device_id.into(), + command_name: command_name.into(), + body: body.into(), + } + } + #[doc = "List the components present in a device"] + pub fn list_components(&self, device_id: impl Into) -> list_components::Builder { + list_components::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Get component command history"] + pub fn get_component_command_history( + &self, + device_id: impl Into, + component_name: impl Into, + command_name: impl Into, + ) -> get_component_command_history::Builder { + get_component_command_history::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + command_name: command_name.into(), + } + } + #[doc = "Run a component command"] + pub fn run_component_command( + &self, + device_id: impl Into, + component_name: impl Into, + command_name: impl Into, + body: impl Into, + ) -> run_component_command::Builder { + run_component_command::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + command_name: command_name.into(), + body: body.into(), + } + } + #[doc = "Get device properties for a specific component"] + pub fn get_component_properties( + &self, + device_id: impl Into, + component_name: impl Into, + ) -> get_component_properties::Builder { + get_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + } + } + #[doc = "Replace device properties for a specific component"] + pub fn replace_component_properties( + &self, + device_id: impl Into, + component_name: impl Into, + body: impl Into, + ) -> replace_component_properties::Builder { + replace_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + body: body.into(), + } + } + #[doc = "Update device properties for a specific component via patch"] + pub fn update_component_properties( + &self, + device_id: impl Into, + component_name: impl Into, + body: impl Into, + ) -> update_component_properties::Builder { + update_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + body: body.into(), + } + } + #[doc = "Get component telemetry value"] + pub fn get_component_telemetry_value( + &self, + device_id: impl Into, + component_name: impl Into, + telemetry_name: impl Into, + ) -> get_component_telemetry_value::Builder { + get_component_telemetry_value::Builder { + client: self.0.clone(), + device_id: device_id.into(), + component_name: component_name.into(), + telemetry_name: telemetry_name.into(), + } + } + #[doc = "Get device credentials"] + pub fn get_credentials(&self, device_id: impl Into) -> get_credentials::Builder { + get_credentials::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "List the modules present in a device"] + pub fn list_modules(&self, device_id: impl Into) -> list_modules::Builder { + list_modules::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Get module command history"] + pub fn get_module_command_history( + &self, + device_id: impl Into, + module_name: impl Into, + command_name: impl Into, + ) -> get_module_command_history::Builder { + get_module_command_history::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + command_name: command_name.into(), + } + } + #[doc = "Run a module command"] + pub fn run_module_command( + &self, + device_id: impl Into, + module_name: impl Into, + command_name: impl Into, + body: impl Into, + ) -> run_module_command::Builder { + run_module_command::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + command_name: command_name.into(), + body: body.into(), + } + } + #[doc = "List the components present in a module"] + pub fn list_module_components( + &self, + device_id: impl Into, + module_name: impl Into, + ) -> list_module_components::Builder { + list_module_components::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + } + } + #[doc = "Get module component command history"] + pub fn get_module_component_command_history( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + command_name: impl Into, + ) -> get_module_component_command_history::Builder { + get_module_component_command_history::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + command_name: command_name.into(), + } + } + #[doc = "Run a module component command"] + pub fn run_module_component_command( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + command_name: impl Into, + body: impl Into, + ) -> run_module_component_command::Builder { + run_module_component_command::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + command_name: command_name.into(), + body: body.into(), + } + } + #[doc = "Get module properties for a specific component"] + pub fn get_module_component_properties( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + ) -> get_module_component_properties::Builder { + get_module_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + } + } + #[doc = "Replace module properties for a specific component"] + pub fn replace_module_component_properties( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + body: impl Into, + ) -> replace_module_component_properties::Builder { + replace_module_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + body: body.into(), + } + } + #[doc = "Update module properties for a specific component via patch"] + pub fn update_module_component_properties( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + body: impl Into, + ) -> update_module_component_properties::Builder { + update_module_component_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + body: body.into(), + } + } + #[doc = "Get module component telemetry value"] + pub fn get_module_component_telemetry_value( + &self, + device_id: impl Into, + module_name: impl Into, + component_name: impl Into, + telemetry_name: impl Into, + ) -> get_module_component_telemetry_value::Builder { + get_module_component_telemetry_value::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + component_name: component_name.into(), + telemetry_name: telemetry_name.into(), + } + } + #[doc = "Get module properties"] + pub fn get_module_properties( + &self, + device_id: impl Into, + module_name: impl Into, + ) -> get_module_properties::Builder { + get_module_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + } + } + #[doc = "Replace module properties"] + pub fn replace_module_properties( + &self, + device_id: impl Into, + module_name: impl Into, + body: impl Into, + ) -> replace_module_properties::Builder { + replace_module_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + body: body.into(), + } + } + #[doc = "Update module properties via patch"] + pub fn update_module_properties( + &self, + device_id: impl Into, + module_name: impl Into, + body: impl Into, + ) -> update_module_properties::Builder { + update_module_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + body: body.into(), + } + } + #[doc = "Get module telemetry value"] + pub fn get_module_telemetry_value( + &self, + device_id: impl Into, + module_name: impl Into, + telemetry_name: impl Into, + ) -> get_module_telemetry_value::Builder { + get_module_telemetry_value::Builder { + client: self.0.clone(), + device_id: device_id.into(), + module_name: module_name.into(), + telemetry_name: telemetry_name.into(), + } + } + #[doc = "Get device properties"] + pub fn get_properties(&self, device_id: impl Into) -> get_properties::Builder { + get_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Replace device properties"] + pub fn replace_properties( + &self, + device_id: impl Into, + body: impl Into, + ) -> replace_properties::Builder { + replace_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Update device properties via patch"] + pub fn update_properties(&self, device_id: impl Into, body: impl Into) -> update_properties::Builder { + update_properties::Builder { + client: self.0.clone(), + device_id: device_id.into(), + body: body.into(), + } + } + #[doc = "Given the ID for an upstream device, will return the upstream and the downstream relationships associated with that gateway. These downstream relationships are only those associated with the direct downstream level (they don’t work recursively)."] + pub fn list_relationships(&self, device_id: impl Into) -> list_relationships::Builder { + list_relationships::Builder { + client: self.0.clone(), + device_id: device_id.into(), + } + } + #[doc = "Given the ID for a device and a relationship ID associated with this device, get the details of the relationship."] + pub fn get_relationship(&self, device_id: impl Into, relationship_id: impl Into) -> get_relationship::Builder { + get_relationship::Builder { + client: self.0.clone(), + device_id: device_id.into(), + relationship_id: relationship_id.into(), + } + } + #[doc = "Given the ID for a device and a relationship ID associated with this device, create a new relationship for between the given device and a second device specified in the body."] + pub fn create_relationship( + &self, + device_id: impl Into, + relationship_id: impl Into, + body: impl Into, + ) -> create_relationship::Builder { + create_relationship::Builder { + client: self.0.clone(), + device_id: device_id.into(), + relationship_id: relationship_id.into(), + body: body.into(), + } + } + #[doc = "Patch a given relationship given the relationship ID and a given device ID."] + pub fn update_relationship( + &self, + device_id: impl Into, + relationship_id: impl Into, + body: impl Into, + ) -> update_relationship::Builder { + update_relationship::Builder { + client: self.0.clone(), + device_id: device_id.into(), + relationship_id: relationship_id.into(), + body: body.into(), + } + } + #[doc = "Given the ID for a device and an associated relationship ID, delete the relationship. The given device ID can be that of the upstream or downstream device."] + pub fn remove_relationship( + &self, + device_id: impl Into, + relationship_id: impl Into, + ) -> remove_relationship::Builder { + remove_relationship::Builder { + client: self.0.clone(), + device_id: device_id.into(), + relationship_id: relationship_id.into(), + } + } + #[doc = "Get device telemetry value"] + pub fn get_telemetry_value(&self, device_id: impl Into, telemetry_name: impl Into) -> get_telemetry_value::Builder { + get_telemetry_value::Builder { + client: self.0.clone(), + device_id: device_id.into(), + telemetry_name: telemetry_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter: Option, + pub(crate) top: Option, + pub(crate) orderby: Option, + } + impl Builder { + pub fn filter(mut self, filter: impl Into) -> Self { + self.filter = Some(filter.into()); + self + } + pub fn top(mut self, top: i64) -> Self { + self.top = Some(top); + self + } + pub fn orderby(mut self, orderby: impl Into) -> Self { + self.orderby = Some(orderby.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + if let Some(filter) = &self.filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + if let Some(top) = &self.top { + url.query_pairs_mut().append_pair("$top", &top.to_string()); + } + if let Some(orderby) = &self.orderby { + url.query_pairs_mut().append_pair("$orderby", orderby); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: models::Device, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Device = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_attestation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/attestation", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Attestation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_attestation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: models::Attestation, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/attestation", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Attestation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_attestation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/attestation", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Attestation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_attestation { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/attestation", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_command_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) command_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommandCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_command { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) command_name: String, + pub(crate) body: models::DeviceCommand, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_components { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/components", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Collection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_component_command_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + pub(crate) command_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.component_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommandCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_component_command { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + pub(crate) command_name: String, + pub(crate) body: models::DeviceCommand, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.component_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod replace_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + pub(crate) body: models::DeviceProperties, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_component_telemetry_value { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) component_name: String, + pub(crate) telemetry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/components/{}/telemetry/{}", + self.client.endpoint(), + &self.device_id, + &self.component_name, + &self.telemetry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTelemetry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_credentials { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/credentials", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCredentials = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_modules { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/modules", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Collection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_command_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) command_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommandCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_module_command { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) command_name: String, + pub(crate) body: models::DeviceCommand, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_module_components { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components", + self.client.endpoint(), + &self.device_id, + &self.module_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Collection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_component_command_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + pub(crate) command_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommandCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod run_module_component_command { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + pub(crate) command_name: String, + pub(crate) body: models::DeviceCommand, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/commands/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name, + &self.command_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceCommand = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod replace_module_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + pub(crate) body: models::DeviceProperties, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_module_component_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_component_telemetry_value { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) component_name: String, + pub(crate) telemetry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/components/{}/telemetry/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.component_name, + &self.telemetry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTelemetry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod replace_module_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) body: models::DeviceProperties, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_module_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/properties", + self.client.endpoint(), + &self.device_id, + &self.module_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_module_telemetry_value { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) module_name: String, + pub(crate) telemetry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/modules/{}/telemetry/{}", + self.client.endpoint(), + &self.device_id, + &self.module_name, + &self.telemetry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTelemetry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/properties", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod replace_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: models::DeviceProperties, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/properties", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_properties { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/properties", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_relationships { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/devices/{}/relationships", self.client.endpoint(), &self.device_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceRelationshipCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_relationship { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) relationship_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/relationships/{}", + self.client.endpoint(), + &self.device_id, + &self.relationship_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_relationship { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) relationship_id: String, + pub(crate) body: models::DeviceRelationship, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/relationships/{}", + self.client.endpoint(), + &self.device_id, + &self.relationship_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_relationship { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) relationship_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/relationships/{}", + self.client.endpoint(), + &self.device_id, + &self.relationship_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_relationship { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) relationship_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/relationships/{}", + self.client.endpoint(), + &self.device_id, + &self.relationship_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_telemetry_value { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) device_id: String, + pub(crate) telemetry_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/devices/{}/telemetry/{}", + self.client.endpoint(), + &self.device_id, + &self.telemetry_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DeviceTelemetry = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod file_uploads { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the file upload storage account configuration."] + pub fn get(&self) -> get::Builder { + get::Builder { client: self.0.clone() } + } + #[doc = "Create the file upload storage account configuration."] + pub fn create(&self, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + body: body.into(), + } + } + #[doc = "Update the file upload storage account configuration"] + pub fn update(&self, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + body: body.into(), + } + } + #[doc = "Delete the file upload storage configuration."] + pub fn remove(&self) -> remove::Builder { + remove::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/fileUploads", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FileUpload = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::FileUpload, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/fileUploads", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FileUpload = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/fileUploads", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::FileUpload = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/fileUploads", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod jobs { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of jobs in an application"] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get a job by ID"] + pub fn get(&self, job_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + job_id: job_id.into(), + } + } + #[doc = "Execute a new job"] + pub fn create(&self, job_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + job_id: job_id.into(), + body: body.into(), + } + } + #[doc = "Get device statuses"] + pub fn get_devices(&self, job_id: impl Into) -> get_devices::Builder { + get_devices::Builder { + client: self.0.clone(), + job_id: job_id.into(), + } + } + #[doc = "Rerun a job on failed devices"] + pub fn rerun(&self, job_id: impl Into, rerun_id: impl Into) -> rerun::Builder { + rerun::Builder { + client: self.0.clone(), + job_id: job_id.into(), + rerun_id: rerun_id.into(), + } + } + #[doc = "Resume a stopped job"] + pub fn resume(&self, job_id: impl Into) -> resume::Builder { + resume::Builder { + client: self.0.clone(), + job_id: job_id.into(), + } + } + #[doc = "Stop a running job"] + pub fn stop(&self, job_id: impl Into) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + job_id: job_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/jobs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}", self.client.endpoint(), &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + pub(crate) body: models::Job, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}", self.client.endpoint(), &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_devices { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}/devices", self.client.endpoint(), &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::JobDeviceStatusCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rerun { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + pub(crate) rerun_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}/rerun/{}", self.client.endpoint(), &self.job_id, &self.rerun_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Job = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod resume { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}/resume", self.client.endpoint(), &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) job_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/jobs/{}/stop", self.client.endpoint(), &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod organizations { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of organizations the user has access to in an application"] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get an organization by ID"] + pub fn get(&self, organization_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + organization_id: organization_id.into(), + } + } + #[doc = "Create an organization in the application"] + pub fn create(&self, organization_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + organization_id: organization_id.into(), + body: body.into(), + } + } + #[doc = "Update an organization in the application via patch"] + pub fn update(&self, organization_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + organization_id: organization_id.into(), + body: body.into(), + } + } + #[doc = "Delete an organization"] + pub fn remove(&self, organization_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + organization_id: organization_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/organizations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OrganizationCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) organization_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/organizations/{}", self.client.endpoint(), &self.organization_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Organization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) organization_id: String, + pub(crate) body: models::Organization, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/organizations/{}", self.client.endpoint(), &self.organization_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Organization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) organization_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/organizations/{}", self.client.endpoint(), &self.organization_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Organization = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) organization_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/organizations/{}", self.client.endpoint(), &self.organization_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod query { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Run a query and obtain the result"] + pub fn run(&self, body: impl Into) -> run::Builder { + run::Builder { + client: self.0.clone(), + body: body.into(), + } + } + } + pub mod run { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) body: models::QueryRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/query", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod roles { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of roles in an application."] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get a role by ID."] + pub fn get(&self, role_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + role_id: role_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/roles", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::RoleCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) role_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/roles/{}", self.client.endpoint(), &self.role_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Role = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod users { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Get the list of users in an application"] + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + #[doc = "Get a user by ID"] + pub fn get(&self, user_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + user_id: user_id.into(), + } + } + #[doc = "Create a user in the application"] + pub fn create(&self, user_id: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + user_id: user_id.into(), + body: body.into(), + } + } + #[doc = "Update a user in the application via patch"] + pub fn update(&self, user_id: impl Into, body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + user_id: user_id.into(), + body: body.into(), + } + } + #[doc = "Delete a user"] + pub fn remove(&self, user_id: impl Into) -> remove::Builder { + remove::Builder { + client: self.0.clone(), + user_id: user_id.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/users", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UserCollection = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) user_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/users/{}", self.client.endpoint(), &self.user_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) user_id: String, + pub(crate) body: models::User, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/users/{}", self.client.endpoint(), &self.user_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) user_id: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/users/{}", self.client.endpoint(), &self.user_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::User = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::Error, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) user_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/users/{}", self.client.endpoint(), &self.user_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "1.2-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Error = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/keyvault/Cargo.toml b/services/svc/keyvault/Cargo.toml index bc438c147c..2a69bfbd08 100644 --- a/services/svc/keyvault/Cargo.toml +++ b/services/svc/keyvault/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_keyvault" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/loadtestservice/Cargo.toml b/services/svc/loadtestservice/Cargo.toml index 7e0c4c236d..55026cf798 100644 --- a/services/svc/loadtestservice/Cargo.toml +++ b/services/svc/loadtestservice/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_loadtestservice" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/marketplacecatalog/Cargo.toml b/services/svc/marketplacecatalog/Cargo.toml index bc3e9de31d..4010ff46db 100644 --- a/services/svc/marketplacecatalog/Cargo.toml +++ b/services/svc/marketplacecatalog/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_marketplacecatalog" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/mixedreality/Cargo.toml b/services/svc/mixedreality/Cargo.toml index 9d8afb531f..6eecf54ee0 100644 --- a/services/svc/mixedreality/Cargo.toml +++ b/services/svc/mixedreality/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_mixedreality" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-0_3-preview_0", "package-0_2-preview_1", "package-0_2-preview_0", "package-2021-01-01-preview"] +features = ["no-default-tag", "package-0_3-preview_1", "package-0_3-preview_0", "package-0_2-preview_1", "package-0_2-preview_0"] [features] default = ["package-2021-01-01", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-0_3-preview_1" = [] "package-0_3-preview_0" = [] "package-0_2-preview_1" = [] "package-2021-01-01" = [] diff --git a/services/svc/mixedreality/README.md b/services/svc/mixedreality/README.md index e89c6e0a13..fc85d52cfb 100644 --- a/services/svc/mixedreality/README.md +++ b/services/svc/mixedreality/README.md @@ -10,6 +10,7 @@ The default tag is `package-2021-01-01`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-0.3-preview.1` has 3 operations from 1 API versions: `0.3-preview.1`. Use crate feature `package-0_3-preview_1` to enable. The operations will be in the `package_0_3_preview_1` module. - `package-0.3-preview.0` has 3 operations from 1 API versions: `0.3-preview.0`. Use crate feature `package-0_3-preview_0` to enable. The operations will be in the `package_0_3_preview_0` module. - `package-0.2-preview.1` has 3 operations from 1 API versions: `0.2-preview.1`. Use crate feature `package-0_2-preview_1` to enable. The operations will be in the `package_0_2_preview_1` module. - `package-2021-01-01` has 8 operations from 1 API versions: `2021-01-01`. Use crate feature `package-2021-01-01` to enable. The operations will be in the `package_2021_01_01` module. diff --git a/services/svc/mixedreality/src/lib.rs b/services/svc/mixedreality/src/lib.rs index 63c808ecab..68c91aa384 100644 --- a/services/svc/mixedreality/src/lib.rs +++ b/services/svc/mixedreality/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-0_3-preview_1")] +pub mod package_0_3_preview_1; +#[cfg(all(feature = "package-0_3-preview_1", not(feature = "no-default-tag")))] +pub use package_0_3_preview_1::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-0_3-preview_0")] pub mod package_0_3_preview_0; #[cfg(all(feature = "package-0_3-preview_0", not(feature = "no-default-tag")))] diff --git a/services/svc/mixedreality/src/package_0_3_preview_1/mod.rs b/services/svc/mixedreality/src/package_0_3_preview_1/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/mixedreality/src/package_0_3_preview_1/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/mixedreality/src/package_0_3_preview_1/models.rs b/services/svc/mixedreality/src/package_0_3_preview_1/models.rs new file mode 100644 index 0000000000..cdee9cf1db --- /dev/null +++ b/services/svc/mixedreality/src/package_0_3_preview_1/models.rs @@ -0,0 +1,267 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "The asset conversion error code."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ConversionErrorCode { + #[serde(rename = "UNKNOWN")] + Unknown, + #[serde(rename = "NO_ERROR")] + NoError, + #[serde(rename = "SERVICE_ERROR")] + ServiceError, + #[serde(rename = "INVALID_ASSET_URI")] + InvalidAssetUri, + #[serde(rename = "INVALID_JOB_ID")] + InvalidJobId, + #[serde(rename = "INVALID_GRAVITY")] + InvalidGravity, + #[serde(rename = "INVALID_SCALE")] + InvalidScale, + #[serde(rename = "ASSET_SIZE_TOO_LARGE")] + AssetSizeTooLarge, + #[serde(rename = "ASSET_DIMENSIONS_OUT_OF_BOUNDS")] + AssetDimensionsOutOfBounds, + #[serde(rename = "ZERO_FACES")] + ZeroFaces, + #[serde(rename = "INVALID_FACE_VERTICES")] + InvalidFaceVertices, + #[serde(rename = "ZERO_TRAJECTORIES_GENERATED")] + ZeroTrajectoriesGenerated, + #[serde(rename = "TOO_MANY_RIG_POSES")] + TooManyRigPoses, + #[serde(rename = "ASSET_CANNOT_BE_CONVERTED")] + AssetCannotBeConverted, +} +#[doc = "Represents an error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[doc = "The error code."] + pub code: String, + #[doc = "The error message."] + pub message: String, + #[doc = "The target of the error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "Inner error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub innererror: Option, +} +impl ErrorDetail { + pub fn new(code: String, message: String) -> Self { + Self { + code, + message, + target: None, + details: Vec::new(), + innererror: None, + } + } +} +#[doc = "Represents an error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[doc = "Represents an error."] + pub error: ErrorDetail, +} +impl ErrorResponse { + pub fn new(error: ErrorDetail) -> Self { + Self { error } + } +} +#[doc = "Represents an ingestion configuration."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IngestionConfiguration { + #[doc = "Represents a vector with three single-precision floating-point values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dimensions: Option, + #[doc = "Represents a vector with three single-precision floating-point values."] + #[serde(rename = "boundingBoxCenter", default, skip_serializing_if = "Option::is_none")] + pub bounding_box_center: Option, + #[doc = "Represents a vector with three single-precision floating-point values."] + pub gravity: Vector3, + #[doc = "Indices of Key Frames."] + #[serde(rename = "keyFrameIndexes", default, skip_serializing_if = "Vec::is_empty")] + pub key_frame_indexes: Vec, + #[doc = "Ground truth trajectory."] + #[serde(rename = "gtTrajectory", default, skip_serializing_if = "Vec::is_empty")] + pub gt_trajectory: Vec, + #[doc = "Represents a vector that is used to encode three-dimensional physical rotations."] + #[serde(rename = "principalAxis", default, skip_serializing_if = "Option::is_none")] + pub principal_axis: Option, + #[doc = "Scale of transformation of asset units into meter space."] + pub scale: f32, + #[doc = "Represents a vector with four single-precision floating-point values."] + #[serde(rename = "supportingPlane", default, skip_serializing_if = "Option::is_none")] + pub supporting_plane: Option, + #[doc = "Test Trajectory."] + #[serde(rename = "testTrajectory", default, skip_serializing_if = "Vec::is_empty")] + pub test_trajectory: Vec, +} +impl IngestionConfiguration { + pub fn new(gravity: Vector3, scale: f32) -> Self { + Self { + dimensions: None, + bounding_box_center: None, + gravity, + key_frame_indexes: Vec::new(), + gt_trajectory: Vec::new(), + principal_axis: None, + scale, + supporting_plane: None, + test_trajectory: Vec::new(), + } + } +} +#[doc = "Represents the status of an AOA asset conversion job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct IngestionProperties { + #[doc = "Information about the cause of a ClientError JobStatus."] + #[serde(rename = "clientErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub client_error_details: Option, + #[doc = "Information about the cause of a ServerError JobStatus."] + #[serde(rename = "serverErrorDetails", default, skip_serializing_if = "Option::is_none")] + pub server_error_details: Option, + #[doc = "The asset conversion error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Identifier for the AOA asset conversion job."] + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[doc = "The URI for downloading the generated AOA Model"] + #[serde(rename = "outputModelUri", default, skip_serializing_if = "Option::is_none")] + pub output_model_uri: Option, + #[doc = "Represents job status state."] + #[serde(rename = "jobStatus", default, skip_serializing_if = "Option::is_none")] + pub job_status: Option, + #[doc = "The file type of the original 3D asset. Examples include: \"ply\", \"obj\", \"fbx\", \"glb\", \"gltf\", etc."] + #[serde(rename = "assetFileType", default, skip_serializing_if = "Option::is_none")] + pub asset_file_type: Option, + #[doc = "The Uri to the Asset to be ingested by the AOA asset conversion service. This asset needs to have been uploaded to the service using an endpoint provided from a call to the GetUploadUri API."] + #[serde(rename = "inputAssetUri", default, skip_serializing_if = "Option::is_none")] + pub input_asset_uri: Option, + #[doc = "Identifier for the Account owning the asset conversion job."] + #[serde(rename = "accountId", default, skip_serializing_if = "Option::is_none")] + pub account_id: Option, + #[doc = "Represents an ingestion configuration."] + #[serde(rename = "ingestionConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ingestion_configuration: Option, + #[doc = "Represents a vector with three single-precision floating-point values."] + #[serde(rename = "scaledAssetDimensions", default, skip_serializing_if = "Option::is_none")] + pub scaled_asset_dimensions: Option, +} +impl IngestionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Inner error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InnerError { + #[doc = "A more specific error code than was provided by the containing error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "Inner error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub innererror: Option, +} +impl InnerError { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Represents job status state."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum JobStatus { + NotStarted, + Running, + Succeeded, + Failed, + Cancelled, +} +#[doc = "Represents a pose."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Pose { + #[doc = "Represents a vector that is used to encode three-dimensional physical rotations."] + pub rotation: Quaternion, + #[doc = "Represents a vector with three single-precision floating-point values."] + pub translation: Vector3, +} +impl Pose { + pub fn new(rotation: Quaternion, translation: Vector3) -> Self { + Self { rotation, translation } + } +} +#[doc = "Represents a vector that is used to encode three-dimensional physical rotations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Quaternion { + #[doc = "The x value of the vector component of the quaternion."] + pub x: f32, + #[doc = "The y value of the vector component of the quaternion."] + pub y: f32, + #[doc = "The z value of the vector component of the quaternion."] + pub z: f32, + #[doc = "The rotation component of the quaternion."] + pub w: f32, + #[doc = "Gets a value that indicates whether the current instance is the identity quaternion"] + #[serde(rename = "isIdentity", default, skip_serializing_if = "Option::is_none")] + pub is_identity: Option, +} +impl Quaternion { + pub fn new(x: f32, y: f32, z: f32, w: f32) -> Self { + Self { + x, + y, + z, + w, + is_identity: None, + } + } +} +#[doc = "Represents an upload location for model ingestion."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UploadLocation { + #[doc = "The blob upload URI where a model should be uploaded to the service for ingestion."] + #[serde(rename = "inputAssetUri")] + pub input_asset_uri: String, +} +impl UploadLocation { + pub fn new(input_asset_uri: String) -> Self { + Self { input_asset_uri } + } +} +#[doc = "Represents a vector with three single-precision floating-point values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vector3 { + #[doc = "The x component of the vector."] + pub x: f32, + #[doc = "The y component of the vector."] + pub y: f32, + #[doc = "The z component of the vector."] + pub z: f32, +} +impl Vector3 { + pub fn new(x: f32, y: f32, z: f32) -> Self { + Self { x, y, z } + } +} +#[doc = "Represents a vector with four single-precision floating-point values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Vector4 { + #[doc = "The x component of the vector."] + pub x: f32, + #[doc = "The y component of the vector."] + pub y: f32, + #[doc = "The z component of the vector."] + pub z: f32, + #[doc = "The w component of the vector."] + pub w: f32, +} +impl Vector4 { + pub fn new(x: f32, y: f32, z: f32, w: f32) -> Self { + Self { x, y, z, w } + } +} diff --git a/services/svc/mixedreality/src/package_0_3_preview_1/operations.rs b/services/svc/mixedreality/src/package_0_3_preview_1/operations.rs new file mode 100644 index 0000000000..e9802746f5 --- /dev/null +++ b/services/svc/mixedreality/src/package_0_3_preview_1/operations.rs @@ -0,0 +1,373 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn blob_upload_endpoint(&self) -> blob_upload_endpoint::Client { + blob_upload_endpoint::Client(self.clone()) + } + pub fn ingestion_job(&self) -> ingestion_job::Client { + ingestion_job::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + IngestionJob_Get(#[from] ingestion_job::get::Error), + #[error(transparent)] + IngestionJob_Create(#[from] ingestion_job::create::Error), + #[error(transparent)] + BlobUploadEndpoint_Get(#[from] blob_upload_endpoint::get::Error), +} +pub mod ingestion_job { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets the status of a job request."] + pub fn get(&self, account_id: impl Into, job_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + account_id: account_id.into(), + job_id: job_id.into(), + x_mrc_cv: None, + } + } + #[doc = "Creates a job request."] + pub fn create( + &self, + account_id: impl Into, + job_id: impl Into, + body: impl Into, + ) -> create::Builder { + create::Builder { + client: self.0.clone(), + account_id: account_id.into(), + job_id: job_id.into(), + body: body.into(), + x_mrc_cv: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) account_id: String, + pub(crate) job_id: String, + pub(crate) x_mrc_cv: Option, + } + impl Builder { + pub fn x_mrc_cv(mut self, x_mrc_cv: impl Into) -> Self { + self.x_mrc_cv = Some(x_mrc_cv.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/accounts/{}/jobs/{}", self.client.endpoint(), &self.account_id, &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "0.3-preview.1"); + if let Some(x_mrc_cv) = &self.x_mrc_cv { + req_builder = req_builder.header("x-mrc-cv", x_mrc_cv); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IngestionProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) account_id: String, + pub(crate) job_id: String, + pub(crate) body: models::IngestionProperties, + pub(crate) x_mrc_cv: Option, + } + impl Builder { + pub fn x_mrc_cv(mut self, x_mrc_cv: impl Into) -> Self { + self.x_mrc_cv = Some(x_mrc_cv.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/accounts/{}/jobs/{}", self.client.endpoint(), &self.account_id, &self.job_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "0.3-preview.1"); + if let Some(x_mrc_cv) = &self.x_mrc_cv { + req_builder = req_builder.header("x-mrc-cv", x_mrc_cv); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IngestionProperties = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod blob_upload_endpoint { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + #[doc = "Gets a blob upload uri."] + pub fn get(&self, account_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + account_id: account_id.into(), + x_mrc_cv: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) account_id: String, + pub(crate) x_mrc_cv: Option, + } + impl Builder { + pub fn x_mrc_cv(mut self, x_mrc_cv: impl Into) -> Self { + self.x_mrc_cv = Some(x_mrc_cv.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/accounts/{}/blobUploadEndpoint", self.client.endpoint(), &self.account_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "0.3-preview.1"); + if let Some(x_mrc_cv) = &self.x_mrc_cv { + req_builder = req_builder.header("x-mrc-cv", x_mrc_cv); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::UploadLocation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/monitor/Cargo.toml b/services/svc/monitor/Cargo.toml index e0c541bd66..da82d08615 100644 --- a/services/svc/monitor/Cargo.toml +++ b/services/svc/monitor/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_monitor" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/operationalinsights/Cargo.toml b/services/svc/operationalinsights/Cargo.toml index e712998ac7..f6bdba07cb 100644 --- a/services/svc/operationalinsights/Cargo.toml +++ b/services/svc/operationalinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_operationalinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/purview/Cargo.toml b/services/svc/purview/Cargo.toml index f337938897..17982ef5b5 100644 --- a/services/svc/purview/Cargo.toml +++ b/services/svc/purview/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_purview" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,12 +24,16 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-2021-07-01-preview"] +features = ["no-default-tag", "package-2021-05-01-preview", "package-2022-02-01-preview", "package-2021-10-01-preview", "package-2018-12-01-preview"] [features] -default = ["package-2018-12-01-preview", "enable_reqwest"] +default = ["package-preview-2022-03", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-preview-2022-03" = [] +"package-2021-05-01-preview" = [] +"package-2022-02-01-preview" = [] +"package-2021-10-01-preview" = [] "package-2018-12-01-preview" = [] "package-2021-07-01-preview" = [] diff --git a/services/svc/purview/README.md b/services/svc/purview/README.md index b6916fafe1..ff1c15d57e 100644 --- a/services/svc/purview/README.md +++ b/services/svc/purview/README.md @@ -6,9 +6,13 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/purview/da To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-2018-12-01-preview`. +The default tag is `package-preview-2022-03`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-preview-2022-03` has 105 operations from 1 API versions: `2022-03-01-preview`. Use crate feature `package-preview-2022-03` to enable. The operations will be in the `package_preview_2022_03` module. +- `package-2021-05-01-preview` has 90 operations from 1 API versions: `2021-05-01-preview`. Use crate feature `package-2021-05-01-preview` to enable. The operations will be in the `package_2021_05_01_preview` module. +- `package-2022-02-01-preview` has 39 operations from 1 API versions: `2022-02-01-preview`. Use crate feature `package-2022-02-01-preview` to enable. The operations will be in the `package_2022_02_01_preview` module. +- `package-2021-10-01-preview` has 35 operations from 1 API versions: `2021-10-01-preview`. Use crate feature `package-2021-10-01-preview` to enable. The operations will be in the `package_2021_10_01_preview` module. - `package-2018-12-01-preview` has 35 operations from 1 API versions: `2018-12-01-preview`. Use crate feature `package-2018-12-01-preview` to enable. The operations will be in the `package_2018_12_01_preview` module. - `package-2021-07-01-preview` has 4 operations from 1 API versions: `2021-07-01-preview`. Use crate feature `package-2021-07-01-preview` to enable. The operations will be in the `package_2021_07_01_preview` module. \ No newline at end of file diff --git a/services/svc/purview/src/lib.rs b/services/svc/purview/src/lib.rs index 2b266a7283..166ba43a16 100644 --- a/services/svc/purview/src/lib.rs +++ b/services/svc/purview/src/lib.rs @@ -3,6 +3,22 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-preview-2022-03")] +pub mod package_preview_2022_03; +#[cfg(all(feature = "package-preview-2022-03", not(feature = "no-default-tag")))] +pub use package_preview_2022_03::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-05-01-preview")] +pub mod package_2021_05_01_preview; +#[cfg(all(feature = "package-2021-05-01-preview", not(feature = "no-default-tag")))] +pub use package_2021_05_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2022-02-01-preview")] +pub mod package_2022_02_01_preview; +#[cfg(all(feature = "package-2022-02-01-preview", not(feature = "no-default-tag")))] +pub use package_2022_02_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; +#[cfg(feature = "package-2021-10-01-preview")] +pub mod package_2021_10_01_preview; +#[cfg(all(feature = "package-2021-10-01-preview", not(feature = "no-default-tag")))] +pub use package_2021_10_01_preview::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-2018-12-01-preview")] pub mod package_2018_12_01_preview; #[cfg(all(feature = "package-2018-12-01-preview", not(feature = "no-default-tag")))] diff --git a/services/svc/purview/src/package_2021_05_01_preview/mod.rs b/services/svc/purview/src/package_2021_05_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/purview/src/package_2021_05_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/purview/src/package_2021_05_01_preview/models.rs b/services/svc/purview/src/package_2021_05_01_preview/models.rs new file mode 100644 index 0000000000..6febbe8a9e --- /dev/null +++ b/services/svc/purview/src/package_2021_05_01_preview/models.rs @@ -0,0 +1,2006 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "class that captures details of a struct-attribute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasAttributeDef { + #[doc = "single-valued attribute or multi-valued attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cardinality: Option, + #[doc = "An array of constraints."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub constraints: Vec, + #[doc = "The default value of the attribute."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "The description of the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Determines if it is included in notification."] + #[serde(rename = "includeInNotification", default, skip_serializing_if = "Option::is_none")] + pub include_in_notification: Option, + #[doc = "Determines if it is indexable."] + #[serde(rename = "isIndexable", default, skip_serializing_if = "Option::is_none")] + pub is_indexable: Option, + #[doc = "Determines if it is optional."] + #[serde(rename = "isOptional", default, skip_serializing_if = "Option::is_none")] + pub is_optional: Option, + #[doc = "Determines if it unique."] + #[serde(rename = "isUnique", default, skip_serializing_if = "Option::is_none")] + pub is_unique: Option, + #[doc = "The name of the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The options for the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "The maximum count of the values."] + #[serde(rename = "valuesMaxCount", default, skip_serializing_if = "Option::is_none")] + pub values_max_count: Option, + #[doc = "The minimum count of the values."] + #[serde(rename = "valuesMinCount", default, skip_serializing_if = "Option::is_none")] + pub values_min_count: Option, +} +impl AtlasAttributeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The base model object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasBaseModelObject { + #[doc = "The GUID of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, +} +impl AtlasBaseModelObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class that captures common-attributes for all Atlas types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasBaseTypeDef { + #[doc = "The enum of type category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The date format."] + #[serde(rename = "dateFormatter", default, skip_serializing_if = "Option::is_none")] + pub date_formatter: Option, + #[doc = "The description of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The options for the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, + #[doc = "The service type."] + #[serde(rename = "serviceType", default, skip_serializing_if = "Option::is_none")] + pub service_type: Option, + #[doc = "The version of the type."] + #[serde(rename = "typeVersion", default, skip_serializing_if = "Option::is_none")] + pub type_version: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasBaseTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of a classification; it doesn't have an identity, this object exists only when associated with an entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassification { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "The GUID of the entity."] + #[serde(rename = "entityGuid", default, skip_serializing_if = "Option::is_none")] + pub entity_guid: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(rename = "entityStatus", default, skip_serializing_if = "Option::is_none")] + pub entity_status: Option, + #[doc = "Determines if propagations will be removed on entity deletion."] + #[serde(rename = "removePropagationsOnEntityDelete", default, skip_serializing_if = "Option::is_none")] + pub remove_propagations_on_entity_delete: Option, + #[doc = "An array of time boundaries indicating validity periods."] + #[serde(rename = "validityPeriods", default, skip_serializing_if = "Vec::is_empty")] + pub validity_periods: Vec, + #[doc = "indicate the source who create the classification detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "more detail on source information"] + #[serde(rename = "sourceDetails", default, skip_serializing_if = "Option::is_none")] + pub source_details: Option, +} +impl AtlasClassification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a classification-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassificationDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "Specifying a list of entityType names in the classificationDef, ensures that classifications can\nonly be applied to those entityTypes.\n
    \n
  • Any subtypes of the entity types inherit the restriction
  • \n
  • Any classificationDef subtypes inherit the parents entityTypes restrictions
  • \n
  • Any classificationDef subtypes can further restrict the parents entityTypes restrictions by specifying a subset of the entityTypes
  • \n
  • An empty entityTypes list when there are no parent restrictions means there are no restrictions
  • \n
  • An empty entityTypes list when there are parent restrictions means that the subtype picks up the parents restrictions
  • \n
  • If a list of entityTypes are supplied, where one inherits from another, this will be rejected. This should encourage cleaner classificationsDefs
  • \n
"] + #[serde(rename = "entityTypes", default, skip_serializing_if = "Vec::is_empty")] + pub entity_types: Vec, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, +} +impl AtlasClassificationDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "REST serialization friendly list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassifications { + #[serde(flatten)] + pub p_list: PList, +} +impl AtlasClassifications { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a constraint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasConstraintDef { + #[doc = "The parameters of the constraint definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub params: Option, + #[doc = "The type of the constraint."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AtlasConstraintDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntitiesWithExtInfo { + #[serde(flatten)] + pub atlas_entity_ext_info: AtlasEntityExtInfo, + #[doc = "An array of entities."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub entities: Vec, +} +impl AtlasEntitiesWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntity { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The GUID of the entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The home ID of the entity."] + #[serde(rename = "homeId", default, skip_serializing_if = "Option::is_none")] + pub home_id: Option, + #[doc = "An array of term assignment headers indicating the meanings of the entity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub meanings: Vec, + #[doc = "Used to record the provenance of an instance of an entity or relationship."] + #[serde(rename = "provenanceType", default, skip_serializing_if = "Option::is_none")] + pub provenance_type: Option, + #[doc = "Determines if there's a proxy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub proxy: Option, + #[doc = "The attributes of relationship."] + #[serde(rename = "relationshipAttributes", default, skip_serializing_if = "Option::is_none")] + pub relationship_attributes: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "indicate the source who create the classification detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "more detail on source information"] + #[serde(rename = "sourceDetails", default, skip_serializing_if = "Option::is_none")] + pub source_details: Option, + #[doc = "The dictionary of contacts for terms. Key could be Expert or Owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contacts: Option, +} +impl AtlasEntity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a entity-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, + #[doc = "An array of relationship attributes."] + #[serde(rename = "relationshipAttributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_attribute_defs: Vec, +} +impl AtlasEntityDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityExtInfo { + #[doc = "The referred entities."] + #[serde(rename = "referredEntities", default, skip_serializing_if = "Option::is_none")] + pub referred_entities: Option, +} +impl AtlasEntityExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityHeader { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "An array of classification names."] + #[serde(rename = "classificationNames", default, skip_serializing_if = "Vec::is_empty")] + pub classification_names: Vec, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "An array of meanings."] + #[serde(rename = "meaningNames", default, skip_serializing_if = "Vec::is_empty")] + pub meaning_names: Vec, + #[doc = "An array of term assignment headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub meanings: Vec, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AtlasEntityHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity header map."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityHeaders { + #[doc = "The description of the guid header map,"] + #[serde(rename = "guidHeaderMap", default, skip_serializing_if = "Option::is_none")] + pub guid_header_map: Option, +} +impl AtlasEntityHeaders { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityWithExtInfo { + #[serde(flatten)] + pub atlas_entity_ext_info: AtlasEntityExtInfo, + #[doc = "An instance of an entity - like hive_table, hive_database."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub entity: Option, +} +impl AtlasEntityWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of an enum-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEnumDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[doc = "The default value."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "An array of enum element definitions."] + #[serde(rename = "elementDefs", default, skip_serializing_if = "Vec::is_empty")] + pub element_defs: Vec, +} +impl AtlasEnumDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of an enum-element."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEnumElementDef { + #[doc = "The description of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The ordinal of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ordinal: Option, + #[doc = "The value of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl AtlasEnumElementDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Extra properties for a type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasExtraTypeDef { + #[doc = "Specifying a list of entityType names in the classificationDef, ensures that classifications can\nonly be applied to those entityTypes.\n
    \n
  • Any subtypes of the entity types inherit the restriction
  • \n
  • Any classificationDef subtypes inherit the parents entityTypes restrictions
  • \n
  • Any classificationDef subtypes can further restrict the parents entityTypes restrictions by specifying a subset of the entityTypes
  • \n
  • An empty entityTypes list when there are no parent restrictions means there are no restrictions
  • \n
  • An empty entityTypes list when there are parent restrictions means that the subtype picks up the parents restrictions
  • \n
  • If a list of entityTypes are supplied, where one inherits from another, this will be rejected. This should encourage cleaner classificationsDefs
  • \n
"] + #[serde(rename = "entityTypes", default, skip_serializing_if = "Vec::is_empty")] + pub entity_types: Vec, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, + #[doc = "An array of relationship attributes."] + #[serde(rename = "relationshipAttributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_attribute_defs: Vec, + #[doc = "The default value."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "An array of enum element definitions."] + #[serde(rename = "elementDefs", default, skip_serializing_if = "Vec::is_empty")] + pub element_defs: Vec, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef1", default, skip_serializing_if = "Option::is_none")] + pub end_def1: Option, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef2", default, skip_serializing_if = "Option::is_none")] + pub end_def2: Option, + #[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] + #[serde(rename = "relationshipCategory", default, skip_serializing_if = "Option::is_none")] + pub relationship_category: Option, + #[doc = "The label of the relationship."] + #[serde(rename = "relationshipLabel", default, skip_serializing_if = "Option::is_none")] + pub relationship_label: Option, + #[doc = "An array of attribute definitions."] + #[serde(rename = "attributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub attribute_defs: Vec, +} +impl AtlasExtraTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossary { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "An array of categories."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub categories: Vec, + #[doc = "The language of the glossary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub terms: Vec, + #[doc = "The usage of the glossary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usage: Option, +} +impl AtlasGlossary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary base object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryBaseObject { + #[serde(flatten)] + pub atlas_base_model_object: AtlasBaseModelObject, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The long version description."] + #[serde(rename = "longDescription", default, skip_serializing_if = "Option::is_none")] + pub long_description: Option, + #[doc = "The name of the glossary object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The qualified name of the glossary object."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The short version of description."] + #[serde(rename = "shortDescription", default, skip_serializing_if = "Option::is_none")] + pub short_description: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasGlossaryBaseObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryCategory { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "The glossary header with basic information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub anchor: Option, + #[doc = "An array of children categories."] + #[serde(rename = "childrenCategories", default, skip_serializing_if = "Vec::is_empty")] + pub children_categories: Vec, + #[doc = "The header of the related category."] + #[serde(rename = "parentCategory", default, skip_serializing_if = "Option::is_none")] + pub parent_category: Option, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub terms: Vec, +} +impl AtlasGlossaryCategory { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The extended information of glossary."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryExtInfo { + #[serde(flatten)] + pub atlas_glossary: AtlasGlossary, + #[doc = "The glossary category information."] + #[serde(rename = "categoryInfo", default, skip_serializing_if = "Option::is_none")] + pub category_info: Option, + #[doc = "The glossary term information."] + #[serde(rename = "termInfo", default, skip_serializing_if = "Option::is_none")] + pub term_info: Option, +} +impl AtlasGlossaryExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary header with basic information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryHeader { + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the glossary."] + #[serde(rename = "glossaryGuid", default, skip_serializing_if = "Option::is_none")] + pub glossary_guid: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, +} +impl AtlasGlossaryHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryTerm { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "The abbreviation of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub abbreviation: Option, + #[serde(rename = "templateName", default, skip_serializing_if = "Vec::is_empty")] + pub template_name: Vec, + #[doc = "The glossary header with basic information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub anchor: Option, + #[doc = "An array of related term headers as antonyms."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub antonyms: Vec, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "Status of the AtlasGlossaryTerm"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "An array of resource link for term"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, + #[doc = "The dictionary of contacts for terms. Key could be Expert or Steward."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contacts: Option, + #[doc = "The custom attributes of the term, which is map>.\nThe key of the first layer map is term template name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[doc = "An array of related object IDs."] + #[serde(rename = "assignedEntities", default, skip_serializing_if = "Vec::is_empty")] + pub assigned_entities: Vec, + #[doc = "An array of term categorization headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub categories: Vec, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifies: Vec, + #[doc = "An array of examples."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub examples: Vec, + #[doc = "An array of related term headers indicating the is-a relationship."] + #[serde(rename = "isA", default, skip_serializing_if = "Vec::is_empty")] + pub is_a: Vec, + #[doc = "An array of preferred related term headers."] + #[serde(rename = "preferredTerms", default, skip_serializing_if = "Vec::is_empty")] + pub preferred_terms: Vec, + #[doc = "An array of related term headers that are preferred to."] + #[serde(rename = "preferredToTerms", default, skip_serializing_if = "Vec::is_empty")] + pub preferred_to_terms: Vec, + #[doc = "An array of related term headers that are replaced by."] + #[serde(rename = "replacedBy", default, skip_serializing_if = "Vec::is_empty")] + pub replaced_by: Vec, + #[doc = "An array of related term headers for replacement."] + #[serde(rename = "replacementTerms", default, skip_serializing_if = "Vec::is_empty")] + pub replacement_terms: Vec, + #[doc = "An array of related term headers for see also."] + #[serde(rename = "seeAlso", default, skip_serializing_if = "Vec::is_empty")] + pub see_also: Vec, + #[doc = "An array of related term headers as synonyms."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub synonyms: Vec, + #[doc = "An array of translated related term headers."] + #[serde(rename = "translatedTerms", default, skip_serializing_if = "Vec::is_empty")] + pub translated_terms: Vec, + #[doc = "An array of related term headers for translation."] + #[serde(rename = "translationTerms", default, skip_serializing_if = "Vec::is_empty")] + pub translation_terms: Vec, + #[doc = "The usage of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usage: Option, + #[doc = "An array of related term headers as valid values."] + #[serde(rename = "validValues", default, skip_serializing_if = "Vec::is_empty")] + pub valid_values: Vec, + #[doc = "An array of related term headers as valid values for other records."] + #[serde(rename = "validValuesFor", default, skip_serializing_if = "Vec::is_empty")] + pub valid_values_for: Vec, +} +impl AtlasGlossaryTerm { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasLineageInfo { + #[doc = "The GUID of the base entity."] + #[serde(rename = "baseEntityGuid", default, skip_serializing_if = "Option::is_none")] + pub base_entity_guid: Option, + #[doc = "The GUID entity map."] + #[serde(rename = "guidEntityMap", default, skip_serializing_if = "Option::is_none")] + pub guid_entity_map: Option, + #[doc = "The entity count in specific direction."] + #[serde(rename = "widthCounts", default, skip_serializing_if = "Option::is_none")] + pub width_counts: Option, + #[doc = "The depth of lineage."] + #[serde(rename = "lineageDepth", default, skip_serializing_if = "Option::is_none")] + pub lineage_depth: Option, + #[doc = "The width of lineage."] + #[serde(rename = "lineageWidth", default, skip_serializing_if = "Option::is_none")] + pub lineage_width: Option, + #[doc = "True to return the parent of the base entity."] + #[serde(rename = "includeParent", default, skip_serializing_if = "Option::is_none")] + pub include_parent: Option, + #[doc = "The number of children node."] + #[serde(rename = "childrenCount", default, skip_serializing_if = "Option::is_none")] + pub children_count: Option, + #[doc = "The enum of lineage direction."] + #[serde(rename = "lineageDirection", default, skip_serializing_if = "Option::is_none")] + pub lineage_direction: Option, + #[doc = "An array of parentRelations relations."] + #[serde(rename = "parentRelations", default, skip_serializing_if = "Vec::is_empty")] + pub parent_relations: Vec, + #[doc = "An array of lineage relations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub relations: Vec, +} +impl AtlasLineageInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage direction"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasLineageInfoExtraProperties {} +impl AtlasLineageInfoExtraProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to an object-instance of an Atlas type - like entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasObjectId { + #[doc = "The GUID of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "The unique attributes of the object."] + #[serde(rename = "uniqueAttributes", default, skip_serializing_if = "Option::is_none")] + pub unique_attributes: Option, +} +impl AtlasObjectId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header of the related category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedCategoryHeader { + #[doc = "The GUID of the category."] + #[serde(rename = "categoryGuid", default, skip_serializing_if = "Option::is_none")] + pub category_guid: Option, + #[doc = "The description of the category header."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the parent category."] + #[serde(rename = "parentCategoryGuid", default, skip_serializing_if = "Option::is_none")] + pub parent_category_guid: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, +} +impl AtlasRelatedCategoryHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to an object-instance of AtlasEntity type used in relationship attribute values"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedObjectId { + #[serde(flatten)] + pub atlas_object_id: AtlasObjectId, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(rename = "entityStatus", default, skip_serializing_if = "Option::is_none")] + pub entity_status: Option, + #[serde(rename = "relationshipType", default, skip_serializing_if = "Option::is_none")] + pub relationship_type: Option, + #[doc = "Captures details of struct contents. Not instantiated directly, used only via AtlasEntity, AtlasClassification."] + #[serde(rename = "relationshipAttributes", default, skip_serializing_if = "Option::is_none")] + pub relationship_attributes: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationshipGuid", default, skip_serializing_if = "Option::is_none")] + pub relationship_guid: Option, + #[doc = "The enum of relationship status."] + #[serde(rename = "relationshipStatus", default, skip_serializing_if = "Option::is_none")] + pub relationship_status: Option, +} +impl AtlasRelatedObjectId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header of the related term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedTermHeader { + #[doc = "The description of the related term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The expression of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The source of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The status of term relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The steward of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub steward: Option, + #[doc = "The GUID of the term."] + #[serde(rename = "termGuid", default, skip_serializing_if = "Option::is_none")] + pub term_guid: Option, +} +impl AtlasRelatedTermHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Atlas relationship instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationship { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "Reference to an object-instance of an Atlas type - like entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end1: Option, + #[doc = "Reference to an object-instance of an Atlas type - like entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end2: Option, + #[doc = "The GUID of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The home ID of the relationship."] + #[serde(rename = "homeId", default, skip_serializing_if = "Option::is_none")] + pub home_id: Option, + #[doc = "The label of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[doc = "Used to record the provenance of an instance of an entity or relationship"] + #[serde(rename = "provenanceType", default, skip_serializing_if = "Option::is_none")] + pub provenance_type: Option, + #[doc = "The enum of relationship status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl AtlasRelationship { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipAttributeDef { + #[serde(flatten)] + pub atlas_attribute_def: AtlasAttributeDef, + #[doc = "Determines if it is a legacy attribute."] + #[serde(rename = "isLegacyAttribute", default, skip_serializing_if = "Option::is_none")] + pub is_legacy_attribute: Option, + #[doc = "The name of the relationship type."] + #[serde(rename = "relationshipTypeName", default, skip_serializing_if = "Option::is_none")] + pub relationship_type_name: Option, +} +impl AtlasRelationshipAttributeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AtlasRelationshipDef is a TypeDef that defines a relationship.\n

\nAs with other typeDefs the AtlasRelationshipDef has a name. Once created the RelationshipDef has a guid.\nThe name and the guid are the 2 ways that the RelationshipDef is identified.\n

\nRelationshipDefs have 2 ends, each of which specify cardinality, an EntityDef type name and name and optionally\nwhether the end is a container.\n

\nRelationshipDefs can have AttributeDefs - though only primitive types are allowed.
\nRelationshipDefs have a relationshipCategory specifying the UML type of relationship required
\nThe way EntityDefs and RelationshipDefs are intended to be used is that EntityDefs will define AttributeDefs these AttributeDefs\nwill not specify an EntityDef type name as their types.\n

\nRelationshipDefs introduce new attributes to the entity instances. For example\n

\nEntityDef A might have attributes attr1,attr2,attr3
\nEntityDef B might have attributes attr4,attr5,attr6
\nRelationshipDef AtoB might define 2 ends
\n\n

\n   end1:  type A, name attr7\n   end2:  type B, name attr8  
\n\n

\nWhen an instance of EntityDef A is created, it will have attributes attr1,attr2,attr3,attr7
\nWhen an instance of EntityDef B is created, it will have attributes attr4,attr5,attr6,attr8\n

\nIn this way relationshipDefs can be authored separately from entityDefs and can inject relationship attributes into\nthe entity instances"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef1", default, skip_serializing_if = "Option::is_none")] + pub end_def1: Option, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef2", default, skip_serializing_if = "Option::is_none")] + pub end_def2: Option, + #[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] + #[serde(rename = "relationshipCategory", default, skip_serializing_if = "Option::is_none")] + pub relationship_category: Option, + #[doc = "The label of the relationship."] + #[serde(rename = "relationshipLabel", default, skip_serializing_if = "Option::is_none")] + pub relationship_label: Option, +} +impl AtlasRelationshipDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipEndDef { + #[doc = "single-valued attribute or multi-valued attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cardinality: Option, + #[doc = "The description of the relationship end definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Determines if it is container."] + #[serde(rename = "isContainer", default, skip_serializing_if = "Option::is_none")] + pub is_container: Option, + #[doc = "Determines if it is a legacy attribute."] + #[serde(rename = "isLegacyAttribute", default, skip_serializing_if = "Option::is_none")] + pub is_legacy_attribute: Option, + #[doc = "The name of the relationship end definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the relationship end."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AtlasRelationshipEndDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationship with extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipWithExtInfo { + #[doc = "The referred entity header."] + #[serde(rename = "referredEntities", default, skip_serializing_if = "Option::is_none")] + pub referred_entities: Option, + #[doc = "Atlas relationship instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub relationship: Option, +} +impl AtlasRelationshipWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Captures details of struct contents. Not instantiated directly, used only via AtlasEntity, AtlasClassification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasStruct { + #[doc = "The attributes of the struct."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasStruct { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a struct-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasStructDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[doc = "An array of attribute definitions."] + #[serde(rename = "attributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub attribute_defs: Vec, +} +impl AtlasStructDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header for term assignment."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTermAssignmentHeader { + #[doc = "The confidence of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub confidence: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The description of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The expression of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The source of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The status of terms assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The steward of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub steward: Option, + #[doc = "The GUID of the term."] + #[serde(rename = "termGuid", default, skip_serializing_if = "Option::is_none")] + pub term_guid: Option, +} +impl AtlasTermAssignmentHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of terms assignment."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AtlasTermAssignmentStatus { + #[serde(rename = "DISCOVERED")] + Discovered, + #[serde(rename = "PROPOSED")] + Proposed, + #[serde(rename = "IMPORTED")] + Imported, + #[serde(rename = "VALIDATED")] + Validated, + #[serde(rename = "DEPRECATED")] + Deprecated, + #[serde(rename = "OBSOLETE")] + Obsolete, + #[serde(rename = "OTHER")] + Other, +} +#[doc = "The basic information for term categorization."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTermCategorizationHeader { + #[doc = "The GUID of the category."] + #[serde(rename = "categoryGuid", default, skip_serializing_if = "Option::is_none")] + pub category_guid: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The status of term relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AtlasTermCategorizationHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of term relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AtlasTermRelationshipStatus { + #[serde(rename = "DRAFT")] + Draft, + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DEPRECATED")] + Deprecated, + #[serde(rename = "OBSOLETE")] + Obsolete, + #[serde(rename = "OTHER")] + Other, +} +#[doc = "The definitions of type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypeDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[serde(flatten)] + pub atlas_extra_type_def: AtlasExtraTypeDef, +} +impl AtlasTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The basic information of the type definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypeDefHeader { + #[doc = "The enum of type category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The GUID of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl AtlasTypeDefHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definitions of types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypesDef { + #[doc = "An array of classification definitions."] + #[serde(rename = "classificationDefs", default, skip_serializing_if = "Vec::is_empty")] + pub classification_defs: Vec, + #[doc = "An array of entity definitions."] + #[serde(rename = "entityDefs", default, skip_serializing_if = "Vec::is_empty")] + pub entity_defs: Vec, + #[doc = "An array of enum definitions."] + #[serde(rename = "enumDefs", default, skip_serializing_if = "Vec::is_empty")] + pub enum_defs: Vec, + #[doc = "An array of relationship definitions."] + #[serde(rename = "relationshipDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_defs: Vec, + #[doc = "An array of struct definitions."] + #[serde(rename = "structDefs", default, skip_serializing_if = "Vec::is_empty")] + pub struct_defs: Vec, + #[doc = "An array of term template definitions."] + #[serde(rename = "termTemplateDefs", default, skip_serializing_if = "Vec::is_empty")] + pub term_template_defs: Vec, +} +impl AtlasTypesDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The query of autocomplete request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteRequest { + #[doc = "The keywords applied to all fields that support autocomplete operation. It must be at least 1 character, and no more than 100 characters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The number of autocomplete results we hope to return. The default value is 50. The value must be a number between 1 and 100."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the autocomplete request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl AutoCompleteRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result of the autocomplete request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AutoCompleteResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the autocomplete suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteResultValue { + #[doc = "The completed term or phrase."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, + #[doc = "The completed search query text."] + #[serde(rename = "queryPlusText", default, skip_serializing_if = "Option::is_none")] + pub query_plus_text: Option, +} +impl AutoCompleteResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The criteria of browse request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseRequest { + #[doc = "The entity type to browse as the root level entry point."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The path to browse the next level child entities."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The number of browse items we hope to return. The maximum value is 10000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The offset. The default value is 0. The maximum value is 100000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offset: Option, +} +impl BrowseRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result item of the browse request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResult { + #[doc = "The total number of browse results."] + #[serde(rename = "@search.count", default, skip_serializing_if = "Option::is_none")] + pub search_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BrowseResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the browse owner."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResultOwner { + #[doc = "The GUID of the owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The display name of the owner."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The mail of the owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mail: Option, + #[doc = "The contact type of the owner. The value will be Owner."] + #[serde(rename = "contactType", default, skip_serializing_if = "Option::is_none")] + pub contact_type: Option, +} +impl BrowseResultOwner { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the browse result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResultValue { + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "If the record is a leaf entity."] + #[serde(rename = "isLeaf", default, skip_serializing_if = "Option::is_none")] + pub is_leaf: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owners of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub owner: Vec, + #[doc = "The path of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, +} +impl BrowseResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "single-valued attribute or multi-valued attribute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Cardinality { + #[serde(rename = "SINGLE")] + Single, + #[serde(rename = "LIST")] + List, + #[serde(rename = "SET")] + Set, +} +#[doc = "The request for classification association."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClassificationAssociateRequest { + #[doc = "An instance of a classification; it doesn't have an identity, this object exists only when associated with an entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub classification: Option, + #[doc = "The GUID of the entity."] + #[serde(rename = "entityGuids", default, skip_serializing_if = "Vec::is_empty")] + pub entity_guids: Vec, +} +impl ClassificationAssociateRequest { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactBasic { + #[doc = "Azure Active Directory object Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "additional information to describe this contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ContactBasic { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The contact in the search and suggest result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactSearchResultValue { + #[doc = "The GUID of the contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The description of the contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The type of the contact. It can be Expert or Owner for an entity. It can be Expert or Steward for a glossary term."] + #[serde(rename = "contactType", default, skip_serializing_if = "Option::is_none")] + pub contact_type: Option, +} +impl ContactSearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The date format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DateFormat { + #[doc = "An array of available locales."] + #[serde(rename = "availableLocales", default, skip_serializing_if = "Vec::is_empty")] + pub available_locales: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub calendar: Option, + #[doc = "The date format."] + #[serde(rename = "dateInstance", default, skip_serializing_if = "Option::is_none")] + pub date_instance: Option, + #[doc = "The date format."] + #[serde(rename = "dateTimeInstance", default, skip_serializing_if = "Option::is_none")] + pub date_time_instance: Option, + #[doc = "The date format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Option, + #[doc = "Determines the leniency of the date format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lenient: Option, + #[doc = "The number format."] + #[serde(rename = "numberFormat", default, skip_serializing_if = "Option::is_none")] + pub number_format: Option, + #[doc = "The date format."] + #[serde(rename = "timeInstance", default, skip_serializing_if = "Option::is_none")] + pub time_instance: Option, + #[doc = "The timezone information."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl DateFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The mutation response of entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EntityMutationResponse { + #[doc = "A map of GUID assignments with entities."] + #[serde(rename = "guidAssignments", default, skip_serializing_if = "Option::is_none")] + pub guid_assignments: Option, + #[doc = "The entity headers of mutated entities."] + #[serde(rename = "mutatedEntities", default, skip_serializing_if = "Option::is_none")] + pub mutated_entities: Option, + #[doc = "An array of entity headers that partially updated."] + #[serde(rename = "partialUpdatedEntities", default, skip_serializing_if = "Vec::is_empty")] + pub partial_updated_entities: Vec, +} +impl EntityMutationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The request ID."] + #[serde(rename = "requestId", default, skip_serializing_if = "Option::is_none")] + pub request_id: Option, + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of import csv operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperation { + #[doc = "guid string"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Enum of the status of import csv operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The last updated time of the record."] + #[serde(rename = "lastUpdateTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ImportCsvOperation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperationError { + #[doc = "Error code from async import job if fail"] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Error message from async import job if fail"] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, +} +impl ImportCsvOperationError { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperationProperties { + #[doc = "Term numbers that already imported successfully"] + #[serde(rename = "importedTerms", default, skip_serializing_if = "Option::is_none")] + pub imported_terms: Option, + #[doc = "Total term numbers that detected in csv"] + #[serde(rename = "totalTermsDetected", default, skip_serializing_if = "Option::is_none")] + pub total_terms_detected: Option, +} +impl ImportCsvOperationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enum of the status of import csv operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ImportCsvOperationStatus { + NotStarted, + Succeeded, + Failed, + Running, +} +pub type LastModifiedTs = String; +#[doc = "The enum of lineage direction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum LineageDirection { + #[serde(rename = "INPUT")] + Input, + #[serde(rename = "OUTPUT")] + Output, + #[serde(rename = "BOTH")] + Both, +} +#[doc = "The lineage relation with GUID of the from and to entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LineageRelation { + #[doc = "The GUID of from-entity."] + #[serde(rename = "fromEntityId", default, skip_serializing_if = "Option::is_none")] + pub from_entity_id: Option, + #[doc = "The GUID of relationship."] + #[serde(rename = "relationshipId", default, skip_serializing_if = "Option::is_none")] + pub relationship_id: Option, + #[doc = "The GUID of to-entity."] + #[serde(rename = "toEntityId", default, skip_serializing_if = "Option::is_none")] + pub to_entity_id: Option, +} +impl LineageRelation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MoveEntitiesRequest { + #[doc = "An array of entity guids to be moved to target collection."] + #[serde(rename = "entityGuids", default, skip_serializing_if = "Vec::is_empty")] + pub entity_guids: Vec, +} +impl MoveEntitiesRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The number format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NumberFormat { + #[doc = "The number format."] + #[serde(rename = "availableLocales", default, skip_serializing_if = "Vec::is_empty")] + pub available_locales: Vec, + #[doc = "The currency."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub currency: Option, + #[doc = "The number format."] + #[serde(rename = "currencyInstance", default, skip_serializing_if = "Option::is_none")] + pub currency_instance: Option, + #[doc = "Determines if grouping is used."] + #[serde(rename = "groupingUsed", default, skip_serializing_if = "Option::is_none")] + pub grouping_used: Option, + #[doc = "The number format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Option, + #[doc = "The number format."] + #[serde(rename = "integerInstance", default, skip_serializing_if = "Option::is_none")] + pub integer_instance: Option, + #[doc = "The maximum of fraction digits."] + #[serde(rename = "maximumFractionDigits", default, skip_serializing_if = "Option::is_none")] + pub maximum_fraction_digits: Option, + #[doc = "The maximum of integer digits."] + #[serde(rename = "maximumIntegerDigits", default, skip_serializing_if = "Option::is_none")] + pub maximum_integer_digits: Option, + #[doc = "The minimum of fraction digits."] + #[serde(rename = "minimumFractionDigits", default, skip_serializing_if = "Option::is_none")] + pub minimum_fraction_digits: Option, + #[doc = "The minimum of integer digits."] + #[serde(rename = "minimumIntegerDigits", default, skip_serializing_if = "Option::is_none")] + pub minimum_integer_digits: Option, + #[doc = "The number format."] + #[serde(rename = "numberInstance", default, skip_serializing_if = "Option::is_none")] + pub number_instance: Option, + #[doc = "Determines if only integer is parsed."] + #[serde(rename = "parseIntegerOnly", default, skip_serializing_if = "Option::is_none")] + pub parse_integer_only: Option, + #[doc = "The number format."] + #[serde(rename = "percentInstance", default, skip_serializing_if = "Option::is_none")] + pub percent_instance: Option, + #[doc = "The enum of rounding mode."] + #[serde(rename = "roundingMode", default, skip_serializing_if = "Option::is_none")] + pub rounding_mode: Option, +} +impl NumberFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paginated-list, for returning search results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PList { + #[doc = "An array of objects."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub list: Vec, + #[doc = "The size of the page."] + #[serde(rename = "pageSize", default, skip_serializing_if = "Option::is_none")] + pub page_size: Option, + #[doc = "The sorted by field."] + #[serde(rename = "sortBy", default, skip_serializing_if = "Option::is_none")] + pub sort_by: Option, + #[doc = "to specify whether the result should be sorted? If yes, whether asc or desc."] + #[serde(rename = "sortType", default, skip_serializing_if = "Option::is_none")] + pub sort_type: Option, + #[doc = "The start index of the page."] + #[serde(rename = "startIndex", default, skip_serializing_if = "Option::is_none")] + pub start_index: Option, + #[doc = "The total count of items."] + #[serde(rename = "totalCount", default, skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} +impl PList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage parents relation with GUID of the parent entity and to child entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParentRelation { + #[doc = "The GUID of child entity."] + #[serde(rename = "childEntityId", default, skip_serializing_if = "Option::is_none")] + pub child_entity_id: Option, + #[doc = "The GUID of relationship."] + #[serde(rename = "relationshipId", default, skip_serializing_if = "Option::is_none")] + pub relationship_id: Option, + #[doc = "The GUID of parent entity."] + #[serde(rename = "parentEntityId", default, skip_serializing_if = "Option::is_none")] + pub parent_entity_id: Option, +} +impl ParentRelation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RelationshipCategory { + #[serde(rename = "ASSOCIATION")] + Association, + #[serde(rename = "AGGREGATION")] + Aggregation, + #[serde(rename = "COMPOSITION")] + Composition, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceLink { + #[doc = "Display name for url."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "web url. http or https"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, +} +impl ResourceLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The enum of rounding mode."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RoundingMode { + #[serde(rename = "UP")] + Up, + #[serde(rename = "DOWN")] + Down, + #[serde(rename = "CEILING")] + Ceiling, + #[serde(rename = "FLOOR")] + Floor, + #[serde(rename = "HALF_UP")] + HalfUp, + #[serde(rename = "HALF_DOWN")] + HalfDown, + #[serde(rename = "HALF_EVEN")] + HalfEven, + #[serde(rename = "UNNECESSARY")] + Unnecessary, +} +#[doc = "The content of a search facet result item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetItem { + #[doc = "The count of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The name of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub facet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sort: Option, +} +impl SearchFacetItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The content of a search facet result item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetItemValue { + #[doc = "The count of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The name of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SearchFacetItemValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A facet list that consists of index fields assetType ,classification, contactId, and label. When the facet is specified in the request, the value of the facet is returned as an element of @search.facets."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetResultValue { + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[serde(rename = "classificationCategory", default, skip_serializing_if = "Vec::is_empty")] + pub classification_category: Vec, + #[serde(rename = "contactId", default, skip_serializing_if = "Vec::is_empty")] + pub contact_id: Vec, + #[serde(rename = "fileExtension", default, skip_serializing_if = "Vec::is_empty")] + pub file_extension: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, +} +impl SearchFacetResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A highlight list that consists of index fields id ,qualifiedName, name, description, entityType. When the keyword appears in those fields, the value of the field, attached with emphasis mark, is returned as an element of @search.highlights."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchHighlights { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub id: Vec, + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Vec::is_empty")] + pub qualified_name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub description: Vec, + #[serde(rename = "entityType", default, skip_serializing_if = "Vec::is_empty")] + pub entity_type: Vec, +} +impl SearchHighlights { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The search query of advanced search request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchRequest { + #[doc = "The keywords applied to all searchable fields."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The offset. The default value is 0. The maximum value is 100000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offset: Option, + #[doc = "The limit of the number of the search result. default value is 50; maximum value is 1000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the search. See examples for the usage of supported filters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub facets: Vec, + #[serde(rename = "taxonomySetting", default, skip_serializing_if = "Option::is_none")] + pub taxonomy_setting: Option, +} +impl SearchRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod search_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct TaxonomySetting { + #[serde(rename = "assetTypes", default, skip_serializing_if = "Vec::is_empty")] + pub asset_types: Vec, + #[doc = "The content of a search facet result item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub facet: Option, + } + impl TaxonomySetting { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The result of the search result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchResult { + #[doc = "The total number of search results (not the number of documents in a single page)."] + #[serde(rename = "@search.count", default, skip_serializing_if = "Option::is_none")] + pub search_count: Option, + #[doc = "A facet list that consists of index fields assetType ,classification, contactId, and label. When the facet is specified in the request, the value of the facet is returned as an element of @search.facets."] + #[serde(rename = "@search.facets", default, skip_serializing_if = "Option::is_none")] + pub search_facets: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SearchResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the search result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchResultValue { + #[doc = "The search score calculated by the search engine. The results are ordered by search score by default."] + #[serde(rename = "@search.score", default, skip_serializing_if = "Option::is_none")] + pub search_score: Option, + #[doc = "A highlight list that consists of index fields id ,qualifiedName, name, description, entityType. When the keyword appears in those fields, the value of the field, attached with emphasis mark, is returned as an element of @search.highlights."] + #[serde(rename = "@search.highlights", default, skip_serializing_if = "Option::is_none")] + pub search_highlights: Option, + #[doc = "The target text that contains the keyword as prefix. The keyword is wrapped with emphasis mark."] + #[serde(rename = "@search.text", default, skip_serializing_if = "Option::is_none")] + pub search_text: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owner of the record. This is an Atlas native attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The classifications of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[doc = "The labels of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[doc = "The terms assigned to the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, + #[doc = "The contacts of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub contact: Vec, + #[doc = "The asset types of the record."] + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, +} +impl SearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "to specify whether the result should be sorted? If yes, whether asc or desc."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SortType { + #[serde(rename = "NONE")] + None, + #[serde(rename = "ASC")] + Asc, + #[serde(rename = "DESC")] + Desc, +} +#[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DELETED")] + Deleted, +} +#[doc = "The enum of relationship status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum StatusAtlasRelationship { + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DELETED")] + Deleted, +} +#[doc = "The query of suggest request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestRequest { + #[doc = "The keywords applied to all fields that support suggest operation. It must be at least 1 character, and no more than 100 characters. In the index schema we defined a default suggester which lists all the supported fields and specifies a search mode."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The number of suggestions we hope to return. The default value is 5. The value must be a number between 1 and 100."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the search."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl SuggestRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result item of the search suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SuggestResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the search suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestResultValue { + #[doc = "The search score calculated by the search engine. The results are ordered by search score by default."] + #[serde(rename = "@search.score", default, skip_serializing_if = "Option::is_none")] + pub search_score: Option, + #[doc = "The target text that contains the keyword as prefix. The keyword is wrapped with emphasis mark."] + #[serde(rename = "@search.text", default, skip_serializing_if = "Option::is_none")] + pub search_text: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owner of the record. This is an Atlas native attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The classifications of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[doc = "The labels of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[doc = "The terms assigned to the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, + #[doc = "The contacts of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub contact: Vec, + #[doc = "The asset types of the record."] + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, +} +impl SuggestResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The custom attributes of the term, which is map>.\nThe key of the first layer map is term template name."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermCustomAttributes {} +impl TermCustomAttributes { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The term attribute name and attribute value, which is map"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermCustomAttributesExtraProperties {} +impl TermCustomAttributesExtraProperties { + pub fn new() -> Self { + Self::default() + } +} +pub type TermGuid = String; +#[doc = "The context."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermSearchResultValue { + #[doc = "The name of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The name of the glossary which contains the term."] + #[serde(rename = "glossaryName", default, skip_serializing_if = "Option::is_none")] + pub glossary_name: Option, + #[doc = "The GUID of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, +} +impl TermSearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Status of the AtlasGlossaryTerm"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TermStatus { + Draft, + Approved, + Alert, + Expired, +} +#[doc = "term template definition for glossary term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermTemplateDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, +} +impl TermTemplateDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Captures time-boundary details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeBoundary { + #[doc = "The end of the time boundary."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The start of the time boundary."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The timezone of the time boundary."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl TimeBoundary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The timezone information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeZone { + #[doc = "The value of the daylight saving time."] + #[serde(rename = "dstSavings", default, skip_serializing_if = "Option::is_none")] + pub dst_savings: Option, + #[doc = "The ID of the timezone."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "An array of available IDs."] + #[serde(rename = "availableIds", default, skip_serializing_if = "Vec::is_empty")] + pub available_ids: Vec, + #[doc = "The timezone information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Option, + #[doc = "The display name of the timezone."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The raw offset of the timezone."] + #[serde(rename = "rawOffset", default, skip_serializing_if = "Option::is_none")] + pub raw_offset: Option, +} +impl TimeZone { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The enum of type category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TypeCategory { + #[serde(rename = "PRIMITIVE")] + Primitive, + #[serde(rename = "OBJECT_ID_TYPE")] + ObjectIdType, + #[serde(rename = "ENUM")] + Enum, + #[serde(rename = "STRUCT")] + Struct, + #[serde(rename = "CLASSIFICATION")] + Classification, + #[serde(rename = "ENTITY")] + Entity, + #[serde(rename = "ARRAY")] + Array, + #[serde(rename = "MAP")] + Map, + #[serde(rename = "RELATIONSHIP")] + Relationship, + #[serde(rename = "TERM_TEMPLATE")] + TermTemplate, +} diff --git a/services/svc/purview/src/package_2021_05_01_preview/operations.rs b/services/svc/purview/src/package_2021_05_01_preview/operations.rs new file mode 100644 index 0000000000..f0be6ba88f --- /dev/null +++ b/services/svc/purview/src/package_2021_05_01_preview/operations.rs @@ -0,0 +1,7849 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn collection(&self) -> collection::Client { + collection::Client(self.clone()) + } + pub fn discovery(&self) -> discovery::Client { + discovery::Client(self.clone()) + } + pub fn entity(&self) -> entity::Client { + entity::Client(self.clone()) + } + pub fn glossary(&self) -> glossary::Client { + glossary::Client(self.clone()) + } + pub fn lineage(&self) -> lineage::Client { + lineage::Client(self.clone()) + } + pub fn relationship(&self) -> relationship::Client { + relationship::Client(self.clone()) + } + pub fn types(&self) -> types::Client { + types::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Entity_CreateOrUpdate(#[from] entity::create_or_update::Error), + #[error(transparent)] + Entity_ListByGuids(#[from] entity::list_by_guids::Error), + #[error(transparent)] + Entity_CreateOrUpdateEntities(#[from] entity::create_or_update_entities::Error), + #[error(transparent)] + Entity_DeleteByGuids(#[from] entity::delete_by_guids::Error), + #[error(transparent)] + Entity_AddClassification(#[from] entity::add_classification::Error), + #[error(transparent)] + Entity_GetByGuid(#[from] entity::get_by_guid::Error), + #[error(transparent)] + Entity_PartialUpdateEntityAttributeByGuid(#[from] entity::partial_update_entity_attribute_by_guid::Error), + #[error(transparent)] + Entity_DeleteByGuid(#[from] entity::delete_by_guid::Error), + #[error(transparent)] + Entity_GetClassification(#[from] entity::get_classification::Error), + #[error(transparent)] + Entity_DeleteClassification(#[from] entity::delete_classification::Error), + #[error(transparent)] + Entity_GetClassifications(#[from] entity::get_classifications::Error), + #[error(transparent)] + Entity_AddClassifications(#[from] entity::add_classifications::Error), + #[error(transparent)] + Entity_UpdateClassifications(#[from] entity::update_classifications::Error), + #[error(transparent)] + Entity_GetByUniqueAttributes(#[from] entity::get_by_unique_attributes::Error), + #[error(transparent)] + Entity_PartialUpdateEntityByUniqueAttributes(#[from] entity::partial_update_entity_by_unique_attributes::Error), + #[error(transparent)] + Entity_DeleteByUniqueAttribute(#[from] entity::delete_by_unique_attribute::Error), + #[error(transparent)] + Entity_DeleteClassificationByUniqueAttribute(#[from] entity::delete_classification_by_unique_attribute::Error), + #[error(transparent)] + Entity_AddClassificationsByUniqueAttribute(#[from] entity::add_classifications_by_unique_attribute::Error), + #[error(transparent)] + Entity_UpdateClassificationsByUniqueAttribute(#[from] entity::update_classifications_by_unique_attribute::Error), + #[error(transparent)] + Entity_SetClassifications(#[from] entity::set_classifications::Error), + #[error(transparent)] + Entity_GetEntitiesByUniqueAttributes(#[from] entity::get_entities_by_unique_attributes::Error), + #[error(transparent)] + Entity_GetHeader(#[from] entity::get_header::Error), + #[error(transparent)] + Glossary_ListGlossaries(#[from] glossary::list_glossaries::Error), + #[error(transparent)] + Glossary_CreateGlossary(#[from] glossary::create_glossary::Error), + #[error(transparent)] + Glossary_CreateGlossaryCategories(#[from] glossary::create_glossary_categories::Error), + #[error(transparent)] + Glossary_CreateGlossaryCategory(#[from] glossary::create_glossary_category::Error), + #[error(transparent)] + Glossary_GetGlossaryCategory(#[from] glossary::get_glossary_category::Error), + #[error(transparent)] + Glossary_UpdateGlossaryCategory(#[from] glossary::update_glossary_category::Error), + #[error(transparent)] + Glossary_DeleteGlossaryCategory(#[from] glossary::delete_glossary_category::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossaryCategory(#[from] glossary::partial_update_glossary_category::Error), + #[error(transparent)] + Glossary_ListRelatedCategories(#[from] glossary::list_related_categories::Error), + #[error(transparent)] + Glossary_ListCategoryTerms(#[from] glossary::list_category_terms::Error), + #[error(transparent)] + Glossary_CreateGlossaryTerm(#[from] glossary::create_glossary_term::Error), + #[error(transparent)] + Glossary_GetGlossaryTerm(#[from] glossary::get_glossary_term::Error), + #[error(transparent)] + Glossary_UpdateGlossaryTerm(#[from] glossary::update_glossary_term::Error), + #[error(transparent)] + Glossary_DeleteGlossaryTerm(#[from] glossary::delete_glossary_term::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossaryTerm(#[from] glossary::partial_update_glossary_term::Error), + #[error(transparent)] + Glossary_CreateGlossaryTerms(#[from] glossary::create_glossary_terms::Error), + #[error(transparent)] + Glossary_GetEntitiesAssignedWithTerm(#[from] glossary::get_entities_assigned_with_term::Error), + #[error(transparent)] + Glossary_AssignTermToEntities(#[from] glossary::assign_term_to_entities::Error), + #[error(transparent)] + Glossary_RemoveTermAssignmentFromEntities(#[from] glossary::remove_term_assignment_from_entities::Error), + #[error(transparent)] + Glossary_DeleteTermAssignmentFromEntities(#[from] glossary::delete_term_assignment_from_entities::Error), + #[error(transparent)] + Glossary_ListRelatedTerms(#[from] glossary::list_related_terms::Error), + #[error(transparent)] + Glossary_GetGlossary(#[from] glossary::get_glossary::Error), + #[error(transparent)] + Glossary_UpdateGlossary(#[from] glossary::update_glossary::Error), + #[error(transparent)] + Glossary_DeleteGlossary(#[from] glossary::delete_glossary::Error), + #[error(transparent)] + Glossary_ListGlossaryCategories(#[from] glossary::list_glossary_categories::Error), + #[error(transparent)] + Glossary_ListGlossaryCategoriesHeaders(#[from] glossary::list_glossary_categories_headers::Error), + #[error(transparent)] + Glossary_GetDetailedGlossary(#[from] glossary::get_detailed_glossary::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossary(#[from] glossary::partial_update_glossary::Error), + #[error(transparent)] + Glossary_ListGlossaryTerms(#[from] glossary::list_glossary_terms::Error), + #[error(transparent)] + Glossary_ListGlossaryTermHeaders(#[from] glossary::list_glossary_term_headers::Error), + #[error(transparent)] + Glossary_ImportGlossaryTermsViaCsv(#[from] glossary::import_glossary_terms_via_csv::Error), + #[error(transparent)] + Glossary_ImportGlossaryTermsViaCsvByGlossaryName(#[from] glossary::import_glossary_terms_via_csv_by_glossary_name::Error), + #[error(transparent)] + Glossary_GetImportCsvOperationStatus(#[from] glossary::get_import_csv_operation_status::Error), + #[error(transparent)] + Glossary_ExportGlossaryTermsAsCsv(#[from] glossary::export_glossary_terms_as_csv::Error), + #[error(transparent)] + Glossary_ListTermsByGlossaryName(#[from] glossary::list_terms_by_glossary_name::Error), + #[error(transparent)] + Discovery_Query(#[from] discovery::query::Error), + #[error(transparent)] + Discovery_Suggest(#[from] discovery::suggest::Error), + #[error(transparent)] + Discovery_Browse(#[from] discovery::browse::Error), + #[error(transparent)] + Discovery_AutoComplete(#[from] discovery::auto_complete::Error), + #[error(transparent)] + Lineage_GetLineageGraph(#[from] lineage::get_lineage_graph::Error), + #[error(transparent)] + Lineage_NextPageLineage(#[from] lineage::next_page_lineage::Error), + #[error(transparent)] + Relationship_Create(#[from] relationship::create::Error), + #[error(transparent)] + Relationship_Update(#[from] relationship::update::Error), + #[error(transparent)] + Relationship_Get(#[from] relationship::get::Error), + #[error(transparent)] + Relationship_Delete(#[from] relationship::delete::Error), + #[error(transparent)] + Types_GetClassificationDefByGuid(#[from] types::get_classification_def_by_guid::Error), + #[error(transparent)] + Types_GetClassificationDefByName(#[from] types::get_classification_def_by_name::Error), + #[error(transparent)] + Types_GetEntityDefinitionByGuid(#[from] types::get_entity_definition_by_guid::Error), + #[error(transparent)] + Types_GetEntityDefinitionByName(#[from] types::get_entity_definition_by_name::Error), + #[error(transparent)] + Types_GetEnumDefByGuid(#[from] types::get_enum_def_by_guid::Error), + #[error(transparent)] + Types_GetEnumDefByName(#[from] types::get_enum_def_by_name::Error), + #[error(transparent)] + Types_GetRelationshipDefByGuid(#[from] types::get_relationship_def_by_guid::Error), + #[error(transparent)] + Types_GetRelationshipDefByName(#[from] types::get_relationship_def_by_name::Error), + #[error(transparent)] + Types_GetStructDefByGuid(#[from] types::get_struct_def_by_guid::Error), + #[error(transparent)] + Types_GetStructDefByName(#[from] types::get_struct_def_by_name::Error), + #[error(transparent)] + Types_GetTypeDefinitionByGuid(#[from] types::get_type_definition_by_guid::Error), + #[error(transparent)] + Types_GetTypeDefinitionByName(#[from] types::get_type_definition_by_name::Error), + #[error(transparent)] + Types_DeleteTypeByName(#[from] types::delete_type_by_name::Error), + #[error(transparent)] + Types_GetAllTypeDefinitions(#[from] types::get_all_type_definitions::Error), + #[error(transparent)] + Types_CreateTypeDefinitions(#[from] types::create_type_definitions::Error), + #[error(transparent)] + Types_UpdateAtlasTypeDefinitions(#[from] types::update_atlas_type_definitions::Error), + #[error(transparent)] + Types_DeleteTypeDefinitions(#[from] types::delete_type_definitions::Error), + #[error(transparent)] + Types_ListTypeDefinitionHeaders(#[from] types::list_type_definition_headers::Error), + #[error(transparent)] + Types_GetTermTemplateDefByGuid(#[from] types::get_term_template_def_by_guid::Error), + #[error(transparent)] + Types_GetTermTemplateDefByName(#[from] types::get_term_template_def_by_name::Error), + #[error(transparent)] + Collection_CreateOrUpdate(#[from] collection::create_or_update::Error), + #[error(transparent)] + Collection_CreateOrUpdateBulk(#[from] collection::create_or_update_bulk::Error), + #[error(transparent)] + Collection_MoveEntitiesToCollection(#[from] collection::move_entities_to_collection::Error), +} +pub mod entity { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_or_update(&self, entity: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + entity: entity.into(), + } + } + pub fn list_by_guids(&self, guid: Vec) -> list_by_guids::Builder { + list_by_guids::Builder { + client: self.0.clone(), + guid, + min_ext_info: None, + ignore_relationships: None, + exclude_relationship_types: Vec::new(), + } + } + pub fn create_or_update_entities( + &self, + entities: impl Into, + ) -> create_or_update_entities::Builder { + create_or_update_entities::Builder { + client: self.0.clone(), + entities: entities.into(), + } + } + pub fn delete_by_guids(&self, guid: Vec) -> delete_by_guids::Builder { + delete_by_guids::Builder { + client: self.0.clone(), + guid, + } + } + pub fn add_classification(&self, request: impl Into) -> add_classification::Builder { + add_classification::Builder { + client: self.0.clone(), + request: request.into(), + } + } + pub fn get_by_guid(&self, guid: impl Into) -> get_by_guid::Builder { + get_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + min_ext_info: None, + ignore_relationships: None, + } + } + pub fn partial_update_entity_attribute_by_guid( + &self, + guid: impl Into, + name: impl Into, + body: impl Into, + ) -> partial_update_entity_attribute_by_guid::Builder { + partial_update_entity_attribute_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + name: name.into(), + body: body.into(), + } + } + pub fn delete_by_guid(&self, guid: impl Into) -> delete_by_guid::Builder { + delete_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_classification(&self, guid: impl Into, classification_name: impl Into) -> get_classification::Builder { + get_classification::Builder { + client: self.0.clone(), + guid: guid.into(), + classification_name: classification_name.into(), + } + } + pub fn delete_classification( + &self, + guid: impl Into, + classification_name: impl Into, + ) -> delete_classification::Builder { + delete_classification::Builder { + client: self.0.clone(), + guid: guid.into(), + classification_name: classification_name.into(), + } + } + pub fn get_classifications(&self, guid: impl Into) -> get_classifications::Builder { + get_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn add_classifications( + &self, + guid: impl Into, + classifications: impl Into>, + ) -> add_classifications::Builder { + add_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + classifications: classifications.into(), + } + } + pub fn update_classifications( + &self, + guid: impl Into, + classifications: impl Into>, + ) -> update_classifications::Builder { + update_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + classifications: classifications.into(), + } + } + pub fn get_by_unique_attributes(&self, type_name: impl Into) -> get_by_unique_attributes::Builder { + get_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + min_ext_info: None, + ignore_relationships: None, + attr_qualified_name: None, + } + } + pub fn partial_update_entity_by_unique_attributes( + &self, + type_name: impl Into, + atlas_entity_with_ext_info: impl Into, + ) -> partial_update_entity_by_unique_attributes::Builder { + partial_update_entity_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_entity_with_ext_info: atlas_entity_with_ext_info.into(), + attr_qualified_name: None, + } + } + pub fn delete_by_unique_attribute(&self, type_name: impl Into) -> delete_by_unique_attribute::Builder { + delete_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + attr_qualified_name: None, + } + } + pub fn delete_classification_by_unique_attribute( + &self, + type_name: impl Into, + classification_name: impl Into, + ) -> delete_classification_by_unique_attribute::Builder { + delete_classification_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + classification_name: classification_name.into(), + attr_qualified_name: None, + } + } + pub fn add_classifications_by_unique_attribute( + &self, + type_name: impl Into, + atlas_classification_array: impl Into>, + ) -> add_classifications_by_unique_attribute::Builder { + add_classifications_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_classification_array: atlas_classification_array.into(), + attr_qualified_name: None, + } + } + pub fn update_classifications_by_unique_attribute( + &self, + type_name: impl Into, + atlas_classification_array: impl Into>, + ) -> update_classifications_by_unique_attribute::Builder { + update_classifications_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_classification_array: atlas_classification_array.into(), + attr_qualified_name: None, + } + } + pub fn set_classifications(&self, entity_headers: impl Into) -> set_classifications::Builder { + set_classifications::Builder { + client: self.0.clone(), + entity_headers: entity_headers.into(), + } + } + pub fn get_entities_by_unique_attributes(&self, type_name: impl Into) -> get_entities_by_unique_attributes::Builder { + get_entities_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + min_ext_info: None, + ignore_relationships: None, + attr_n_qualified_name: None, + } + } + pub fn get_header(&self, guid: impl Into) -> get_header::Builder { + get_header::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entity: models::AtlasEntityWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_guids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: Vec, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) exclude_relationship_types: Vec, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn exclude_relationship_types(mut self, exclude_relationship_types: Vec) -> Self { + self.exclude_relationship_types = exclude_relationship_types; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let guid = &self.guid; + for value in &self.guid { + url.query_pairs_mut().append_pair("guid", &value.to_string()); + } + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + let exclude_relationship_types = &self.exclude_relationship_types; + for value in &self.exclude_relationship_types { + url.query_pairs_mut().append_pair("excludeRelationshipTypes", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntitiesWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entities: models::AtlasEntitiesWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entities).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_guids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let guid = &self.guid; + for value in &self.guid { + url.query_pairs_mut().append_pair("guid", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::ClassificationAssociateRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk/classification", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_entity_attribute_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) name: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let name = &self.name; + url.query_pairs_mut().append_pair("name", name); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/classification/{}", + self.client.endpoint(), + &self.guid, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/classification/{}", + self.client.endpoint(), + &self.guid, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassifications = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classifications: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.classifications).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classifications: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.classifications).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_entity_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_entity_with_ext_info: models::AtlasEntityWithExtInfo, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_entity_with_ext_info).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_classification_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) classification_name: String, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classification/{}", + self.client.endpoint(), + &self.type_name, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classifications_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_classification_array: Vec, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classifications", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_classification_array).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_classifications_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_classification_array: Vec, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classifications", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_classification_array).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entity_headers: models::AtlasEntityHeaders, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk/setClassifications", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity_headers).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entities_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) attr_n_qualified_name: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn attr_n_qualified_name(mut self, attr_n_qualified_name: impl Into) -> Self { + self.attr_n_qualified_name = Some(attr_n_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/bulk/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + if let Some(attr_n_qualified_name) = &self.attr_n_qualified_name { + url.query_pairs_mut().append_pair("attr_N:qualifiedName", attr_n_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntitiesWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_header { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/header", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityHeader = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod glossary { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_glossaries(&self) -> list_glossaries::Builder { + list_glossaries::Builder { + client: self.0.clone(), + limit: None, + offset: None, + sort: None, + ignore_terms_and_categories: None, + } + } + pub fn create_glossary(&self, atlas_glossary: impl Into) -> create_glossary::Builder { + create_glossary::Builder { + client: self.0.clone(), + atlas_glossary: atlas_glossary.into(), + } + } + pub fn create_glossary_categories( + &self, + glossary_category: impl Into>, + ) -> create_glossary_categories::Builder { + create_glossary_categories::Builder { + client: self.0.clone(), + glossary_category: glossary_category.into(), + } + } + pub fn create_glossary_category( + &self, + glossary_category: impl Into, + ) -> create_glossary_category::Builder { + create_glossary_category::Builder { + client: self.0.clone(), + glossary_category: glossary_category.into(), + } + } + pub fn get_glossary_category(&self, category_guid: impl Into) -> get_glossary_category::Builder { + get_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + } + } + pub fn update_glossary_category( + &self, + category_guid: impl Into, + glossary_category: impl Into, + ) -> update_glossary_category::Builder { + update_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + glossary_category: glossary_category.into(), + } + } + pub fn delete_glossary_category(&self, category_guid: impl Into) -> delete_glossary_category::Builder { + delete_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + } + } + pub fn partial_update_glossary_category( + &self, + category_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary_category::Builder { + partial_update_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + partial_updates: partial_updates.into(), + } + } + pub fn list_related_categories(&self, category_guid: impl Into) -> list_related_categories::Builder { + list_related_categories::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn list_category_terms(&self, category_guid: impl Into) -> list_category_terms::Builder { + list_category_terms::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn create_glossary_term(&self, glossary_term: impl Into) -> create_glossary_term::Builder { + create_glossary_term::Builder { + client: self.0.clone(), + glossary_term: glossary_term.into(), + include_term_hierarchy: None, + } + } + pub fn get_glossary_term(&self, term_guid: impl Into) -> get_glossary_term::Builder { + get_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + include_term_hierarchy: None, + } + } + pub fn update_glossary_term( + &self, + term_guid: impl Into, + glossary_term: impl Into, + ) -> update_glossary_term::Builder { + update_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + glossary_term: glossary_term.into(), + } + } + pub fn delete_glossary_term(&self, term_guid: impl Into) -> delete_glossary_term::Builder { + delete_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + } + } + pub fn partial_update_glossary_term( + &self, + term_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary_term::Builder { + partial_update_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + partial_updates: partial_updates.into(), + include_term_hierarchy: None, + } + } + pub fn create_glossary_terms(&self, glossary_term: impl Into>) -> create_glossary_terms::Builder { + create_glossary_terms::Builder { + client: self.0.clone(), + glossary_term: glossary_term.into(), + include_term_hierarchy: None, + } + } + pub fn get_entities_assigned_with_term(&self, term_guid: impl Into) -> get_entities_assigned_with_term::Builder { + get_entities_assigned_with_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn assign_term_to_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> assign_term_to_entities::Builder { + assign_term_to_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn remove_term_assignment_from_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> remove_term_assignment_from_entities::Builder { + remove_term_assignment_from_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn delete_term_assignment_from_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> delete_term_assignment_from_entities::Builder { + delete_term_assignment_from_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn list_related_terms(&self, term_guid: impl Into) -> list_related_terms::Builder { + list_related_terms::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn get_glossary(&self, glossary_guid: impl Into) -> get_glossary::Builder { + get_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + } + } + pub fn update_glossary( + &self, + glossary_guid: impl Into, + updated_glossary: impl Into, + ) -> update_glossary::Builder { + update_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + updated_glossary: updated_glossary.into(), + } + } + pub fn delete_glossary(&self, glossary_guid: impl Into) -> delete_glossary::Builder { + delete_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + } + } + pub fn list_glossary_categories(&self, glossary_guid: impl Into) -> list_glossary_categories::Builder { + list_glossary_categories::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn list_glossary_categories_headers(&self, glossary_guid: impl Into) -> list_glossary_categories_headers::Builder { + list_glossary_categories_headers::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn get_detailed_glossary(&self, glossary_guid: impl Into) -> get_detailed_glossary::Builder { + get_detailed_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + include_term_hierarchy: None, + } + } + pub fn partial_update_glossary( + &self, + glossary_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary::Builder { + partial_update_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + partial_updates: partial_updates.into(), + include_term_hierarchy: None, + } + } + pub fn list_glossary_terms(&self, glossary_guid: impl Into) -> list_glossary_terms::Builder { + list_glossary_terms::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + include_term_hierarchy: None, + limit: None, + offset: None, + sort: None, + } + } + pub fn list_glossary_term_headers(&self, glossary_guid: impl Into) -> list_glossary_term_headers::Builder { + list_glossary_term_headers::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn import_glossary_terms_via_csv( + &self, + glossary_guid: impl Into, + file: impl Into, + ) -> import_glossary_terms_via_csv::Builder { + import_glossary_terms_via_csv::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + file: file.into(), + include_term_hierarchy: None, + } + } + pub fn import_glossary_terms_via_csv_by_glossary_name( + &self, + glossary_name: impl Into, + file: impl Into, + ) -> import_glossary_terms_via_csv_by_glossary_name::Builder { + import_glossary_terms_via_csv_by_glossary_name::Builder { + client: self.0.clone(), + glossary_name: glossary_name.into(), + file: file.into(), + include_term_hierarchy: None, + } + } + pub fn get_import_csv_operation_status(&self, operation_guid: impl Into) -> get_import_csv_operation_status::Builder { + get_import_csv_operation_status::Builder { + client: self.0.clone(), + operation_guid: operation_guid.into(), + } + } + pub fn export_glossary_terms_as_csv( + &self, + glossary_guid: impl Into, + term_guids: impl Into>, + ) -> export_glossary_terms_as_csv::Builder { + export_glossary_terms_as_csv::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + term_guids: term_guids.into(), + include_term_hierarchy: None, + } + } + pub fn list_terms_by_glossary_name(&self, glossary_name: impl Into) -> list_terms_by_glossary_name::Builder { + list_terms_by_glossary_name::Builder { + client: self.0.clone(), + glossary_name: glossary_name.into(), + limit: None, + offset: None, + include_term_hierarchy: None, + } + } + } + pub mod list_glossaries { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + pub(crate) ignore_terms_and_categories: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn ignore_terms_and_categories(mut self, ignore_terms_and_categories: bool) -> Self { + self.ignore_terms_and_categories = Some(ignore_terms_and_categories); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + if let Some(ignore_terms_and_categories) = &self.ignore_terms_and_categories { + url.query_pairs_mut() + .append_pair("ignoreTermsAndCategories", &ignore_terms_and_categories.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) atlas_glossary: models::AtlasGlossary, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_glossary).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_category: Vec, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/categories", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_category: models::AtlasGlossaryCategory, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) glossary_category: models::AtlasGlossaryCategory, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) partial_updates: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/partial", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_related_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/related", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: serde_json::Value = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_category_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/terms", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_term: models::AtlasGlossaryTerm, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) glossary_term: models::AtlasGlossaryTerm, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) partial_updates: serde_json::Value, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}/partial", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_term: Vec, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/terms", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entities_assigned_with_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod assign_term_to_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_term_assignment_from_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_term_assignment_from_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_related_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/terms/{}/related", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: serde_json::Value = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) updated_glossary: models::AtlasGlossary, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.updated_glossary).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/categories", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_categories_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/{}/categories/headers", + self.client.endpoint(), + &self.glossary_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_detailed_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/detailed", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) partial_updates: serde_json::Value, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/partial", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) include_term_hierarchy: Option, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/terms", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_term_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/terms/headers", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod import_glossary_terms_via_csv { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) file: bytes::Bytes, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/{}/terms/import", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + unimplemented!("form data not yet supported"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod import_glossary_terms_via_csv_by_glossary_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_name: String, + pub(crate) file: bytes::Bytes, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/name/{}/terms/import", self.client.endpoint(), &self.glossary_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + unimplemented!("form data not yet supported"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_import_csv_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) operation_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/terms/import/{}", self.client.endpoint(), &self.operation_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod export_glossary_terms_as_csv { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) term_guids: Vec, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/{}/terms/export", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.term_guids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value = rsp_body; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_terms_by_glossary_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_name: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/glossary/name/{}/terms", self.client.endpoint(), &self.glossary_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod discovery { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn query(&self, search_request: impl Into) -> query::Builder { + query::Builder { + client: self.0.clone(), + search_request: search_request.into(), + } + } + pub fn suggest(&self, suggest_request: impl Into) -> suggest::Builder { + suggest::Builder { + client: self.0.clone(), + suggest_request: suggest_request.into(), + } + } + pub fn browse(&self, browse_request: impl Into) -> browse::Builder { + browse::Builder { + client: self.0.clone(), + browse_request: browse_request.into(), + } + } + pub fn auto_complete(&self, auto_complete_request: impl Into) -> auto_complete::Builder { + auto_complete::Builder { + client: self.0.clone(), + auto_complete_request: auto_complete_request.into(), + } + } + } + pub mod query { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) search_request: models::SearchRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/query", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.search_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SearchResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod suggest { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) suggest_request: models::SuggestRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/suggest", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.suggest_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SuggestResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod browse { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) browse_request: models::BrowseRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/browse", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.browse_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BrowseResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod auto_complete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) auto_complete_request: models::AutoCompleteRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/autocomplete", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.auto_complete_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AutoCompleteResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod lineage { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_lineage_graph(&self, guid: impl Into, direction: impl Into) -> get_lineage_graph::Builder { + get_lineage_graph::Builder { + client: self.0.clone(), + guid: guid.into(), + direction: direction.into(), + depth: None, + width: None, + include_parent: None, + get_derived_lineage: None, + } + } + pub fn next_page_lineage(&self, guid: impl Into, direction: impl Into) -> next_page_lineage::Builder { + next_page_lineage::Builder { + client: self.0.clone(), + guid: guid.into(), + direction: direction.into(), + get_derived_lineage: None, + offset: None, + limit: None, + } + } + } + pub mod get_lineage_graph { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) direction: String, + pub(crate) depth: Option, + pub(crate) width: Option, + pub(crate) include_parent: Option, + pub(crate) get_derived_lineage: Option, + } + impl Builder { + pub fn depth(mut self, depth: i32) -> Self { + self.depth = Some(depth); + self + } + pub fn width(mut self, width: i32) -> Self { + self.width = Some(width); + self + } + pub fn include_parent(mut self, include_parent: bool) -> Self { + self.include_parent = Some(include_parent); + self + } + pub fn get_derived_lineage(mut self, get_derived_lineage: bool) -> Self { + self.get_derived_lineage = Some(get_derived_lineage); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/lineage/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(depth) = &self.depth { + url.query_pairs_mut().append_pair("depth", &depth.to_string()); + } + if let Some(width) = &self.width { + url.query_pairs_mut().append_pair("width", &width.to_string()); + } + let direction = &self.direction; + url.query_pairs_mut().append_pair("direction", direction); + if let Some(include_parent) = &self.include_parent { + url.query_pairs_mut().append_pair("includeParent", &include_parent.to_string()); + } + if let Some(get_derived_lineage) = &self.get_derived_lineage { + url.query_pairs_mut() + .append_pair("getDerivedLineage", &get_derived_lineage.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasLineageInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod next_page_lineage { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) direction: String, + pub(crate) get_derived_lineage: Option, + pub(crate) offset: Option, + pub(crate) limit: Option, + } + impl Builder { + pub fn get_derived_lineage(mut self, get_derived_lineage: bool) -> Self { + self.get_derived_lineage = Some(get_derived_lineage); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/lineage/{}/next/", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + let direction = &self.direction; + url.query_pairs_mut().append_pair("direction", direction); + if let Some(get_derived_lineage) = &self.get_derived_lineage { + url.query_pairs_mut() + .append_pair("getDerivedLineage", &get_derived_lineage.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasLineageInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod relationship { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create(&self, relationship: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + relationship: relationship.into(), + } + } + pub fn update(&self, relationship: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + relationship: relationship.into(), + } + } + pub fn get(&self, guid: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + guid: guid.into(), + extended_info: None, + } + } + pub fn delete(&self, guid: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) relationship: models::AtlasRelationship, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.relationship).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) relationship: models::AtlasRelationship, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.relationship).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) extended_info: Option, + } + impl Builder { + pub fn extended_info(mut self, extended_info: bool) -> Self { + self.extended_info = Some(extended_info); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(extended_info) = &self.extended_info { + url.query_pairs_mut().append_pair("extendedInfo", &extended_info.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_classification_def_by_guid(&self, guid: impl Into) -> get_classification_def_by_guid::Builder { + get_classification_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_classification_def_by_name(&self, name: impl Into) -> get_classification_def_by_name::Builder { + get_classification_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_entity_definition_by_guid(&self, guid: impl Into) -> get_entity_definition_by_guid::Builder { + get_entity_definition_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_entity_definition_by_name(&self, name: impl Into) -> get_entity_definition_by_name::Builder { + get_entity_definition_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_enum_def_by_guid(&self, guid: impl Into) -> get_enum_def_by_guid::Builder { + get_enum_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_enum_def_by_name(&self, name: impl Into) -> get_enum_def_by_name::Builder { + get_enum_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_relationship_def_by_guid(&self, guid: impl Into) -> get_relationship_def_by_guid::Builder { + get_relationship_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_relationship_def_by_name(&self, name: impl Into) -> get_relationship_def_by_name::Builder { + get_relationship_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_struct_def_by_guid(&self, guid: impl Into) -> get_struct_def_by_guid::Builder { + get_struct_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_struct_def_by_name(&self, name: impl Into) -> get_struct_def_by_name::Builder { + get_struct_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_type_definition_by_guid(&self, guid: impl Into) -> get_type_definition_by_guid::Builder { + get_type_definition_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_type_definition_by_name(&self, name: impl Into) -> get_type_definition_by_name::Builder { + get_type_definition_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn delete_type_by_name(&self, name: impl Into) -> delete_type_by_name::Builder { + delete_type_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_all_type_definitions(&self) -> get_all_type_definitions::Builder { + get_all_type_definitions::Builder { + client: self.0.clone(), + include_term_template: None, + type_: None, + } + } + pub fn create_type_definitions(&self, types_def: impl Into) -> create_type_definitions::Builder { + create_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn update_atlas_type_definitions(&self, types_def: impl Into) -> update_atlas_type_definitions::Builder { + update_atlas_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn delete_type_definitions(&self, types_def: impl Into) -> delete_type_definitions::Builder { + delete_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn list_type_definition_headers(&self) -> list_type_definition_headers::Builder { + list_type_definition_headers::Builder { + client: self.0.clone(), + include_term_template: None, + type_: None, + } + } + pub fn get_term_template_def_by_guid(&self, guid: impl Into) -> get_term_template_def_by_guid::Builder { + get_term_template_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_term_template_def_by_name(&self, name: impl Into) -> get_term_template_def_by_name::Builder { + get_term_template_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + } + pub mod get_classification_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/classificationdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassificationDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classification_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/classificationdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassificationDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_definition_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/entitydef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_definition_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/entitydef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_enum_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/enumdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEnumDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_enum_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/enumdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEnumDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_relationship_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/relationshipdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_relationship_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/relationshipdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_struct_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/structdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasStructDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_struct_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/structdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasStructDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_type_definition_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypeDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_type_definition_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypeDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_type_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_all_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) include_term_template: Option, + pub(crate) type_: Option, + } + impl Builder { + pub fn include_term_template(mut self, include_term_template: bool) -> Self { + self.include_term_template = Some(include_term_template); + self + } + pub fn type_(mut self, type_: impl Into) -> Self { + self.type_ = Some(type_.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_template) = &self.include_term_template { + url.query_pairs_mut() + .append_pair("includeTermTemplate", &include_term_template.to_string()); + } + if let Some(type_) = &self.type_ { + url.query_pairs_mut().append_pair("type", type_); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_atlas_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_type_definition_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) include_term_template: Option, + pub(crate) type_: Option, + } + impl Builder { + pub fn include_term_template(mut self, include_term_template: bool) -> Self { + self.include_term_template = Some(include_term_template); + self + } + pub fn type_(mut self, type_: impl Into) -> Self { + self.type_ = Some(type_.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs/headers", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_template) = &self.include_term_template { + url.query_pairs_mut() + .append_pair("includeTermTemplate", &include_term_template.to_string()); + } + if let Some(type_) = &self.type_ { + url.query_pairs_mut().append_pair("type", type_); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_term_template_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/types/termtemplatedef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TermTemplateDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_term_template_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/types/termtemplatedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TermTemplateDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod collection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_or_update( + &self, + collection: impl Into, + entity: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + collection: collection.into(), + entity: entity.into(), + } + } + pub fn create_or_update_bulk( + &self, + collection: impl Into, + entities: impl Into, + ) -> create_or_update_bulk::Builder { + create_or_update_bulk::Builder { + client: self.0.clone(), + collection: collection.into(), + entities: entities.into(), + } + } + pub fn move_entities_to_collection( + &self, + collection: impl Into, + move_entities_request: impl Into, + ) -> move_entities_to_collection::Builder { + move_entities_to_collection::Builder { + client: self.0.clone(), + collection: collection.into(), + move_entities_request: move_entities_request.into(), + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) entity: models::AtlasEntityWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_bulk { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) entities: models::AtlasEntitiesWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity/bulk", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entities).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod move_entities_to_collection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) move_entities_request: models::MoveEntitiesRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity/moveHere", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-05-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.move_entities_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/purview/src/package_2021_10_01_preview/mod.rs b/services/svc/purview/src/package_2021_10_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/purview/src/package_2021_10_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/purview/src/package_2021_10_01_preview/models.rs b/services/svc/purview/src/package_2021_10_01_preview/models.rs new file mode 100644 index 0000000000..3ae81410e7 --- /dev/null +++ b/services/svc/purview/src/package_2021_10_01_preview/models.rs @@ -0,0 +1,4099 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AdlsGen1CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1MsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1MsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1MsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AdlsGen1MsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1Properties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AdlsGen1Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AdlsGen1ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AdlsGen2CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2MsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2MsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2MsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AdlsGen2MsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2Properties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AdlsGen2Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AdlsGen2ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AmazonAccountCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "awsAccountId", default, skip_serializing_if = "Option::is_none")] + pub aws_account_id: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, +} +impl AmazonAccountProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonAccountScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlRoleArnScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlRoleArnScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlRoleArnScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlRoleArnScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonPostgreSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, + #[serde(rename = "isMauiScan", default, skip_serializing_if = "Option::is_none")] + pub is_maui_scan: Option, +} +impl AmazonS3CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3Properties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, +} +impl AmazonS3Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3RoleArnScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3RoleArnScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3RoleArnScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, + #[serde(rename = "isMauiScan", default, skip_serializing_if = "Option::is_none")] + pub is_maui_scan: Option, +} +impl AmazonS3RoleArnScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AmazonS3ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, +} +impl AzureCosmosDbCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "accountUri", default, skip_serializing_if = "Option::is_none")] + pub account_uri: Option, +} +impl AzureCosmosDbProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureCosmosDbScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, +} +impl AzureDataExplorerCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, +} +impl AzureDataExplorerMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureDataExplorerProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureDataExplorerScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataSourceProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, +} +impl AzureDataSourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "shareName", default, skip_serializing_if = "Option::is_none")] + pub share_name: Option, +} +impl AzureFileServiceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureFileServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AzureFileServiceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVault { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureKeyVault { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl AzureKeyVaultList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVaultProperties { + #[serde(rename = "baseUrl", default, skip_serializing_if = "Option::is_none")] + pub base_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl AzureKeyVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlCredentialScanProperties { + #[serde(flatten)] + pub azure_my_sql_scan_properties: AzureMySqlScanProperties, +} +impl AzureMySqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl AzureMySqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureMySqlScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureMySqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "sslMode", default, skip_serializing_if = "Option::is_none")] + pub ssl_mode: Option, +} +impl AzurePostgreSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl AzurePostgreSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzurePostgreSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureResourceGroupCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureResourceGroupMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +impl AzureResourceGroupProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureResourceGroupScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDataWarehouseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDataWarehouseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDataWarehouseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDataWarehouseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDatabaseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDatabaseManagedInstanceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDatabaseManagedInstanceMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDatabaseManagedInstanceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDatabaseManagedInstanceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDatabaseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDatabaseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, +} +impl AzureSqlScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureStorageCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AzureStorageMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureStorageProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AzureStorageScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSubscriptionCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSubscriptionMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +impl AzureSubscriptionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSubscriptionScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "sqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_endpoint: Option, + #[serde(rename = "sqlOnDemandEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_on_demand_endpoint: Option, +} +impl AzureSynapseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSynapseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseWorkspaceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseWorkspaceMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "dedicatedSqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub dedicated_sql_endpoint: Option, + #[serde(rename = "serverlessSqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub serverless_sql_endpoint: Option, +} +impl AzureSynapseWorkspaceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSynapseWorkspaceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClassificationRule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: classification_rule::Kind, +} +impl ClassificationRule { + pub fn new(kind: classification_rule::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + } + } +} +pub mod classification_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + System, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClassificationRuleList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ClassificationRuleList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClassificationRulePattern { + pub kind: classification_rule_pattern::Kind, +} +impl ClassificationRulePattern { + pub fn new(kind: classification_rule_pattern::Kind) -> Self { + Self { kind } + } +} +pub mod classification_rule_pattern { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Regex, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CollectionReference { + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CollectionReference { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectedVia { + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, +} +impl ConnectedVia { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialReference { + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "credentialType", default, skip_serializing_if = "Option::is_none")] + pub credential_type: Option, +} +impl CredentialReference { + pub fn new() -> Self { + Self::default() + } +} +pub mod credential_reference { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CredentialType { + AccountKey, + ServicePrincipal, + BasicAuth, + SqlAuth, + #[serde(rename = "AmazonARN")] + AmazonArn, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomClassificationRule { + #[serde(flatten)] + pub classification_rule: ClassificationRule, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CustomClassificationRule { + pub fn new(classification_rule: ClassificationRule) -> Self { + Self { + classification_rule, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomClassificationRuleProperties { + #[serde(rename = "minimumPercentageMatch", default, skip_serializing_if = "Option::is_none")] + pub minimum_percentage_match: Option, + #[serde(rename = "classificationAction", default, skip_serializing_if = "Option::is_none")] + pub classification_action: Option, + #[serde(rename = "dataPatterns", default, skip_serializing_if = "Vec::is_empty")] + pub data_patterns: Vec, + #[serde(rename = "columnPatterns", default, skip_serializing_if = "Vec::is_empty")] + pub column_patterns: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "classificationName", default, skip_serializing_if = "Option::is_none")] + pub classification_name: Option, + #[serde(rename = "ruleStatus", default, skip_serializing_if = "Option::is_none")] + pub rule_status: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl CustomClassificationRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod custom_classification_rule_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClassificationAction { + Keep, + Delete, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleStatus { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomFileExtension { + #[serde(rename = "customFileType", default, skip_serializing_if = "Option::is_none")] + pub custom_file_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "fileExtension", default, skip_serializing_if = "Option::is_none")] + pub file_extension: Option, +} +impl CustomFileExtension { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomFileType { + #[serde(rename = "builtInType", default, skip_serializing_if = "Option::is_none")] + pub built_in_type: Option, + #[serde(rename = "customDelimiter", default, skip_serializing_if = "Option::is_none")] + pub custom_delimiter: Option, +} +impl CustomFileType { + pub fn new() -> Self { + Self::default() + } +} +pub mod custom_file_type { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BuiltInType { + #[serde(rename = "AVRO")] + Avro, + #[serde(rename = "ORC")] + Orc, + #[serde(rename = "PARQUET")] + Parquet, + #[serde(rename = "JSON")] + Json, + #[serde(rename = "TXT")] + Txt, + #[serde(rename = "XML")] + Xml, + Documents, + #[serde(rename = "CSV")] + Csv, + #[serde(rename = "PSV")] + Psv, + #[serde(rename = "SSV")] + Ssv, + #[serde(rename = "TSV")] + Tsv, + #[serde(rename = "GZ")] + Gz, + #[serde(rename = "DOC")] + Doc, + #[serde(rename = "DOCM")] + Docm, + #[serde(rename = "DOCX")] + Docx, + #[serde(rename = "DOT")] + Dot, + #[serde(rename = "ODP")] + Odp, + #[serde(rename = "ODS")] + Ods, + #[serde(rename = "ODT")] + Odt, + #[serde(rename = "PDF")] + Pdf, + #[serde(rename = "POT")] + Pot, + #[serde(rename = "PPS")] + Pps, + #[serde(rename = "PPSX")] + Ppsx, + #[serde(rename = "PPT")] + Ppt, + #[serde(rename = "PPTM")] + Pptm, + #[serde(rename = "PPTX")] + Pptx, + #[serde(rename = "XLC")] + Xlc, + #[serde(rename = "XLS")] + Xls, + #[serde(rename = "XLSB")] + Xlsb, + #[serde(rename = "XLSM")] + Xlsm, + #[serde(rename = "XLSX")] + Xlsx, + #[serde(rename = "XLT")] + Xlt, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataSource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: data_source::Kind, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub scans: Vec, +} +impl DataSource { + pub fn new(kind: data_source::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + scans: Vec::new(), + } + } +} +pub mod data_source { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataSourceList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl DataSourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataSourceProperties { + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collection: Option, +} +impl DataSourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorModel { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorModel { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponseModel { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponseModel { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpandingResourceScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "resourceTypes", default, skip_serializing_if = "Option::is_none")] + pub resource_types: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl ExpandingResourceScanProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod expanding_resource_scan_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ResourceTypes { + #[serde(rename = "None", default, skip_serializing_if = "Option::is_none")] + pub none: Option, + #[serde(rename = "AzureSubscription", default, skip_serializing_if = "Option::is_none")] + pub azure_subscription: Option, + #[serde(rename = "AzureResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub azure_resource_group: Option, + #[serde(rename = "AzureSynapseWorkspace", default, skip_serializing_if = "Option::is_none")] + pub azure_synapse_workspace: Option, + #[serde(rename = "AzureSynapse", default, skip_serializing_if = "Option::is_none")] + pub azure_synapse: Option, + #[serde(rename = "AdlsGen1", default, skip_serializing_if = "Option::is_none")] + pub adls_gen1: Option, + #[serde(rename = "AdlsGen2", default, skip_serializing_if = "Option::is_none")] + pub adls_gen2: Option, + #[serde(rename = "AmazonAccount", default, skip_serializing_if = "Option::is_none")] + pub amazon_account: Option, + #[serde(rename = "AmazonS3", default, skip_serializing_if = "Option::is_none")] + pub amazon_s3: Option, + #[serde(rename = "AmazonSql", default, skip_serializing_if = "Option::is_none")] + pub amazon_sql: Option, + #[serde(rename = "AzureCosmosDb", default, skip_serializing_if = "Option::is_none")] + pub azure_cosmos_db: Option, + #[serde(rename = "AzureDataExplorer", default, skip_serializing_if = "Option::is_none")] + pub azure_data_explorer: Option, + #[serde(rename = "AzureFileService", default, skip_serializing_if = "Option::is_none")] + pub azure_file_service: Option, + #[serde(rename = "AzureSqlDatabase", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_database: Option, + #[serde(rename = "AmazonPostgreSql", default, skip_serializing_if = "Option::is_none")] + pub amazon_postgre_sql: Option, + #[serde(rename = "AzurePostgreSql", default, skip_serializing_if = "Option::is_none")] + pub azure_postgre_sql: Option, + #[serde(rename = "SqlServerDatabase", default, skip_serializing_if = "Option::is_none")] + pub sql_server_database: Option, + #[serde(rename = "AzureSqlDatabaseManagedInstance", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_database_managed_instance: Option, + #[serde(rename = "AzureSqlDataWarehouse", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_data_warehouse: Option, + #[serde(rename = "AzureMySql", default, skip_serializing_if = "Option::is_none")] + pub azure_my_sql: Option, + #[serde(rename = "AzureStorage", default, skip_serializing_if = "Option::is_none")] + pub azure_storage: Option, + #[serde(rename = "Teradata", default, skip_serializing_if = "Option::is_none")] + pub teradata: Option, + #[serde(rename = "Oracle", default, skip_serializing_if = "Option::is_none")] + pub oracle: Option, + #[serde(rename = "SapS4Hana", default, skip_serializing_if = "Option::is_none")] + pub sap_s4_hana: Option, + #[serde(rename = "SapEcc", default, skip_serializing_if = "Option::is_none")] + pub sap_ecc: Option, + #[serde(rename = "PowerBI", default, skip_serializing_if = "Option::is_none")] + pub power_bi: Option, + } + impl ResourceTypes { + pub fn new() -> Self { + Self::default() + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Filter { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Filter { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FilterProperties { + #[serde(rename = "excludeUriPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub exclude_uri_prefixes: Vec, + #[serde(rename = "includeUriPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub include_uri_prefixes: Vec, +} +impl FilterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MitiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "maximumMemoryAllowedInGb", default, skip_serializing_if = "Option::is_none")] + pub maximum_memory_allowed_in_gb: Option, + #[serde(rename = "mitiCache", default, skip_serializing_if = "Option::is_none")] + pub miti_cache: Option, +} +impl MitiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Notification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +impl Notification { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResponse { + #[serde(rename = "scanResultId", default, skip_serializing_if = "Option::is_none")] + pub scan_result_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl OperationResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Accepted, + InProgress, + TransientFailure, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleOracleCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleOracleCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleOracleCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl OracleOracleCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleOracleUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleOracleUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleOracleUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl OracleOracleUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub service: Option, +} +impl OracleProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl OracleScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiDelegatedScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiDelegatedScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiDelegatedScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "includePersonalWorkspaces", default, skip_serializing_if = "Option::is_none")] + pub include_personal_workspaces: Option, +} +impl PowerBiDelegatedScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "includePersonalWorkspaces", default, skip_serializing_if = "Option::is_none")] + pub include_personal_workspaces: Option, +} +impl PowerBiMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, +} +impl PowerBiProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl PowerBiScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceSchedule { + #[serde(rename = "additionalProperties", default, skip_serializing_if = "Option::is_none")] + pub additional_properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub minutes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hours: Vec, + #[serde(rename = "weekDays", default, skip_serializing_if = "Vec::is_empty")] + pub week_days: Vec, + #[serde(rename = "monthDays", default, skip_serializing_if = "Vec::is_empty")] + pub month_days: Vec, + #[serde(rename = "monthlyOccurrences", default, skip_serializing_if = "Vec::is_empty")] + pub monthly_occurrences: Vec, +} +impl RecurrenceSchedule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceScheduleOccurrence { + #[serde(rename = "additionalProperties", default, skip_serializing_if = "Option::is_none")] + pub additional_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub occurrence: Option, +} +impl RecurrenceScheduleOccurrence { + pub fn new() -> Self { + Self::default() + } +} +pub mod recurrence_schedule_occurrence { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Day { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegexClassificationRulePattern { + #[serde(flatten)] + pub classification_rule_pattern: ClassificationRulePattern, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pattern: Option, +} +impl RegexClassificationRulePattern { + pub fn new(classification_rule_pattern: ClassificationRulePattern) -> Self { + Self { + classification_rule_pattern, + pattern: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNameFilter { + #[serde(rename = "excludePrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub exclude_prefixes: Vec, + #[serde(rename = "includePrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub include_prefixes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, +} +impl ResourceNameFilter { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceTypeFilter { + #[serde(rename = "scanRulesetName", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_name: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(rename = "resourceNameFilter", default, skip_serializing_if = "Option::is_none")] + pub resource_name_filter: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl ResourceTypeFilter { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_type_filter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "applicationServer", default, skip_serializing_if = "Option::is_none")] + pub application_server: Option, + #[serde(rename = "systemNumber", default, skip_serializing_if = "Option::is_none")] + pub system_number: Option, +} +impl SapEccProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSapEccCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSapEccCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccSapEccCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapEccSapEccCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSapEccUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSapEccUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccSapEccUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapEccSapEccUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SapEccScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "applicationServer", default, skip_serializing_if = "Option::is_none")] + pub application_server: Option, + #[serde(rename = "systemNumber", default, skip_serializing_if = "Option::is_none")] + pub system_number: Option, +} +impl SapS4HanaProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSapS4HanaCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSapS4HanaCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaSapS4HanaCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapS4HanaSapS4HanaCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSapS4HanaUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSapS4HanaUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaSapS4HanaUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapS4HanaSapS4HanaUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SapS4HanaScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Scan { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: scan::Kind, + #[serde(rename = "scanResults", default, skip_serializing_if = "Vec::is_empty")] + pub scan_results: Vec, +} +impl Scan { + pub fn new(kind: scan::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + scan_results: Vec::new(), + } + } +} +pub mod scan { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + AzureSubscriptionCredential, + AzureSubscriptionMsi, + AzureResourceGroupCredential, + AzureResourceGroupMsi, + AzureSynapseWorkspaceCredential, + AzureSynapseWorkspaceMsi, + AzureSynapseCredential, + AzureSynapseMsi, + AdlsGen1Credential, + AdlsGen1Msi, + AdlsGen2Credential, + AdlsGen2Msi, + AmazonAccountCredential, + AmazonS3Credential, + #[serde(rename = "AmazonS3RoleARN")] + AmazonS3RoleArn, + AmazonSqlCredential, + AzureCosmosDbCredential, + AzureDataExplorerCredential, + AzureDataExplorerMsi, + AzureFileServiceCredential, + AzureSqlDatabaseCredential, + AzureSqlDatabaseMsi, + AmazonPostgreSqlCredential, + #[serde(rename = "AmazonPostgreSqlRoleARN")] + AmazonPostgreSqlRoleArn, + AzurePostgreSqlCredential, + SqlServerDatabaseCredential, + AzureSqlDatabaseManagedInstanceCredential, + AzureSqlDatabaseManagedInstanceMsi, + AzureSqlDataWarehouseCredential, + AzureSqlDataWarehouseMsi, + AzureMySqlCredential, + AzureStorageCredential, + AzureStorageMsi, + TeradataTeradataCredential, + TeradataTeradataUserPass, + TeradataUserPass, + OracleOracleCredential, + OracleOracleUserPass, + SapS4HanaSapS4HanaCredential, + SapS4HanaSapS4HanaUserPass, + SapEccSapEccCredential, + SapEccSapEccUserPass, + #[serde(rename = "PowerBIDelegated")] + PowerBiDelegated, + #[serde(rename = "PowerBIMsi")] + PowerBiMsi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanDiagnostics { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub notifications: Vec, + #[serde(rename = "exceptionCountMap", default, skip_serializing_if = "Option::is_none")] + pub exception_count_map: Option, +} +impl ScanDiagnostics { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanHistoryList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanHistoryList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanProperties { + #[serde(rename = "scanRulesetName", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_name: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collection: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub workers: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "connectedVia", default, skip_serializing_if = "Option::is_none")] + pub connected_via: Option, +} +impl ScanProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod scan_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanResult { + #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")] + pub parent_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "assetsDiscovered", default, skip_serializing_if = "Option::is_none")] + pub assets_discovered: Option, + #[serde(rename = "assetsClassified", default, skip_serializing_if = "Option::is_none")] + pub assets_classified: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub diagnostics: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "queuedTime", default, skip_serializing_if = "Option::is_none")] + pub queued_time: Option, + #[serde(rename = "pipelineStartTime", default, skip_serializing_if = "Option::is_none")] + pub pipeline_start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "scanRulesetVersion", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_version: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(rename = "scanLevelType", default, skip_serializing_if = "Option::is_none")] + pub scan_level_type: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "runType", default, skip_serializing_if = "Option::is_none")] + pub run_type: Option, + #[serde(rename = "dataSourceType", default, skip_serializing_if = "Option::is_none")] + pub data_source_type: Option, +} +impl ScanResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod scan_result { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanLevelType { + Full, + Incremental, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataSourceType { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScanRuleset { + #[serde(flatten)] + pub versioned_scan_ruleset: VersionedScanRuleset, + pub kind: scan_ruleset::Kind, +} +impl ScanRuleset { + pub fn new(kind: scan_ruleset::Kind) -> Self { + Self { + versioned_scan_ruleset: VersionedScanRuleset::default(), + kind, + } + } +} +pub mod scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanRulesetList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanRulesetList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanRulesetProperties { + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "excludedSystemClassifications", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_system_classifications: Vec, + #[serde(rename = "includedCustomClassificationRuleNames", default, skip_serializing_if = "Vec::is_empty")] + pub included_custom_classification_rule_names: Vec, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanningRule { + #[serde(rename = "fileExtensions", default, skip_serializing_if = "Vec::is_empty")] + pub file_extensions: Vec, + #[serde(rename = "customFileExtensions", default, skip_serializing_if = "Vec::is_empty")] + pub custom_file_extensions: Vec, +} +impl ScanningRule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanningRuleScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, + #[serde(rename = "scanningRule", default, skip_serializing_if = "Option::is_none")] + pub scanning_rule: Option, +} +impl ScanningRuleScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl SqlServerDatabaseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl SqlServerDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SqlServerDatabaseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemClassificationRule { + #[serde(flatten)] + pub classification_rule: ClassificationRule, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SystemClassificationRule { + pub fn new(classification_rule: ClassificationRule) -> Self { + Self { + classification_rule, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemClassificationRuleProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "classificationName", default, skip_serializing_if = "Option::is_none")] + pub classification_name: Option, + #[serde(rename = "ruleStatus", default, skip_serializing_if = "Option::is_none")] + pub rule_status: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemClassificationRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_classification_rule_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleStatus { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemScanRuleset { + #[serde(flatten)] + pub versioned_scan_ruleset: VersionedScanRuleset, + pub kind: system_scan_ruleset::Kind, +} +impl SystemScanRuleset { + pub fn new(kind: system_scan_ruleset::Kind) -> Self { + Self { + versioned_scan_ruleset: VersionedScanRuleset::default(), + kind, + } + } +} +pub mod system_scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemScanRulesetList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl SystemScanRulesetList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, +} +impl TeradataProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl TeradataScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataTeradataCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataTeradataCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataTeradataCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl TeradataTeradataCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataTeradataUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataTeradataUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataTeradataUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl TeradataTeradataUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataUserPassScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl TeradataUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Trigger { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Trigger { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recurrence: Option, + #[serde(rename = "recurrenceInterval", default, skip_serializing_if = "Option::is_none")] + pub recurrence_interval: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "lastScheduled", default, skip_serializing_if = "Option::is_none")] + pub last_scheduled: Option, + #[serde(rename = "scanLevel", default, skip_serializing_if = "Option::is_none")] + pub scan_level: Option, + #[serde(rename = "incrementalScanStartTime", default, skip_serializing_if = "Option::is_none")] + pub incremental_scan_start_time: Option, +} +impl TriggerProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanLevel { + Full, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerRecurrence { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub frequency: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl TriggerRecurrence { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_recurrence { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Frequency { + Week, + Month, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VersionedScanRuleset { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl VersionedScanRuleset { + pub fn new() -> Self { + Self::default() + } +} +pub mod versioned_scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Enabled, + Disabled, + } +} diff --git a/services/svc/purview/src/package_2021_10_01_preview/operations.rs b/services/svc/purview/src/package_2021_10_01_preview/operations.rs new file mode 100644 index 0000000000..cb9d786ed9 --- /dev/null +++ b/services/svc/purview/src/package_2021_10_01_preview/operations.rs @@ -0,0 +1,3159 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = "https://purview.azure.com/scan"; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn classification_rules(&self) -> classification_rules::Client { + classification_rules::Client(self.clone()) + } + pub fn data_sources(&self) -> data_sources::Client { + data_sources::Client(self.clone()) + } + pub fn filters(&self) -> filters::Client { + filters::Client(self.clone()) + } + pub fn key_vault_connections(&self) -> key_vault_connections::Client { + key_vault_connections::Client(self.clone()) + } + pub fn scan_result(&self) -> scan_result::Client { + scan_result::Client(self.clone()) + } + pub fn scan_rulesets(&self) -> scan_rulesets::Client { + scan_rulesets::Client(self.clone()) + } + pub fn scans(&self) -> scans::Client { + scans::Client(self.clone()) + } + pub fn system_scan_rulesets(&self) -> system_scan_rulesets::Client { + system_scan_rulesets::Client(self.clone()) + } + pub fn triggers(&self) -> triggers::Client { + triggers::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + KeyVaultConnections_Get(#[from] key_vault_connections::get::Error), + #[error(transparent)] + KeyVaultConnections_Create(#[from] key_vault_connections::create::Error), + #[error(transparent)] + KeyVaultConnections_Delete(#[from] key_vault_connections::delete::Error), + #[error(transparent)] + KeyVaultConnections_ListAll(#[from] key_vault_connections::list_all::Error), + #[error(transparent)] + ClassificationRules_Get(#[from] classification_rules::get::Error), + #[error(transparent)] + ClassificationRules_CreateOrUpdate(#[from] classification_rules::create_or_update::Error), + #[error(transparent)] + ClassificationRules_Delete(#[from] classification_rules::delete::Error), + #[error(transparent)] + ClassificationRules_ListAll(#[from] classification_rules::list_all::Error), + #[error(transparent)] + ClassificationRules_ListVersionsByClassificationRuleName( + #[from] classification_rules::list_versions_by_classification_rule_name::Error, + ), + #[error(transparent)] + ClassificationRules_TagClassificationVersion(#[from] classification_rules::tag_classification_version::Error), + #[error(transparent)] + DataSources_Get(#[from] data_sources::get::Error), + #[error(transparent)] + DataSources_CreateOrUpdate(#[from] data_sources::create_or_update::Error), + #[error(transparent)] + DataSources_Delete(#[from] data_sources::delete::Error), + #[error(transparent)] + DataSources_ListAll(#[from] data_sources::list_all::Error), + #[error(transparent)] + Filters_Get(#[from] filters::get::Error), + #[error(transparent)] + Filters_CreateOrUpdate(#[from] filters::create_or_update::Error), + #[error(transparent)] + Scans_Get(#[from] scans::get::Error), + #[error(transparent)] + Scans_CreateOrUpdate(#[from] scans::create_or_update::Error), + #[error(transparent)] + Scans_Delete(#[from] scans::delete::Error), + #[error(transparent)] + Scans_ListByDataSource(#[from] scans::list_by_data_source::Error), + #[error(transparent)] + ScanResult_RunScan(#[from] scan_result::run_scan::Error), + #[error(transparent)] + ScanResult_CancelScan(#[from] scan_result::cancel_scan::Error), + #[error(transparent)] + ScanResult_ListScanHistory(#[from] scan_result::list_scan_history::Error), + #[error(transparent)] + ScanRulesets_Get(#[from] scan_rulesets::get::Error), + #[error(transparent)] + ScanRulesets_CreateOrUpdate(#[from] scan_rulesets::create_or_update::Error), + #[error(transparent)] + ScanRulesets_Delete(#[from] scan_rulesets::delete::Error), + #[error(transparent)] + ScanRulesets_ListAll(#[from] scan_rulesets::list_all::Error), + #[error(transparent)] + SystemScanRulesets_ListAll(#[from] system_scan_rulesets::list_all::Error), + #[error(transparent)] + SystemScanRulesets_Get(#[from] system_scan_rulesets::get::Error), + #[error(transparent)] + SystemScanRulesets_GetByVersion(#[from] system_scan_rulesets::get_by_version::Error), + #[error(transparent)] + SystemScanRulesets_GetLatest(#[from] system_scan_rulesets::get_latest::Error), + #[error(transparent)] + SystemScanRulesets_ListVersionsByDataSource(#[from] system_scan_rulesets::list_versions_by_data_source::Error), + #[error(transparent)] + Triggers_GetTrigger(#[from] triggers::get_trigger::Error), + #[error(transparent)] + Triggers_CreateTrigger(#[from] triggers::create_trigger::Error), + #[error(transparent)] + Triggers_DeleteTrigger(#[from] triggers::delete_trigger::Error), +} +pub mod key_vault_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, key_vault_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + } + } + pub fn create(&self, key_vault_name: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + body: body.into(), + } + } + pub fn delete(&self, key_vault_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + pub(crate) body: models::AzureKeyVault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AzureKeyVault), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod classification_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, classification_rule_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn create_or_update(&self, classification_rule_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + body: None, + } + } + pub fn delete(&self, classification_rule_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + pub fn list_versions_by_classification_rule_name( + &self, + classification_rule_name: impl Into, + ) -> list_versions_by_classification_rule_name::Builder { + list_versions_by_classification_rule_name::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn tag_classification_version( + &self, + classification_rule_name: impl Into, + classification_rule_version: i32, + action: impl Into, + ) -> tag_classification_version::Builder { + tag_classification_version::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + classification_rule_version, + action: action.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClassificationRule), + Created201(models::ClassificationRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClassificationRule), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRuleList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_versions_by_classification_rule_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/classificationrules/{}/versions", + self.client.endpoint(), + &self.classification_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRuleList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod tag_classification_version { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + pub(crate) classification_rule_version: i32, + pub(crate) action: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/classificationrules/{}/versions/{}/:tag", + self.client.endpoint(), + &self.classification_rule_name, + &self.classification_rule_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let action = &self.action; + url.query_pairs_mut().append_pair("action", action); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_sources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + pub fn create_or_update(&self, data_source_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + body: None, + } + } + pub fn delete(&self, data_source_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataSource), + Created201(models::DataSource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataSource), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod filters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into, scan_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_or_update(&self, data_source_name: impl Into, scan_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/filters/custom", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Filter), + Created201(models::Filter), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/filters/custom", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into, scan_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_or_update( + &self, + data_source_name: impl Into, + scan_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: body.into(), + } + } + pub fn delete(&self, data_source_name: impl Into, scan_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn list_by_data_source(&self, data_source_name: impl Into) -> list_by_data_source::Builder { + list_by_data_source::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Scan), + Created201(models::Scan), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: models::Scan, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Scan), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_data_source { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}/scans", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scan_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn run_scan( + &self, + data_source_name: impl Into, + scan_name: impl Into, + run_id: impl Into, + ) -> run_scan::Builder { + run_scan::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + run_id: run_id.into(), + scan_level: None, + } + } + pub fn cancel_scan( + &self, + data_source_name: impl Into, + scan_name: impl Into, + run_id: impl Into, + ) -> cancel_scan::Builder { + cancel_scan::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + run_id: run_id.into(), + } + } + pub fn list_scan_history(&self, data_source_name: impl Into, scan_name: impl Into) -> list_scan_history::Builder { + list_scan_history::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + } + pub mod run_scan { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) run_id: String, + pub(crate) scan_level: Option, + } + impl Builder { + pub fn scan_level(mut self, scan_level: impl Into) -> Self { + self.scan_level = Some(scan_level.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + if let Some(scan_level) = &self.scan_level { + url.query_pairs_mut().append_pair("scanLevel", scan_level); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel_scan { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs/{}/:cancel", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_scan_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanHistoryList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scan_rulesets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, scan_ruleset_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + } + } + pub fn create_or_update(&self, scan_ruleset_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + body: None, + } + } + pub fn delete(&self, scan_ruleset_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScanRuleset), + Created201(models::ScanRuleset), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScanRuleset), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod system_scan_rulesets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + pub fn get(&self, data_source_type: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_type: data_source_type.into(), + } + } + pub fn get_by_version(&self, version: i32) -> get_by_version::Builder { + get_by_version::Builder { + client: self.0.clone(), + version, + data_source_type: None, + } + } + pub fn get_latest(&self) -> get_latest::Builder { + get_latest::Builder { + client: self.0.clone(), + data_source_type: None, + } + } + pub fn list_versions_by_data_source(&self) -> list_versions_by_data_source::Builder { + list_versions_by_data_source::Builder { + client: self.0.clone(), + data_source_type: None, + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/systemScanRulesets/datasources/{}", + self.client.endpoint(), + &self.data_source_type + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_version { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) version: i32, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions/{}", self.client.endpoint(), &self.version); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_latest { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions/latest", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_versions_by_data_source { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod triggers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_trigger(&self, data_source_name: impl Into, scan_name: impl Into) -> get_trigger::Builder { + get_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_trigger( + &self, + data_source_name: impl Into, + scan_name: impl Into, + body: impl Into, + ) -> create_trigger::Builder { + create_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: body.into(), + } + } + pub fn delete_trigger(&self, data_source_name: impl Into, scan_name: impl Into) -> delete_trigger::Builder { + delete_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + } + pub mod get_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Trigger), + Created201(models::Trigger), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: models::Trigger, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Trigger), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-10-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/purview/src/package_2022_02_01_preview/mod.rs b/services/svc/purview/src/package_2022_02_01_preview/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/purview/src/package_2022_02_01_preview/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/purview/src/package_2022_02_01_preview/models.rs b/services/svc/purview/src/package_2022_02_01_preview/models.rs new file mode 100644 index 0000000000..734e2a6f42 --- /dev/null +++ b/services/svc/purview/src/package_2022_02_01_preview/models.rs @@ -0,0 +1,4477 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "Credential type that uses Account Key for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AccountKeyAuthAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AccountKeyAuthAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AccountKeyCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl AccountKeyCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AdlsGen1CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1MsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1MsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1MsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AdlsGen1MsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1Properties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AdlsGen1Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen1ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AdlsGen1ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen1SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen1SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AdlsGen2CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2MsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2MsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2MsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AdlsGen2MsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2Properties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AdlsGen2Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdlsGen2ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AdlsGen2ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AdlsGen2SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AdlsGen2SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AmazonAccountCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "awsAccountId", default, skip_serializing_if = "Option::is_none")] + pub aws_account_id: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, +} +impl AmazonAccountProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonAccountScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonAccountScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonAccountSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonAccountSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlRoleArnScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlRoleArnScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlRoleArnScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonPostgreSqlRoleArnScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonPostgreSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonPostgreSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonPostgreSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonPostgreSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3CredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3CredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3CredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, + #[serde(rename = "isMauiScan", default, skip_serializing_if = "Option::is_none")] + pub is_maui_scan: Option, +} +impl AmazonS3CredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3DataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3DataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3Properties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, +} +impl AmazonS3Properties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3RoleArnScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3RoleArnScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3RoleArnScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, + #[serde(rename = "isMauiScan", default, skip_serializing_if = "Option::is_none")] + pub is_maui_scan: Option, +} +impl AmazonS3RoleArnScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3ScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3ScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3ScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AmazonS3ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3SystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonS3SystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "vpcEndpointServiceName", default, skip_serializing_if = "Option::is_none")] + pub vpc_endpoint_service_name: Option, +} +impl AmazonSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AmazonSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AmazonSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, +} +impl AzureCosmosDbCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "accountUri", default, skip_serializing_if = "Option::is_none")] + pub account_uri: Option, +} +impl AzureCosmosDbProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureCosmosDbScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureCosmosDbScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureCosmosDbSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureCosmosDbSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, +} +impl AzureDataExplorerCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, +} +impl AzureDataExplorerMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureDataExplorerProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureDataExplorerScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureDataExplorerSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataSourceProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(rename = "resourceName", default, skip_serializing_if = "Option::is_none")] + pub resource_name: Option, +} +impl AzureDataSourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "shareName", default, skip_serializing_if = "Option::is_none")] + pub share_name: Option, +} +impl AzureFileServiceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureFileServiceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureFileServiceScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AzureFileServiceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileServiceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureFileServiceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVault { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureKeyVault { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVaultList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl AzureKeyVaultList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureKeyVaultProperties { + #[serde(rename = "baseUrl", default, skip_serializing_if = "Option::is_none")] + pub base_url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl AzureKeyVaultProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlCredentialScanProperties { + #[serde(flatten)] + pub azure_my_sql_scan_properties: AzureMySqlScanProperties, +} +impl AzureMySqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl AzureMySqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureMySqlScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureMySqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureMySqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(rename = "sslMode", default, skip_serializing_if = "Option::is_none")] + pub ssl_mode: Option, +} +impl AzurePostgreSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, +} +impl AzurePostgreSqlProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzurePostgreSqlScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzurePostgreSqlSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureResourceGroupCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureResourceGroupMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[serde(rename = "resourceGroup", default, skip_serializing_if = "Option::is_none")] + pub resource_group: Option, +} +impl AzureResourceGroupProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureResourceGroupScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureResourceGroupScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureResourceGroupSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureResourceGroupSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureSqlCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDataWarehouseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDataWarehouseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDataWarehouseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDataWarehouseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDataWarehouseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDataWarehouseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDataWarehouseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDatabaseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl AzureSqlDatabaseManagedInstanceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDatabaseManagedInstanceMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDatabaseManagedInstanceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseManagedInstanceScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDatabaseManagedInstanceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseManagedInstanceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseManagedInstanceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseMsiScanProperties { + #[serde(flatten)] + pub azure_sql_scan_properties: AzureSqlScanProperties, +} +impl AzureSqlDatabaseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl AzureSqlDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDatabaseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSqlDatabaseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSqlDatabaseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, +} +impl AzureSqlScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageCredentialScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl AzureStorageCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, +} +impl AzureStorageMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, +} +impl AzureStorageProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageScanRulesetProperties { + #[serde(flatten)] + pub scanning_rule_scan_ruleset_properties: ScanningRuleScanRulesetProperties, +} +impl AzureStorageScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureStorageSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSubscriptionCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSubscriptionMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, +} +impl AzureSubscriptionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSubscriptionScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSubscriptionScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSubscriptionSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSubscriptionSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "sqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_endpoint: Option, + #[serde(rename = "sqlOnDemandEndpoint", default, skip_serializing_if = "Option::is_none")] + pub sql_on_demand_endpoint: Option, +} +impl AzureSynapseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSynapseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceCredentialScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseWorkspaceCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceMsiScanProperties { + #[serde(flatten)] + pub expanding_resource_scan_properties: ExpandingResourceScanProperties, +} +impl AzureSynapseWorkspaceMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "dedicatedSqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub dedicated_sql_endpoint: Option, + #[serde(rename = "serverlessSqlEndpoint", default, skip_serializing_if = "Option::is_none")] + pub serverless_sql_endpoint: Option, +} +impl AzureSynapseWorkspaceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSynapseWorkspaceScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl AzureSynapseWorkspaceScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSynapseWorkspaceSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl AzureSynapseWorkspaceSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[doc = "Credential type that uses Basic authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BasicAuthAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BasicAuthAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClassificationRule { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: classification_rule::Kind, +} +impl ClassificationRule { + pub fn new(kind: classification_rule::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + } + } +} +pub mod classification_rule { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + System, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClassificationRuleList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ClassificationRuleList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClassificationRulePattern { + pub kind: classification_rule_pattern::Kind, +} +impl ClassificationRulePattern { + pub fn new(kind: classification_rule_pattern::Kind) -> Self { + Self { kind } + } +} +pub mod classification_rule_pattern { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Regex, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CollectionReference { + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl CollectionReference { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConnectedVia { + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "integrationRuntimeType", default, skip_serializing_if = "Option::is_none")] + pub integration_runtime_type: Option, +} +impl ConnectedVia { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential type that uses consumer provided key and secret for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConsumerKeyAuthAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ConsumerKeyAuthAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ConsumerKeyCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ConsumerKeyCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Credential { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: credential::Kind, +} +impl Credential { + pub fn new(kind: credential::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + } + } +} +pub mod credential { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + AccountKey, + ServicePrincipal, + BasicAuth, + SqlAuth, + #[serde(rename = "AmazonARN")] + AmazonArn, + ConsumerKeyAuth, + DelegatedAuth, + ManagedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl CredentialList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CredentialReference { + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "credentialType", default, skip_serializing_if = "Option::is_none")] + pub credential_type: Option, +} +impl CredentialReference { + pub fn new() -> Self { + Self::default() + } +} +pub mod credential_reference { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CredentialType { + AccountKey, + ServicePrincipal, + BasicAuth, + SqlAuth, + #[serde(rename = "AmazonARN")] + AmazonArn, + ConsumerKeyAuth, + DelegatedAuth, + ManagedIdentity, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomClassificationRule { + #[serde(flatten)] + pub classification_rule: ClassificationRule, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl CustomClassificationRule { + pub fn new(classification_rule: ClassificationRule) -> Self { + Self { + classification_rule, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomClassificationRuleProperties { + #[serde(rename = "minimumPercentageMatch", default, skip_serializing_if = "Option::is_none")] + pub minimum_percentage_match: Option, + #[serde(rename = "classificationAction", default, skip_serializing_if = "Option::is_none")] + pub classification_action: Option, + #[serde(rename = "dataPatterns", default, skip_serializing_if = "Vec::is_empty")] + pub data_patterns: Vec, + #[serde(rename = "columnPatterns", default, skip_serializing_if = "Vec::is_empty")] + pub column_patterns: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "classificationName", default, skip_serializing_if = "Option::is_none")] + pub classification_name: Option, + #[serde(rename = "ruleStatus", default, skip_serializing_if = "Option::is_none")] + pub rule_status: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl CustomClassificationRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod custom_classification_rule_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ClassificationAction { + Keep, + Delete, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleStatus { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomFileExtension { + #[serde(rename = "customFileType", default, skip_serializing_if = "Option::is_none")] + pub custom_file_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "fileExtension", default, skip_serializing_if = "Option::is_none")] + pub file_extension: Option, +} +impl CustomFileExtension { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomFileType { + #[serde(rename = "builtInType", default, skip_serializing_if = "Option::is_none")] + pub built_in_type: Option, + #[serde(rename = "customDelimiter", default, skip_serializing_if = "Option::is_none")] + pub custom_delimiter: Option, +} +impl CustomFileType { + pub fn new() -> Self { + Self::default() + } +} +pub mod custom_file_type { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum BuiltInType { + #[serde(rename = "AVRO")] + Avro, + #[serde(rename = "ORC")] + Orc, + #[serde(rename = "PARQUET")] + Parquet, + #[serde(rename = "JSON")] + Json, + #[serde(rename = "TXT")] + Txt, + #[serde(rename = "XML")] + Xml, + Documents, + #[serde(rename = "CSV")] + Csv, + #[serde(rename = "PSV")] + Psv, + #[serde(rename = "SSV")] + Ssv, + #[serde(rename = "TSV")] + Tsv, + #[serde(rename = "GZ")] + Gz, + #[serde(rename = "DOC")] + Doc, + #[serde(rename = "DOCM")] + Docm, + #[serde(rename = "DOCX")] + Docx, + #[serde(rename = "DOT")] + Dot, + #[serde(rename = "ODP")] + Odp, + #[serde(rename = "ODS")] + Ods, + #[serde(rename = "ODT")] + Odt, + #[serde(rename = "PDF")] + Pdf, + #[serde(rename = "POT")] + Pot, + #[serde(rename = "PPS")] + Pps, + #[serde(rename = "PPSX")] + Ppsx, + #[serde(rename = "PPT")] + Ppt, + #[serde(rename = "PPTM")] + Pptm, + #[serde(rename = "PPTX")] + Pptx, + #[serde(rename = "XLC")] + Xlc, + #[serde(rename = "XLS")] + Xls, + #[serde(rename = "XLSB")] + Xlsb, + #[serde(rename = "XLSM")] + Xlsm, + #[serde(rename = "XLSX")] + Xlsx, + #[serde(rename = "XLT")] + Xlt, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataSource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: data_source::Kind, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub scans: Vec, +} +impl DataSource { + pub fn new(kind: data_source::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + scans: Vec::new(), + } + } +} +pub mod data_source { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataSourceList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl DataSourceList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataSourceProperties { + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collection: Option, +} +impl DataSourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential type that uses Client ID for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelegatedAuthAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl DelegatedAuthAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DelegatedAuthCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl DelegatedAuthCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorInfo { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorInfo { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorModel { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl ErrorModel { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponseModel { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorResponseModel { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExpandingResourceScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "resourceTypes", default, skip_serializing_if = "Option::is_none")] + pub resource_types: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl ExpandingResourceScanProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod expanding_resource_scan_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct ResourceTypes { + #[serde(rename = "None", default, skip_serializing_if = "Option::is_none")] + pub none: Option, + #[serde(rename = "AzureSubscription", default, skip_serializing_if = "Option::is_none")] + pub azure_subscription: Option, + #[serde(rename = "AzureResourceGroup", default, skip_serializing_if = "Option::is_none")] + pub azure_resource_group: Option, + #[serde(rename = "AzureSynapseWorkspace", default, skip_serializing_if = "Option::is_none")] + pub azure_synapse_workspace: Option, + #[serde(rename = "AzureSynapse", default, skip_serializing_if = "Option::is_none")] + pub azure_synapse: Option, + #[serde(rename = "AdlsGen1", default, skip_serializing_if = "Option::is_none")] + pub adls_gen1: Option, + #[serde(rename = "AdlsGen2", default, skip_serializing_if = "Option::is_none")] + pub adls_gen2: Option, + #[serde(rename = "AmazonAccount", default, skip_serializing_if = "Option::is_none")] + pub amazon_account: Option, + #[serde(rename = "AmazonS3", default, skip_serializing_if = "Option::is_none")] + pub amazon_s3: Option, + #[serde(rename = "AmazonSql", default, skip_serializing_if = "Option::is_none")] + pub amazon_sql: Option, + #[serde(rename = "AzureCosmosDb", default, skip_serializing_if = "Option::is_none")] + pub azure_cosmos_db: Option, + #[serde(rename = "AzureDataExplorer", default, skip_serializing_if = "Option::is_none")] + pub azure_data_explorer: Option, + #[serde(rename = "AzureFileService", default, skip_serializing_if = "Option::is_none")] + pub azure_file_service: Option, + #[serde(rename = "AzureSqlDatabase", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_database: Option, + #[serde(rename = "AmazonPostgreSql", default, skip_serializing_if = "Option::is_none")] + pub amazon_postgre_sql: Option, + #[serde(rename = "AzurePostgreSql", default, skip_serializing_if = "Option::is_none")] + pub azure_postgre_sql: Option, + #[serde(rename = "SqlServerDatabase", default, skip_serializing_if = "Option::is_none")] + pub sql_server_database: Option, + #[serde(rename = "AzureSqlDatabaseManagedInstance", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_database_managed_instance: Option, + #[serde(rename = "AzureSqlDataWarehouse", default, skip_serializing_if = "Option::is_none")] + pub azure_sql_data_warehouse: Option, + #[serde(rename = "AzureMySql", default, skip_serializing_if = "Option::is_none")] + pub azure_my_sql: Option, + #[serde(rename = "AzureStorage", default, skip_serializing_if = "Option::is_none")] + pub azure_storage: Option, + #[serde(rename = "Teradata", default, skip_serializing_if = "Option::is_none")] + pub teradata: Option, + #[serde(rename = "Oracle", default, skip_serializing_if = "Option::is_none")] + pub oracle: Option, + #[serde(rename = "SapS4Hana", default, skip_serializing_if = "Option::is_none")] + pub sap_s4_hana: Option, + #[serde(rename = "SapEcc", default, skip_serializing_if = "Option::is_none")] + pub sap_ecc: Option, + #[serde(rename = "PowerBI", default, skip_serializing_if = "Option::is_none")] + pub power_bi: Option, + } + impl ResourceTypes { + pub fn new() -> Self { + Self::default() + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Filter { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Filter { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FilterProperties { + #[serde(rename = "excludeUriPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub exclude_uri_prefixes: Vec, + #[serde(rename = "includeUriPrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub include_uri_prefixes: Vec, +} +impl FilterProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecret { + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "secretName", default, skip_serializing_if = "Option::is_none")] + pub secret_name: Option, + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub store: Option, +} +impl KeyVaultSecret { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretAccountKeyCredentialTypeProperties { + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, +} +impl KeyVaultSecretAccountKeyCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretConsumerKeyCredentialTypeProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub user: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "consumerKey", default, skip_serializing_if = "Option::is_none")] + pub consumer_key: Option, + #[serde(rename = "consumerSecret", default, skip_serializing_if = "Option::is_none")] + pub consumer_secret: Option, +} +impl KeyVaultSecretConsumerKeyCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretDelegatedAuthCredentialTypeProperties { + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub user: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl KeyVaultSecretDelegatedAuthCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretManagedIdentityAzureKeyVaultCredentialTypeProperties { + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, +} +impl KeyVaultSecretManagedIdentityAzureKeyVaultCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretServicePrinipalCredentialTypeProperties { + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, +} +impl KeyVaultSecretServicePrinipalCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KeyVaultSecretUserPassCredentialTypeProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub user: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl KeyVaultSecretUserPassCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential type that uses User assigned managed identities for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedIdentityAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ManagedIdentityAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedIdentityAzureKeyVaultCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ManagedIdentityAzureKeyVaultCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MitiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "maximumMemoryAllowedInGb", default, skip_serializing_if = "Option::is_none")] + pub maximum_memory_allowed_in_gb: Option, + #[serde(rename = "mitiCache", default, skip_serializing_if = "Option::is_none")] + pub miti_cache: Option, +} +impl MitiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Notification { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} +impl Notification { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResponse { + #[serde(rename = "scanResultId", default, skip_serializing_if = "Option::is_none")] + pub scan_result_id: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl OperationResponse { + pub fn new() -> Self { + Self::default() + } +} +pub mod operation_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Accepted, + InProgress, + TransientFailure, + Succeeded, + Failed, + Canceled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleOracleCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleOracleCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleOracleCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl OracleOracleCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleOracleUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleOracleUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleOracleUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl OracleOracleUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub service: Option, +} +impl OracleProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl OracleScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl OracleSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiDelegatedScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiDelegatedScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiDelegatedScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "includePersonalWorkspaces", default, skip_serializing_if = "Option::is_none")] + pub include_personal_workspaces: Option, +} +impl PowerBiDelegatedScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiMsiScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiMsiScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiMsiScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(rename = "includePersonalWorkspaces", default, skip_serializing_if = "Option::is_none")] + pub include_personal_workspaces: Option, +} +impl PowerBiMsiScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, +} +impl PowerBiProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PowerBiScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl PowerBiScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PowerBiSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PowerBiSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceSchedule { + #[serde(rename = "additionalProperties", default, skip_serializing_if = "Option::is_none")] + pub additional_properties: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub minutes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hours: Vec, + #[serde(rename = "weekDays", default, skip_serializing_if = "Vec::is_empty")] + pub week_days: Vec, + #[serde(rename = "monthDays", default, skip_serializing_if = "Vec::is_empty")] + pub month_days: Vec, + #[serde(rename = "monthlyOccurrences", default, skip_serializing_if = "Vec::is_empty")] + pub monthly_occurrences: Vec, +} +impl RecurrenceSchedule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceScheduleOccurrence { + #[serde(rename = "additionalProperties", default, skip_serializing_if = "Option::is_none")] + pub additional_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub occurrence: Option, +} +impl RecurrenceScheduleOccurrence { + pub fn new() -> Self { + Self::default() + } +} +pub mod recurrence_schedule_occurrence { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Day { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegexClassificationRulePattern { + #[serde(flatten)] + pub classification_rule_pattern: ClassificationRulePattern, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pattern: Option, +} +impl RegexClassificationRulePattern { + pub fn new(classification_rule_pattern: ClassificationRulePattern) -> Self { + Self { + classification_rule_pattern, + pattern: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceNameFilter { + #[serde(rename = "excludePrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub exclude_prefixes: Vec, + #[serde(rename = "includePrefixes", default, skip_serializing_if = "Vec::is_empty")] + pub include_prefixes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, +} +impl ResourceNameFilter { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceTypeFilter { + #[serde(rename = "scanRulesetName", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_name: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(rename = "resourceNameFilter", default, skip_serializing_if = "Option::is_none")] + pub resource_name_filter: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, +} +impl ResourceTypeFilter { + pub fn new() -> Self { + Self::default() + } +} +pub mod resource_type_filter { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } +} +#[doc = "Credential type that uses Account ID, External ID and Role ARN for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RoleArnCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl RoleArnCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoleArnCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl RoleArnCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RoleArnCredentialTypeProperties { + #[serde(rename = "roleARN", default, skip_serializing_if = "Option::is_none")] + pub role_arn: Option, +} +impl RoleArnCredentialTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "applicationServer", default, skip_serializing_if = "Option::is_none")] + pub application_server: Option, + #[serde(rename = "systemNumber", default, skip_serializing_if = "Option::is_none")] + pub system_number: Option, +} +impl SapEccProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSapEccCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSapEccCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccSapEccCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapEccSapEccCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSapEccUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSapEccUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccSapEccUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapEccSapEccUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapEccScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SapEccScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapEccSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(rename = "applicationServer", default, skip_serializing_if = "Option::is_none")] + pub application_server: Option, + #[serde(rename = "systemNumber", default, skip_serializing_if = "Option::is_none")] + pub system_number: Option, +} +impl SapS4HanaProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSapS4HanaCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSapS4HanaCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaSapS4HanaCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapS4HanaSapS4HanaCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSapS4HanaUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSapS4HanaUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaSapS4HanaUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(rename = "jCoLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub j_co_library_path: Option, +} +impl SapS4HanaSapS4HanaUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapS4HanaScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SapS4HanaScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapS4HanaSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SapS4HanaSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Scan { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + pub kind: scan::Kind, + #[serde(rename = "scanResults", default, skip_serializing_if = "Vec::is_empty")] + pub scan_results: Vec, +} +impl Scan { + pub fn new(kind: scan::Kind) -> Self { + Self { + proxy_resource: ProxyResource::default(), + kind, + scan_results: Vec::new(), + } + } +} +pub mod scan { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + AzureSubscriptionCredential, + AzureSubscriptionMsi, + AzureResourceGroupCredential, + AzureResourceGroupMsi, + AzureSynapseWorkspaceCredential, + AzureSynapseWorkspaceMsi, + AzureSynapseCredential, + AzureSynapseMsi, + AdlsGen1Credential, + AdlsGen1Msi, + AdlsGen2Credential, + AdlsGen2Msi, + AmazonAccountCredential, + AmazonS3Credential, + #[serde(rename = "AmazonS3RoleARN")] + AmazonS3RoleArn, + AmazonSqlCredential, + AzureCosmosDbCredential, + AzureDataExplorerCredential, + AzureDataExplorerMsi, + AzureFileServiceCredential, + AzureSqlDatabaseCredential, + AzureSqlDatabaseMsi, + AmazonPostgreSqlCredential, + #[serde(rename = "AmazonPostgreSqlRoleARN")] + AmazonPostgreSqlRoleArn, + AzurePostgreSqlCredential, + SqlServerDatabaseCredential, + AzureSqlDatabaseManagedInstanceCredential, + AzureSqlDatabaseManagedInstanceMsi, + AzureSqlDataWarehouseCredential, + AzureSqlDataWarehouseMsi, + AzureMySqlCredential, + AzureStorageCredential, + AzureStorageMsi, + TeradataTeradataCredential, + TeradataTeradataUserPass, + TeradataUserPass, + OracleOracleCredential, + OracleOracleUserPass, + SapS4HanaSapS4HanaCredential, + SapS4HanaSapS4HanaUserPass, + SapEccSapEccCredential, + SapEccSapEccUserPass, + #[serde(rename = "PowerBIDelegated")] + PowerBiDelegated, + #[serde(rename = "PowerBIMsi")] + PowerBiMsi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanDiagnostics { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub notifications: Vec, + #[serde(rename = "exceptionCountMap", default, skip_serializing_if = "Option::is_none")] + pub exception_count_map: Option, +} +impl ScanDiagnostics { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanHistoryList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanHistoryList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanProperties { + #[serde(rename = "scanRulesetName", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_name: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collection: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub workers: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "connectedVia", default, skip_serializing_if = "Option::is_none")] + pub connected_via: Option, +} +impl ScanProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod scan_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanResult { + #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")] + pub parent_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "assetsDiscovered", default, skip_serializing_if = "Option::is_none")] + pub assets_discovered: Option, + #[serde(rename = "assetsClassified", default, skip_serializing_if = "Option::is_none")] + pub assets_classified: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub diagnostics: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "queuedTime", default, skip_serializing_if = "Option::is_none")] + pub queued_time: Option, + #[serde(rename = "pipelineStartTime", default, skip_serializing_if = "Option::is_none")] + pub pipeline_start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(rename = "scanRulesetVersion", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_version: Option, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(rename = "scanLevelType", default, skip_serializing_if = "Option::is_none")] + pub scan_level_type: Option, + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(rename = "runType", default, skip_serializing_if = "Option::is_none")] + pub run_type: Option, + #[serde(rename = "dataSourceType", default, skip_serializing_if = "Option::is_none")] + pub data_source_type: Option, +} +impl ScanResult { + pub fn new() -> Self { + Self::default() + } +} +pub mod scan_result { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanLevelType { + Full, + Incremental, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataSourceType { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScanRuleset { + #[serde(flatten)] + pub versioned_scan_ruleset: VersionedScanRuleset, + pub kind: scan_ruleset::Kind, +} +impl ScanRuleset { + pub fn new(kind: scan_ruleset::Kind) -> Self { + Self { + versioned_scan_ruleset: VersionedScanRuleset::default(), + kind, + } + } +} +pub mod scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanRulesetList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl ScanRulesetList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanRulesetProperties { + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "excludedSystemClassifications", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_system_classifications: Vec, + #[serde(rename = "includedCustomClassificationRuleNames", default, skip_serializing_if = "Vec::is_empty")] + pub included_custom_classification_rule_names: Vec, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl ScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanningRule { + #[serde(rename = "fileExtensions", default, skip_serializing_if = "Vec::is_empty")] + pub file_extensions: Vec, + #[serde(rename = "customFileExtensions", default, skip_serializing_if = "Vec::is_empty")] + pub custom_file_extensions: Vec, +} +impl ScanningRule { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScanningRuleScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, + #[serde(rename = "scanningRule", default, skip_serializing_if = "Option::is_none")] + pub scanning_rule: Option, +} +impl ScanningRuleScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential type that uses Tenant ID and Service principal ID for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServicePrincipalAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl ServicePrincipalAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ServicePrincipalAzureKeyVaultCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl ServicePrincipalAzureKeyVaultCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Credential type that uses Sql for authentication."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlAuthAzureKeyVaultCredential { + #[serde(flatten)] + pub credential: Credential, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlAuthAzureKeyVaultCredential { + pub fn new(credential: Credential) -> Self { + Self { + credential, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseCredentialScanProperties { + #[serde(flatten)] + pub azure_sql_credential_scan_properties: AzureSqlCredentialScanProperties, +} +impl SqlServerDatabaseCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseProperties { + #[serde(flatten)] + pub azure_data_source_properties: AzureDataSourceProperties, + #[serde(rename = "serverEndpoint", default, skip_serializing_if = "Option::is_none")] + pub server_endpoint: Option, +} +impl SqlServerDatabaseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerDatabaseScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl SqlServerDatabaseScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerDatabaseSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlServerDatabaseSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Store { + #[serde(rename = "referenceName", default, skip_serializing_if = "Option::is_none")] + pub reference_name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Store { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemClassificationRule { + #[serde(flatten)] + pub classification_rule: ClassificationRule, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SystemClassificationRule { + pub fn new(classification_rule: ClassificationRule) -> Self { + Self { + classification_rule, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemClassificationRuleProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "classificationName", default, skip_serializing_if = "Option::is_none")] + pub classification_name: Option, + #[serde(rename = "ruleStatus", default, skip_serializing_if = "Option::is_none")] + pub rule_status: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +impl SystemClassificationRuleProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod system_classification_rule_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum RuleStatus { + Enabled, + Disabled, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemScanRuleset { + #[serde(flatten)] + pub versioned_scan_ruleset: VersionedScanRuleset, + pub kind: system_scan_ruleset::Kind, +} +impl SystemScanRuleset { + pub fn new(kind: system_scan_ruleset::Kind) -> Self { + Self { + versioned_scan_ruleset: VersionedScanRuleset::default(), + kind, + } + } +} +pub mod system_scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + None, + AzureSubscription, + AzureResourceGroup, + AzureSynapseWorkspace, + AzureSynapse, + AdlsGen1, + AdlsGen2, + AmazonAccount, + AmazonS3, + AmazonSql, + AzureCosmosDb, + AzureDataExplorer, + AzureFileService, + AzureSqlDatabase, + AmazonPostgreSql, + AzurePostgreSql, + SqlServerDatabase, + AzureSqlDatabaseManagedInstance, + AzureSqlDataWarehouse, + AzureMySql, + AzureStorage, + Teradata, + Oracle, + SapS4Hana, + SapEcc, + #[serde(rename = "PowerBI")] + PowerBi, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SystemScanRulesetList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, +} +impl SystemScanRulesetList { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataDataSource { + #[serde(flatten)] + pub data_source: DataSource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataDataSource { + pub fn new(data_source: DataSource) -> Self { + Self { + data_source, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataProperties { + #[serde(flatten)] + pub data_source_properties: DataSourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub host: Option, +} +impl TeradataProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataScanRuleset { + #[serde(flatten)] + pub scan_ruleset: ScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataScanRuleset { + pub fn new(scan_ruleset: ScanRuleset) -> Self { + Self { + scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataScanRulesetProperties { + #[serde(flatten)] + pub scan_ruleset_properties: ScanRulesetProperties, +} +impl TeradataScanRulesetProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataSystemScanRuleset { + #[serde(flatten)] + pub system_scan_ruleset: SystemScanRuleset, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataSystemScanRuleset { + pub fn new(system_scan_ruleset: SystemScanRuleset) -> Self { + Self { + system_scan_ruleset, + properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataTeradataCredentialScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataTeradataCredentialScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataTeradataCredentialScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl TeradataTeradataCredentialScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataTeradataUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataTeradataUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataTeradataUserPassScanProperties { + #[serde(flatten)] + pub miti_scan_properties: MitiScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "driverLocation", default, skip_serializing_if = "Option::is_none")] + pub driver_location: Option, +} +impl TeradataTeradataUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataUserPassScan { + #[serde(flatten)] + pub scan: Scan, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl TeradataUserPassScan { + pub fn new(scan: Scan) -> Self { + Self { scan, properties: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataUserPassScanProperties { + #[serde(flatten)] + pub scan_properties: ScanProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl TeradataUserPassScanProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Trigger { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl Trigger { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recurrence: Option, + #[serde(rename = "recurrenceInterval", default, skip_serializing_if = "Option::is_none")] + pub recurrence_interval: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, + #[serde(rename = "lastScheduled", default, skip_serializing_if = "Option::is_none")] + pub last_scheduled: Option, + #[serde(rename = "scanLevel", default, skip_serializing_if = "Option::is_none")] + pub scan_level: Option, + #[serde(rename = "incrementalScanStartTime", default, skip_serializing_if = "Option::is_none")] + pub incremental_scan_start_time: Option, +} +impl TriggerProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanLevel { + Full, + Incremental, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerRecurrence { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub frequency: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl TriggerRecurrence { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_recurrence { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Frequency { + Week, + Month, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UserPassCredentialProperties { + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl UserPassCredentialProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VersionedScanRuleset { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(rename = "scanRulesetType", default, skip_serializing_if = "Option::is_none")] + pub scan_ruleset_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl VersionedScanRuleset { + pub fn new() -> Self { + Self::default() + } +} +pub mod versioned_scan_ruleset { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ScanRulesetType { + Custom, + System, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Enabled, + Disabled, + } +} diff --git a/services/svc/purview/src/package_2022_02_01_preview/operations.rs b/services/svc/purview/src/package_2022_02_01_preview/operations.rs new file mode 100644 index 0000000000..5d1ca7a86f --- /dev/null +++ b/services/svc/purview/src/package_2022_02_01_preview/operations.rs @@ -0,0 +1,3496 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = "https://purview.azure.com/scan"; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn classification_rules(&self) -> classification_rules::Client { + classification_rules::Client(self.clone()) + } + pub fn credential(&self) -> credential::Client { + credential::Client(self.clone()) + } + pub fn data_sources(&self) -> data_sources::Client { + data_sources::Client(self.clone()) + } + pub fn filters(&self) -> filters::Client { + filters::Client(self.clone()) + } + pub fn key_vault_connections(&self) -> key_vault_connections::Client { + key_vault_connections::Client(self.clone()) + } + pub fn scan_result(&self) -> scan_result::Client { + scan_result::Client(self.clone()) + } + pub fn scan_rulesets(&self) -> scan_rulesets::Client { + scan_rulesets::Client(self.clone()) + } + pub fn scans(&self) -> scans::Client { + scans::Client(self.clone()) + } + pub fn system_scan_rulesets(&self) -> system_scan_rulesets::Client { + system_scan_rulesets::Client(self.clone()) + } + pub fn triggers(&self) -> triggers::Client { + triggers::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + KeyVaultConnections_Get(#[from] key_vault_connections::get::Error), + #[error(transparent)] + KeyVaultConnections_Create(#[from] key_vault_connections::create::Error), + #[error(transparent)] + KeyVaultConnections_Delete(#[from] key_vault_connections::delete::Error), + #[error(transparent)] + KeyVaultConnections_ListAll(#[from] key_vault_connections::list_all::Error), + #[error(transparent)] + ClassificationRules_Get(#[from] classification_rules::get::Error), + #[error(transparent)] + ClassificationRules_CreateOrUpdate(#[from] classification_rules::create_or_update::Error), + #[error(transparent)] + ClassificationRules_Delete(#[from] classification_rules::delete::Error), + #[error(transparent)] + ClassificationRules_ListAll(#[from] classification_rules::list_all::Error), + #[error(transparent)] + ClassificationRules_ListVersionsByClassificationRuleName( + #[from] classification_rules::list_versions_by_classification_rule_name::Error, + ), + #[error(transparent)] + ClassificationRules_TagClassificationVersion(#[from] classification_rules::tag_classification_version::Error), + #[error(transparent)] + Credential_Get(#[from] credential::get::Error), + #[error(transparent)] + Credential_CreateOrUpdate(#[from] credential::create_or_update::Error), + #[error(transparent)] + Credential_Delete(#[from] credential::delete::Error), + #[error(transparent)] + Credential_ListAll(#[from] credential::list_all::Error), + #[error(transparent)] + DataSources_Get(#[from] data_sources::get::Error), + #[error(transparent)] + DataSources_CreateOrUpdate(#[from] data_sources::create_or_update::Error), + #[error(transparent)] + DataSources_Delete(#[from] data_sources::delete::Error), + #[error(transparent)] + DataSources_ListAll(#[from] data_sources::list_all::Error), + #[error(transparent)] + Filters_Get(#[from] filters::get::Error), + #[error(transparent)] + Filters_CreateOrUpdate(#[from] filters::create_or_update::Error), + #[error(transparent)] + Scans_Get(#[from] scans::get::Error), + #[error(transparent)] + Scans_CreateOrUpdate(#[from] scans::create_or_update::Error), + #[error(transparent)] + Scans_Delete(#[from] scans::delete::Error), + #[error(transparent)] + Scans_ListByDataSource(#[from] scans::list_by_data_source::Error), + #[error(transparent)] + ScanResult_RunScan(#[from] scan_result::run_scan::Error), + #[error(transparent)] + ScanResult_CancelScan(#[from] scan_result::cancel_scan::Error), + #[error(transparent)] + ScanResult_ListScanHistory(#[from] scan_result::list_scan_history::Error), + #[error(transparent)] + ScanRulesets_Get(#[from] scan_rulesets::get::Error), + #[error(transparent)] + ScanRulesets_CreateOrUpdate(#[from] scan_rulesets::create_or_update::Error), + #[error(transparent)] + ScanRulesets_Delete(#[from] scan_rulesets::delete::Error), + #[error(transparent)] + ScanRulesets_ListAll(#[from] scan_rulesets::list_all::Error), + #[error(transparent)] + SystemScanRulesets_ListAll(#[from] system_scan_rulesets::list_all::Error), + #[error(transparent)] + SystemScanRulesets_Get(#[from] system_scan_rulesets::get::Error), + #[error(transparent)] + SystemScanRulesets_GetByVersion(#[from] system_scan_rulesets::get_by_version::Error), + #[error(transparent)] + SystemScanRulesets_GetLatest(#[from] system_scan_rulesets::get_latest::Error), + #[error(transparent)] + SystemScanRulesets_ListVersionsByDataSource(#[from] system_scan_rulesets::list_versions_by_data_source::Error), + #[error(transparent)] + Triggers_GetTrigger(#[from] triggers::get_trigger::Error), + #[error(transparent)] + Triggers_CreateTrigger(#[from] triggers::create_trigger::Error), + #[error(transparent)] + Triggers_DeleteTrigger(#[from] triggers::delete_trigger::Error), +} +pub mod key_vault_connections { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, key_vault_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + } + } + pub fn create(&self, key_vault_name: impl Into, body: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + body: body.into(), + } + } + pub fn delete(&self, key_vault_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + key_vault_name: key_vault_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + pub(crate) body: models::AzureKeyVault, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::AzureKeyVault), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) key_vault_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults/{}", self.client.endpoint(), &self.key_vault_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVault = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/azureKeyVaults", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AzureKeyVaultList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod classification_rules { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, classification_rule_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn create_or_update(&self, classification_rule_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + body: None, + } + } + pub fn delete(&self, classification_rule_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + pub fn list_versions_by_classification_rule_name( + &self, + classification_rule_name: impl Into, + ) -> list_versions_by_classification_rule_name::Builder { + list_versions_by_classification_rule_name::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + } + } + pub fn tag_classification_version( + &self, + classification_rule_name: impl Into, + classification_rule_version: i32, + action: impl Into, + ) -> tag_classification_version::Builder { + tag_classification_version::Builder { + client: self.0.clone(), + classification_rule_name: classification_rule_name.into(), + classification_rule_version, + action: action.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClassificationRule), + Created201(models::ClassificationRule), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ClassificationRule), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules/{}", self.client.endpoint(), &self.classification_rule_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRule = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/classificationrules", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRuleList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_versions_by_classification_rule_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/classificationrules/{}/versions", + self.client.endpoint(), + &self.classification_rule_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ClassificationRuleList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod tag_classification_version { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) classification_rule_name: String, + pub(crate) classification_rule_version: i32, + pub(crate) action: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/classificationrules/{}/versions/{}/:tag", + self.client.endpoint(), + &self.classification_rule_name, + &self.classification_rule_version + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let action = &self.action; + url.query_pairs_mut().append_pair("action", action); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod credential { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, credential_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + credential_name: credential_name.into(), + } + } + pub fn create_or_update( + &self, + credential_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + credential_name: credential_name.into(), + body: body.into(), + } + } + pub fn delete(&self, credential_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + credential_name: credential_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) credential_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/credentials/{}", self.client.endpoint(), &self.credential_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Credential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Credential), + Created201(models::Credential), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) credential_name: String, + pub(crate) body: models::Credential, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/credentials/{}", self.client.endpoint(), &self.credential_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Credential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Credential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Credential), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) credential_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/credentials/{}", self.client.endpoint(), &self.credential_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Credential = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/credentials", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CredentialList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_sources { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + pub fn create_or_update(&self, data_source_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + body: None, + } + } + pub fn delete(&self, data_source_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataSource), + Created201(models::DataSource), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataSource), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataSourceList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod filters { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into, scan_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_or_update(&self, data_source_name: impl Into, scan_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: None, + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/filters/custom", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Filter), + Created201(models::Filter), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/filters/custom", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Filter = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scans { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, data_source_name: impl Into, scan_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_or_update( + &self, + data_source_name: impl Into, + scan_name: impl Into, + body: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: body.into(), + } + } + pub fn delete(&self, data_source_name: impl Into, scan_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn list_by_data_source(&self, data_source_name: impl Into) -> list_by_data_source::Builder { + list_by_data_source::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Scan), + Created201(models::Scan), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: models::Scan, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Scan), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Scan = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_data_source { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasources/{}/scans", self.client.endpoint(), &self.data_source_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scan_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn run_scan( + &self, + data_source_name: impl Into, + scan_name: impl Into, + run_id: impl Into, + ) -> run_scan::Builder { + run_scan::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + run_id: run_id.into(), + scan_level: None, + } + } + pub fn cancel_scan( + &self, + data_source_name: impl Into, + scan_name: impl Into, + run_id: impl Into, + ) -> cancel_scan::Builder { + cancel_scan::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + run_id: run_id.into(), + } + } + pub fn list_scan_history(&self, data_source_name: impl Into, scan_name: impl Into) -> list_scan_history::Builder { + list_scan_history::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + } + pub mod run_scan { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) run_id: String, + pub(crate) scan_level: Option, + } + impl Builder { + pub fn scan_level(mut self, scan_level: impl Into) -> Self { + self.scan_level = Some(scan_level.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs/{}", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + if let Some(scan_level) = &self.scan_level { + url.query_pairs_mut().append_pair("scanLevel", scan_level); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel_scan { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs/{}/:cancel", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_scan_history { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/runs", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanHistoryList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod scan_rulesets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, scan_ruleset_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + } + } + pub fn create_or_update(&self, scan_ruleset_name: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + body: None, + } + } + pub fn delete(&self, scan_ruleset_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + scan_ruleset_name: scan_ruleset_name.into(), + } + } + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScanRuleset), + Created201(models::ScanRuleset), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::ScanRuleset), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) scan_ruleset_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets/{}", self.client.endpoint(), &self.scan_ruleset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/scanrulesets", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod system_scan_rulesets { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_all(&self) -> list_all::Builder { + list_all::Builder { client: self.0.clone() } + } + pub fn get(&self, data_source_type: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + data_source_type: data_source_type.into(), + } + } + pub fn get_by_version(&self, version: i32) -> get_by_version::Builder { + get_by_version::Builder { + client: self.0.clone(), + version, + data_source_type: None, + } + } + pub fn get_latest(&self) -> get_latest::Builder { + get_latest::Builder { + client: self.0.clone(), + data_source_type: None, + } + } + pub fn list_versions_by_data_source(&self) -> list_versions_by_data_source::Builder { + list_versions_by_data_source::Builder { + client: self.0.clone(), + data_source_type: None, + } + } + } + pub mod list_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/systemScanRulesets/datasources/{}", + self.client.endpoint(), + &self.data_source_type + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_version { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) version: i32, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions/{}", self.client.endpoint(), &self.version); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_latest { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions/latest", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRuleset = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_versions_by_data_source { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_type: Option, + } + impl Builder { + pub fn data_source_type(mut self, data_source_type: impl Into) -> Self { + self.data_source_type = Some(data_source_type.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/systemScanRulesets/versions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + if let Some(data_source_type) = &self.data_source_type { + url.query_pairs_mut().append_pair("dataSourceType", data_source_type); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SystemScanRulesetList = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod triggers { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_trigger(&self, data_source_name: impl Into, scan_name: impl Into) -> get_trigger::Builder { + get_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + pub fn create_trigger( + &self, + data_source_name: impl Into, + scan_name: impl Into, + body: impl Into, + ) -> create_trigger::Builder { + create_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + body: body.into(), + } + } + pub fn delete_trigger(&self, data_source_name: impl Into, scan_name: impl Into) -> delete_trigger::Builder { + delete_trigger::Builder { + client: self.0.clone(), + data_source_name: data_source_name.into(), + scan_name: scan_name.into(), + } + } + } + pub mod get_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Trigger), + Created201(models::Trigger), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + pub(crate) body: models::Trigger, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::Trigger), + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponseModel, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_source_name: String, + pub(crate) scan_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/datasources/{}/scans/{}/triggers/default", + self.client.endpoint(), + &self.data_source_name, + &self.scan_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-02-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Trigger = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponseModel = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/purview/src/package_preview_2022_03/mod.rs b/services/svc/purview/src/package_preview_2022_03/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/purview/src/package_preview_2022_03/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/purview/src/package_preview_2022_03/models.rs b/services/svc/purview/src/package_preview_2022_03/models.rs new file mode 100644 index 0000000000..6c5cb5dd8e --- /dev/null +++ b/services/svc/purview/src/package_preview_2022_03/models.rs @@ -0,0 +1,2082 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "class that captures details of a struct-attribute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasAttributeDef { + #[doc = "single-valued attribute or multi-valued attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cardinality: Option, + #[doc = "An array of constraints."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub constraints: Vec, + #[doc = "The default value of the attribute."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "The description of the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Determines if it is included in notification."] + #[serde(rename = "includeInNotification", default, skip_serializing_if = "Option::is_none")] + pub include_in_notification: Option, + #[doc = "Determines if it is indexable."] + #[serde(rename = "isIndexable", default, skip_serializing_if = "Option::is_none")] + pub is_indexable: Option, + #[doc = "Determines if it is optional."] + #[serde(rename = "isOptional", default, skip_serializing_if = "Option::is_none")] + pub is_optional: Option, + #[doc = "Determines if it unique."] + #[serde(rename = "isUnique", default, skip_serializing_if = "Option::is_none")] + pub is_unique: Option, + #[doc = "The name of the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The options for the attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "The maximum count of the values."] + #[serde(rename = "valuesMaxCount", default, skip_serializing_if = "Option::is_none")] + pub values_max_count: Option, + #[doc = "The minimum count of the values."] + #[serde(rename = "valuesMinCount", default, skip_serializing_if = "Option::is_none")] + pub values_min_count: Option, +} +impl AtlasAttributeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The base model object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasBaseModelObject { + #[doc = "The GUID of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, +} +impl AtlasBaseModelObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Base class that captures common-attributes for all Atlas types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasBaseTypeDef { + #[doc = "The enum of type category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The date format."] + #[serde(rename = "dateFormatter", default, skip_serializing_if = "Option::is_none")] + pub date_formatter: Option, + #[doc = "The description of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The options for the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, + #[doc = "The service type."] + #[serde(rename = "serviceType", default, skip_serializing_if = "Option::is_none")] + pub service_type: Option, + #[doc = "The version of the type."] + #[serde(rename = "typeVersion", default, skip_serializing_if = "Option::is_none")] + pub type_version: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasBaseTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a struct-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasBusinessMetadataDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, +} +impl AtlasBusinessMetadataDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of a classification; it doesn't have an identity, this object exists only when associated with an entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassification { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "The GUID of the entity."] + #[serde(rename = "entityGuid", default, skip_serializing_if = "Option::is_none")] + pub entity_guid: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(rename = "entityStatus", default, skip_serializing_if = "Option::is_none")] + pub entity_status: Option, + #[doc = "Determines if propagations will be removed on entity deletion."] + #[serde(rename = "removePropagationsOnEntityDelete", default, skip_serializing_if = "Option::is_none")] + pub remove_propagations_on_entity_delete: Option, + #[doc = "An array of time boundaries indicating validity periods."] + #[serde(rename = "validityPeriods", default, skip_serializing_if = "Vec::is_empty")] + pub validity_periods: Vec, + #[doc = "indicate the source who create the classification detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "more detail on source information"] + #[serde(rename = "sourceDetails", default, skip_serializing_if = "Option::is_none")] + pub source_details: Option, +} +impl AtlasClassification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a classification-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassificationDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "Specifying a list of entityType names in the classificationDef, ensures that classifications can\nonly be applied to those entityTypes.\n

    \n
  • Any subtypes of the entity types inherit the restriction
  • \n
  • Any classificationDef subtypes inherit the parents entityTypes restrictions
  • \n
  • Any classificationDef subtypes can further restrict the parents entityTypes restrictions by specifying a subset of the entityTypes
  • \n
  • An empty entityTypes list when there are no parent restrictions means there are no restrictions
  • \n
  • An empty entityTypes list when there are parent restrictions means that the subtype picks up the parents restrictions
  • \n
  • If a list of entityTypes are supplied, where one inherits from another, this will be rejected. This should encourage cleaner classificationsDefs
  • \n
"] + #[serde(rename = "entityTypes", default, skip_serializing_if = "Vec::is_empty")] + pub entity_types: Vec, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, +} +impl AtlasClassificationDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "REST serialization friendly list."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasClassifications { + #[serde(flatten)] + pub p_list: PList, +} +impl AtlasClassifications { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a constraint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasConstraintDef { + #[doc = "The parameters of the constraint definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub params: Option, + #[doc = "The type of the constraint."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AtlasConstraintDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntitiesWithExtInfo { + #[serde(flatten)] + pub atlas_entity_ext_info: AtlasEntityExtInfo, + #[doc = "An array of entities."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub entities: Vec, +} +impl AtlasEntitiesWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntity { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "Business Attributes"] + #[serde(rename = "businessAttributes", default, skip_serializing_if = "Option::is_none")] + pub business_attributes: Option, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "Custom Attribute"] + #[serde(rename = "customAttributes", default, skip_serializing_if = "Option::is_none")] + pub custom_attributes: Option, + #[doc = "The GUID of the entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The home ID of the entity."] + #[serde(rename = "homeId", default, skip_serializing_if = "Option::is_none")] + pub home_id: Option, + #[doc = "Whether it is a shell entity"] + #[serde(rename = "isIncomplete", default, skip_serializing_if = "Option::is_none")] + pub is_incomplete: Option, + #[doc = "labels"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec, + #[doc = "An array of term assignment headers indicating the meanings of the entity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub meanings: Vec, + #[doc = "Used to record the provenance of an instance of an entity or relationship."] + #[serde(rename = "provenanceType", default, skip_serializing_if = "Option::is_none")] + pub provenance_type: Option, + #[doc = "Determines if there's a proxy."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub proxy: Option, + #[doc = "The attributes of relationship."] + #[serde(rename = "relationshipAttributes", default, skip_serializing_if = "Option::is_none")] + pub relationship_attributes: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "indicate the source who create the classification detail"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "more detail on source information"] + #[serde(rename = "sourceDetails", default, skip_serializing_if = "Option::is_none")] + pub source_details: Option, + #[doc = "The dictionary of contacts for terms. Key could be Expert or Owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contacts: Option, +} +impl AtlasEntity { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a entity-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, + #[doc = "An array of relationship attributes."] + #[serde(rename = "relationshipAttributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_attribute_defs: Vec, +} +impl AtlasEntityDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityExtInfo { + #[doc = "The referred entities."] + #[serde(rename = "referredEntities", default, skip_serializing_if = "Option::is_none")] + pub referred_entities: Option, +} +impl AtlasEntityExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityHeader { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "An array of classification names."] + #[serde(rename = "classificationNames", default, skip_serializing_if = "Vec::is_empty")] + pub classification_names: Vec, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "Whether it is a shell entity"] + #[serde(rename = "isIncomplete", default, skip_serializing_if = "Option::is_none")] + pub is_incomplete: Option, + #[doc = "labels"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec, + #[doc = "An array of meanings."] + #[serde(rename = "meaningNames", default, skip_serializing_if = "Vec::is_empty")] + pub meaning_names: Vec, + #[doc = "An array of term assignment headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub meanings: Vec, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AtlasEntityHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity header map."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityHeaders { + #[doc = "The description of the guid header map,"] + #[serde(rename = "guidHeaderMap", default, skip_serializing_if = "Option::is_none")] + pub guid_header_map: Option, +} +impl AtlasEntityHeaders { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An instance of an entity along with extended info - like hive_table, hive_database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEntityWithExtInfo { + #[serde(flatten)] + pub atlas_entity_ext_info: AtlasEntityExtInfo, + #[doc = "An instance of an entity - like hive_table, hive_database."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub entity: Option, +} +impl AtlasEntityWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of an enum-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEnumDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[doc = "The default value."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "An array of enum element definitions."] + #[serde(rename = "elementDefs", default, skip_serializing_if = "Vec::is_empty")] + pub element_defs: Vec, +} +impl AtlasEnumDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of an enum-element."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasEnumElementDef { + #[doc = "The description of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The ordinal of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ordinal: Option, + #[doc = "The value of the enum element definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl AtlasEnumElementDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Extra properties for a type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasExtraTypeDef { + #[doc = "Specifying a list of entityType names in the classificationDef, ensures that classifications can\nonly be applied to those entityTypes.\n
    \n
  • Any subtypes of the entity types inherit the restriction
  • \n
  • Any classificationDef subtypes inherit the parents entityTypes restrictions
  • \n
  • Any classificationDef subtypes can further restrict the parents entityTypes restrictions by specifying a subset of the entityTypes
  • \n
  • An empty entityTypes list when there are no parent restrictions means there are no restrictions
  • \n
  • An empty entityTypes list when there are parent restrictions means that the subtype picks up the parents restrictions
  • \n
  • If a list of entityTypes are supplied, where one inherits from another, this will be rejected. This should encourage cleaner classificationsDefs
  • \n
"] + #[serde(rename = "entityTypes", default, skip_serializing_if = "Vec::is_empty")] + pub entity_types: Vec, + #[doc = "An array of sub types."] + #[serde(rename = "subTypes", default, skip_serializing_if = "Vec::is_empty")] + pub sub_types: Vec, + #[doc = "An array of super types."] + #[serde(rename = "superTypes", default, skip_serializing_if = "Vec::is_empty")] + pub super_types: Vec, + #[doc = "An array of relationship attributes."] + #[serde(rename = "relationshipAttributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_attribute_defs: Vec, + #[doc = "The default value."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, + #[doc = "An array of enum element definitions."] + #[serde(rename = "elementDefs", default, skip_serializing_if = "Vec::is_empty")] + pub element_defs: Vec, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef1", default, skip_serializing_if = "Option::is_none")] + pub end_def1: Option, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef2", default, skip_serializing_if = "Option::is_none")] + pub end_def2: Option, + #[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] + #[serde(rename = "relationshipCategory", default, skip_serializing_if = "Option::is_none")] + pub relationship_category: Option, + #[doc = "The label of the relationship."] + #[serde(rename = "relationshipLabel", default, skip_serializing_if = "Option::is_none")] + pub relationship_label: Option, + #[doc = "An array of attribute definitions."] + #[serde(rename = "attributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub attribute_defs: Vec, +} +impl AtlasExtraTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossary { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "An array of categories."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub categories: Vec, + #[doc = "The language of the glossary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub terms: Vec, + #[doc = "The usage of the glossary."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usage: Option, +} +impl AtlasGlossary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary base object."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryBaseObject { + #[serde(flatten)] + pub atlas_base_model_object: AtlasBaseModelObject, + #[doc = "An array of classifications."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[doc = "The long version description."] + #[serde(rename = "longDescription", default, skip_serializing_if = "Option::is_none")] + pub long_description: Option, + #[doc = "The name of the glossary object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The qualified name of the glossary object."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The short version of description."] + #[serde(rename = "shortDescription", default, skip_serializing_if = "Option::is_none")] + pub short_description: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasGlossaryBaseObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryCategory { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "The glossary header with basic information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub anchor: Option, + #[doc = "An array of children categories."] + #[serde(rename = "childrenCategories", default, skip_serializing_if = "Vec::is_empty")] + pub children_categories: Vec, + #[doc = "The header of the related category."] + #[serde(rename = "parentCategory", default, skip_serializing_if = "Option::is_none")] + pub parent_category: Option, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub terms: Vec, +} +impl AtlasGlossaryCategory { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The extended information of glossary."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryExtInfo { + #[serde(flatten)] + pub atlas_glossary: AtlasGlossary, + #[doc = "The glossary category information."] + #[serde(rename = "categoryInfo", default, skip_serializing_if = "Option::is_none")] + pub category_info: Option, + #[doc = "The glossary term information."] + #[serde(rename = "termInfo", default, skip_serializing_if = "Option::is_none")] + pub term_info: Option, +} +impl AtlasGlossaryExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary header with basic information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryHeader { + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the glossary."] + #[serde(rename = "glossaryGuid", default, skip_serializing_if = "Option::is_none")] + pub glossary_guid: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, +} +impl AtlasGlossaryHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The glossary term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasGlossaryTerm { + #[serde(flatten)] + pub atlas_glossary_base_object: AtlasGlossaryBaseObject, + #[doc = "The abbreviation of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub abbreviation: Option, + #[serde(rename = "templateName", default, skip_serializing_if = "Vec::is_empty")] + pub template_name: Vec, + #[doc = "The glossary header with basic information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub anchor: Option, + #[doc = "An array of related term headers as antonyms."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub antonyms: Vec, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "Status of the AtlasGlossaryTerm"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "An array of resource link for term"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub resources: Vec, + #[doc = "The dictionary of contacts for terms. Key could be Expert or Steward."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contacts: Option, + #[doc = "The custom attributes of the term, which is map>.\nThe key of the first layer map is term template name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[doc = "An array of related object IDs."] + #[serde(rename = "assignedEntities", default, skip_serializing_if = "Vec::is_empty")] + pub assigned_entities: Vec, + #[doc = "An array of term categorization headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub categories: Vec, + #[doc = "An array of related term headers."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifies: Vec, + #[doc = "An array of examples."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub examples: Vec, + #[doc = "An array of related term headers indicating the is-a relationship."] + #[serde(rename = "isA", default, skip_serializing_if = "Vec::is_empty")] + pub is_a: Vec, + #[doc = "An array of preferred related term headers."] + #[serde(rename = "preferredTerms", default, skip_serializing_if = "Vec::is_empty")] + pub preferred_terms: Vec, + #[doc = "An array of related term headers that are preferred to."] + #[serde(rename = "preferredToTerms", default, skip_serializing_if = "Vec::is_empty")] + pub preferred_to_terms: Vec, + #[doc = "An array of related term headers that are replaced by."] + #[serde(rename = "replacedBy", default, skip_serializing_if = "Vec::is_empty")] + pub replaced_by: Vec, + #[doc = "An array of related term headers for replacement."] + #[serde(rename = "replacementTerms", default, skip_serializing_if = "Vec::is_empty")] + pub replacement_terms: Vec, + #[doc = "An array of related term headers for see also."] + #[serde(rename = "seeAlso", default, skip_serializing_if = "Vec::is_empty")] + pub see_also: Vec, + #[doc = "An array of related term headers as synonyms."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub synonyms: Vec, + #[doc = "An array of translated related term headers."] + #[serde(rename = "translatedTerms", default, skip_serializing_if = "Vec::is_empty")] + pub translated_terms: Vec, + #[doc = "An array of related term headers for translation."] + #[serde(rename = "translationTerms", default, skip_serializing_if = "Vec::is_empty")] + pub translation_terms: Vec, + #[doc = "The usage of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub usage: Option, + #[doc = "An array of related term headers as valid values."] + #[serde(rename = "validValues", default, skip_serializing_if = "Vec::is_empty")] + pub valid_values: Vec, + #[doc = "An array of related term headers as valid values for other records."] + #[serde(rename = "validValuesFor", default, skip_serializing_if = "Vec::is_empty")] + pub valid_values_for: Vec, +} +impl AtlasGlossaryTerm { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasLineageInfo { + #[doc = "The GUID of the base entity."] + #[serde(rename = "baseEntityGuid", default, skip_serializing_if = "Option::is_none")] + pub base_entity_guid: Option, + #[doc = "The GUID entity map."] + #[serde(rename = "guidEntityMap", default, skip_serializing_if = "Option::is_none")] + pub guid_entity_map: Option, + #[doc = "The entity count in specific direction."] + #[serde(rename = "widthCounts", default, skip_serializing_if = "Option::is_none")] + pub width_counts: Option, + #[doc = "The depth of lineage."] + #[serde(rename = "lineageDepth", default, skip_serializing_if = "Option::is_none")] + pub lineage_depth: Option, + #[doc = "The width of lineage."] + #[serde(rename = "lineageWidth", default, skip_serializing_if = "Option::is_none")] + pub lineage_width: Option, + #[doc = "True to return the parent of the base entity."] + #[serde(rename = "includeParent", default, skip_serializing_if = "Option::is_none")] + pub include_parent: Option, + #[doc = "The number of children node."] + #[serde(rename = "childrenCount", default, skip_serializing_if = "Option::is_none")] + pub children_count: Option, + #[doc = "The enum of lineage direction."] + #[serde(rename = "lineageDirection", default, skip_serializing_if = "Option::is_none")] + pub lineage_direction: Option, + #[doc = "An array of parentRelations relations."] + #[serde(rename = "parentRelations", default, skip_serializing_if = "Vec::is_empty")] + pub parent_relations: Vec, + #[doc = "An array of lineage relations."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub relations: Vec, +} +impl AtlasLineageInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage direction"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasLineageInfoExtraProperties {} +impl AtlasLineageInfoExtraProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to an object-instance of an Atlas type - like entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasObjectId { + #[doc = "The GUID of the object."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "The unique attributes of the object."] + #[serde(rename = "uniqueAttributes", default, skip_serializing_if = "Option::is_none")] + pub unique_attributes: Option, +} +impl AtlasObjectId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header of the related category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedCategoryHeader { + #[doc = "The GUID of the category."] + #[serde(rename = "categoryGuid", default, skip_serializing_if = "Option::is_none")] + pub category_guid: Option, + #[doc = "The description of the category header."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the parent category."] + #[serde(rename = "parentCategoryGuid", default, skip_serializing_if = "Option::is_none")] + pub parent_category_guid: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, +} +impl AtlasRelatedCategoryHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Reference to an object-instance of AtlasEntity type used in relationship attribute values"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedObjectId { + #[serde(flatten)] + pub atlas_object_id: AtlasObjectId, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] + #[serde(rename = "entityStatus", default, skip_serializing_if = "Option::is_none")] + pub entity_status: Option, + #[serde(rename = "relationshipType", default, skip_serializing_if = "Option::is_none")] + pub relationship_type: Option, + #[doc = "Captures details of struct contents. Not instantiated directly, used only via AtlasEntity, AtlasClassification."] + #[serde(rename = "relationshipAttributes", default, skip_serializing_if = "Option::is_none")] + pub relationship_attributes: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationshipGuid", default, skip_serializing_if = "Option::is_none")] + pub relationship_guid: Option, + #[doc = "The enum of relationship status."] + #[serde(rename = "relationshipStatus", default, skip_serializing_if = "Option::is_none")] + pub relationship_status: Option, +} +impl AtlasRelatedObjectId { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header of the related term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelatedTermHeader { + #[doc = "The description of the related term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The expression of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The source of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The status of term relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The steward of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub steward: Option, + #[doc = "The GUID of the term."] + #[serde(rename = "termGuid", default, skip_serializing_if = "Option::is_none")] + pub term_guid: Option, +} +impl AtlasRelatedTermHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Atlas relationship instance."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationship { + #[serde(flatten)] + pub atlas_struct: AtlasStruct, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "Reference to an object-instance of an Atlas type - like entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end1: Option, + #[doc = "Reference to an object-instance of an Atlas type - like entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end2: Option, + #[doc = "The GUID of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The home ID of the relationship."] + #[serde(rename = "homeId", default, skip_serializing_if = "Option::is_none")] + pub home_id: Option, + #[doc = "The label of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub label: Option, + #[doc = "Used to record the provenance of an instance of an entity or relationship"] + #[serde(rename = "provenanceType", default, skip_serializing_if = "Option::is_none")] + pub provenance_type: Option, + #[doc = "The enum of relationship status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The update time of the record."] + #[serde(rename = "updateTime", default, skip_serializing_if = "Option::is_none")] + pub update_time: Option, + #[doc = "The user who updated the record."] + #[serde(rename = "updatedBy", default, skip_serializing_if = "Option::is_none")] + pub updated_by: Option, + #[doc = "The version of the relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl AtlasRelationship { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipAttributeDef { + #[serde(flatten)] + pub atlas_attribute_def: AtlasAttributeDef, + #[doc = "Determines if it is a legacy attribute."] + #[serde(rename = "isLegacyAttribute", default, skip_serializing_if = "Option::is_none")] + pub is_legacy_attribute: Option, + #[doc = "The name of the relationship type."] + #[serde(rename = "relationshipTypeName", default, skip_serializing_if = "Option::is_none")] + pub relationship_type_name: Option, +} +impl AtlasRelationshipAttributeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "AtlasRelationshipDef is a TypeDef that defines a relationship.\n

\nAs with other typeDefs the AtlasRelationshipDef has a name. Once created the RelationshipDef has a guid.\nThe name and the guid are the 2 ways that the RelationshipDef is identified.\n

\nRelationshipDefs have 2 ends, each of which specify cardinality, an EntityDef type name and name and optionally\nwhether the end is a container.\n

\nRelationshipDefs can have AttributeDefs - though only primitive types are allowed.
\nRelationshipDefs have a relationshipCategory specifying the UML type of relationship required
\nThe way EntityDefs and RelationshipDefs are intended to be used is that EntityDefs will define AttributeDefs these AttributeDefs\nwill not specify an EntityDef type name as their types.\n

\nRelationshipDefs introduce new attributes to the entity instances. For example\n

\nEntityDef A might have attributes attr1,attr2,attr3
\nEntityDef B might have attributes attr4,attr5,attr6
\nRelationshipDef AtoB might define 2 ends
\n\n

\n   end1:  type A, name attr7\n   end2:  type B, name attr8  
\n\n

\nWhen an instance of EntityDef A is created, it will have attributes attr1,attr2,attr3,attr7
\nWhen an instance of EntityDef B is created, it will have attributes attr4,attr5,attr6,attr8\n

\nIn this way relationshipDefs can be authored separately from entityDefs and can inject relationship attributes into\nthe entity instances"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef1", default, skip_serializing_if = "Option::is_none")] + pub end_def1: Option, + #[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] + #[serde(rename = "endDef2", default, skip_serializing_if = "Option::is_none")] + pub end_def2: Option, + #[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] + #[serde(rename = "relationshipCategory", default, skip_serializing_if = "Option::is_none")] + pub relationship_category: Option, + #[doc = "The label of the relationship."] + #[serde(rename = "relationshipLabel", default, skip_serializing_if = "Option::is_none")] + pub relationship_label: Option, +} +impl AtlasRelationshipDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an\nattribute name, cardinality and whether it is the container end of the relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipEndDef { + #[doc = "single-valued attribute or multi-valued attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cardinality: Option, + #[doc = "The description of the relationship end definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Determines if it is container."] + #[serde(rename = "isContainer", default, skip_serializing_if = "Option::is_none")] + pub is_container: Option, + #[doc = "Determines if it is a legacy attribute."] + #[serde(rename = "isLegacyAttribute", default, skip_serializing_if = "Option::is_none")] + pub is_legacy_attribute: Option, + #[doc = "The name of the relationship end definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the relationship end."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl AtlasRelationshipEndDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The relationship with extended information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasRelationshipWithExtInfo { + #[doc = "The referred entity header."] + #[serde(rename = "referredEntities", default, skip_serializing_if = "Option::is_none")] + pub referred_entities: Option, + #[doc = "Atlas relationship instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub relationship: Option, +} +impl AtlasRelationshipWithExtInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Captures details of struct contents. Not instantiated directly, used only via AtlasEntity, AtlasClassification."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasStruct { + #[doc = "The attributes of the struct."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[doc = "The name of the type."] + #[serde(rename = "typeName", default, skip_serializing_if = "Option::is_none")] + pub type_name: Option, + #[doc = "ETag for concurrency control."] + #[serde(rename = "lastModifiedTS", default, skip_serializing_if = "Option::is_none")] + pub last_modified_ts: Option, +} +impl AtlasStruct { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "class that captures details of a struct-type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasStructDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[doc = "An array of attribute definitions."] + #[serde(rename = "attributeDefs", default, skip_serializing_if = "Vec::is_empty")] + pub attribute_defs: Vec, +} +impl AtlasStructDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The header for term assignment."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTermAssignmentHeader { + #[doc = "The confidence of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub confidence: Option, + #[doc = "The user who created the record."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The description of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The expression of the term assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The source of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[doc = "The status of terms assignment."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The steward of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub steward: Option, + #[doc = "The GUID of the term."] + #[serde(rename = "termGuid", default, skip_serializing_if = "Option::is_none")] + pub term_guid: Option, +} +impl AtlasTermAssignmentHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of terms assignment."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AtlasTermAssignmentStatus { + #[serde(rename = "DISCOVERED")] + Discovered, + #[serde(rename = "PROPOSED")] + Proposed, + #[serde(rename = "IMPORTED")] + Imported, + #[serde(rename = "VALIDATED")] + Validated, + #[serde(rename = "DEPRECATED")] + Deprecated, + #[serde(rename = "OBSOLETE")] + Obsolete, + #[serde(rename = "OTHER")] + Other, +} +#[doc = "The basic information for term categorization."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTermCategorizationHeader { + #[doc = "The GUID of the category."] + #[serde(rename = "categoryGuid", default, skip_serializing_if = "Option::is_none")] + pub category_guid: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The display text."] + #[serde(rename = "displayText", default, skip_serializing_if = "Option::is_none")] + pub display_text: Option, + #[doc = "The GUID of the relationship."] + #[serde(rename = "relationGuid", default, skip_serializing_if = "Option::is_none")] + pub relation_guid: Option, + #[doc = "The status of term relationship."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl AtlasTermCategorizationHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of term relationship."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AtlasTermRelationshipStatus { + #[serde(rename = "DRAFT")] + Draft, + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DEPRECATED")] + Deprecated, + #[serde(rename = "OBSOLETE")] + Obsolete, + #[serde(rename = "OTHER")] + Other, +} +#[doc = "The definitions of type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypeDef { + #[serde(flatten)] + pub atlas_base_type_def: AtlasBaseTypeDef, + #[serde(flatten)] + pub atlas_extra_type_def: AtlasExtraTypeDef, +} +impl AtlasTypeDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The basic information of the type definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypeDefHeader { + #[doc = "The enum of type category."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub category: Option, + #[doc = "The GUID of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, + #[doc = "The name of the type definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl AtlasTypeDefHeader { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The definitions of types."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AtlasTypesDef { + #[doc = "businessMetadataDefs"] + #[serde(rename = "businessMetadataDefs", default, skip_serializing_if = "Vec::is_empty")] + pub business_metadata_defs: Vec, + #[doc = "An array of classification definitions."] + #[serde(rename = "classificationDefs", default, skip_serializing_if = "Vec::is_empty")] + pub classification_defs: Vec, + #[doc = "An array of entity definitions."] + #[serde(rename = "entityDefs", default, skip_serializing_if = "Vec::is_empty")] + pub entity_defs: Vec, + #[doc = "An array of enum definitions."] + #[serde(rename = "enumDefs", default, skip_serializing_if = "Vec::is_empty")] + pub enum_defs: Vec, + #[doc = "An array of relationship definitions."] + #[serde(rename = "relationshipDefs", default, skip_serializing_if = "Vec::is_empty")] + pub relationship_defs: Vec, + #[doc = "An array of struct definitions."] + #[serde(rename = "structDefs", default, skip_serializing_if = "Vec::is_empty")] + pub struct_defs: Vec, + #[doc = "An array of term template definitions."] + #[serde(rename = "termTemplateDefs", default, skip_serializing_if = "Vec::is_empty")] + pub term_template_defs: Vec, +} +impl AtlasTypesDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The query of autocomplete request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteRequest { + #[doc = "The keywords applied to all fields that support autocomplete operation. It must be at least 1 character, and no more than 100 characters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The number of autocomplete results we hope to return. The default value is 50. The value must be a number between 1 and 100."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the autocomplete request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl AutoCompleteRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result of the autocomplete request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl AutoCompleteResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the autocomplete suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoCompleteResultValue { + #[doc = "The completed term or phrase."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, + #[doc = "The completed search query text."] + #[serde(rename = "queryPlusText", default, skip_serializing_if = "Option::is_none")] + pub query_plus_text: Option, +} +impl AutoCompleteResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The criteria of browse request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseRequest { + #[doc = "The entity type to browse as the root level entry point."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The path to browse the next level child entities."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The number of browse items we hope to return. The maximum value is 10000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The offset. The default value is 0. The maximum value is 100000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offset: Option, +} +impl BrowseRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result item of the browse request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResult { + #[doc = "The total number of browse results."] + #[serde(rename = "@search.count", default, skip_serializing_if = "Option::is_none")] + pub search_count: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BrowseResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the browse owner."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResultOwner { + #[doc = "The GUID of the owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The display name of the owner."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The mail of the owner."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mail: Option, + #[doc = "The contact type of the owner. The value will be Owner."] + #[serde(rename = "contactType", default, skip_serializing_if = "Option::is_none")] + pub contact_type: Option, +} +impl BrowseResultOwner { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the browse result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BrowseResultValue { + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "If the record is a leaf entity."] + #[serde(rename = "isLeaf", default, skip_serializing_if = "Option::is_none")] + pub is_leaf: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owners of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub owner: Vec, + #[doc = "The path of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, +} +impl BrowseResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "example"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BulkImportResponse { + #[doc = "failed importInfoList"] + #[serde(rename = "failedImportInfoList", default, skip_serializing_if = "Vec::is_empty")] + pub failed_import_info_list: Vec, + #[doc = "successful importInfoList"] + #[serde(rename = "successImportInfoList", default, skip_serializing_if = "Vec::is_empty")] + pub success_import_info_list: Vec, +} +impl BulkImportResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "single-valued attribute or multi-valued attribute."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Cardinality { + #[serde(rename = "SINGLE")] + Single, + #[serde(rename = "LIST")] + List, + #[serde(rename = "SET")] + Set, +} +#[doc = "The request for classification association."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ClassificationAssociateRequest { + #[doc = "An instance of a classification; it doesn't have an identity, this object exists only when associated with an entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub classification: Option, + #[doc = "The GUID of the entity."] + #[serde(rename = "entityGuids", default, skip_serializing_if = "Vec::is_empty")] + pub entity_guids: Vec, +} +impl ClassificationAssociateRequest { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactBasic { + #[doc = "Azure Active Directory object Id."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "additional information to describe this contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ContactBasic { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The contact in the search and suggest result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ContactSearchResultValue { + #[doc = "The GUID of the contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The description of the contact."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, + #[doc = "The type of the contact. It can be Expert or Owner for an entity. It can be Expert or Steward for a glossary term."] + #[serde(rename = "contactType", default, skip_serializing_if = "Option::is_none")] + pub contact_type: Option, +} +impl ContactSearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The date format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DateFormat { + #[doc = "An array of available locales."] + #[serde(rename = "availableLocales", default, skip_serializing_if = "Vec::is_empty")] + pub available_locales: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub calendar: Option, + #[doc = "The date format."] + #[serde(rename = "dateInstance", default, skip_serializing_if = "Option::is_none")] + pub date_instance: Box>, + #[doc = "The date format."] + #[serde(rename = "dateTimeInstance", default, skip_serializing_if = "Option::is_none")] + pub date_time_instance: Box>, + #[doc = "The date format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Box>, + #[doc = "Determines the leniency of the date format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lenient: Option, + #[doc = "The number format."] + #[serde(rename = "numberFormat", default, skip_serializing_if = "Option::is_none")] + pub number_format: Option, + #[doc = "The date format."] + #[serde(rename = "timeInstance", default, skip_serializing_if = "Option::is_none")] + pub time_instance: Box>, + #[doc = "The timezone information."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl DateFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The mutation response of entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EntityMutationResponse { + #[doc = "A map of GUID assignments with entities."] + #[serde(rename = "guidAssignments", default, skip_serializing_if = "Option::is_none")] + pub guid_assignments: Option, + #[doc = "The entity headers of mutated entities."] + #[serde(rename = "mutatedEntities", default, skip_serializing_if = "Option::is_none")] + pub mutated_entities: Option, + #[doc = "An array of entity headers that partially updated."] + #[serde(rename = "partialUpdatedEntities", default, skip_serializing_if = "Vec::is_empty")] + pub partial_updated_entities: Vec, +} +impl EntityMutationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "An error response from the service"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The request ID."] + #[serde(rename = "requestId", default, skip_serializing_if = "Option::is_none")] + pub request_id: Option, + #[doc = "The error code."] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "The error message."] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The status of import csv operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperation { + #[doc = "guid string"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Enum of the status of import csv operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The created time of the record."] + #[serde(rename = "createTime", default, skip_serializing_if = "Option::is_none")] + pub create_time: Option, + #[doc = "The last updated time of the record."] + #[serde(rename = "lastUpdateTime", default, skip_serializing_if = "Option::is_none")] + pub last_update_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ImportCsvOperation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperationError { + #[doc = "Error code from async import job if fail"] + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[doc = "Error message from async import job if fail"] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, +} +impl ImportCsvOperationError { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportCsvOperationProperties { + #[doc = "Term numbers that already imported successfully"] + #[serde(rename = "importedTerms", default, skip_serializing_if = "Option::is_none")] + pub imported_terms: Option, + #[doc = "Total term numbers that detected in csv"] + #[serde(rename = "totalTermsDetected", default, skip_serializing_if = "Option::is_none")] + pub total_terms_detected: Option, +} +impl ImportCsvOperationProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enum of the status of import csv operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ImportCsvOperationStatus { + NotStarted, + Succeeded, + Failed, + Running, +} +#[doc = "ImportInfo"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImportInfo { + #[doc = "childObjectName"] + #[serde(rename = "childObjectName", default, skip_serializing_if = "Option::is_none")] + pub child_object_name: Option, + #[doc = "ImportStatus"] + #[serde(rename = "importStatus", default, skip_serializing_if = "Option::is_none")] + pub import_status: Option, + #[doc = "parentObjectName"] + #[serde(rename = "parentObjectName", default, skip_serializing_if = "Option::is_none")] + pub parent_object_name: Option, + #[doc = "remarks"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub remarks: Option, +} +impl ImportInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "ImportStatus"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ImportStatus { + #[serde(rename = "SUCCESS")] + Success, + #[serde(rename = "FAILED")] + Failed, +} +pub type LastModifiedTs = String; +#[doc = "The enum of lineage direction."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum LineageDirection { + #[serde(rename = "INPUT")] + Input, + #[serde(rename = "OUTPUT")] + Output, + #[serde(rename = "BOTH")] + Both, +} +#[doc = "The lineage relation with GUID of the from and to entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LineageRelation { + #[doc = "The GUID of from-entity."] + #[serde(rename = "fromEntityId", default, skip_serializing_if = "Option::is_none")] + pub from_entity_id: Option, + #[doc = "The GUID of relationship."] + #[serde(rename = "relationshipId", default, skip_serializing_if = "Option::is_none")] + pub relationship_id: Option, + #[doc = "The GUID of to-entity."] + #[serde(rename = "toEntityId", default, skip_serializing_if = "Option::is_none")] + pub to_entity_id: Option, +} +impl LineageRelation { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MoveEntitiesRequest { + #[doc = "An array of entity guids to be moved to target collection."] + #[serde(rename = "entityGuids", default, skip_serializing_if = "Vec::is_empty")] + pub entity_guids: Vec, +} +impl MoveEntitiesRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The number format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NumberFormat { + #[doc = "The number format."] + #[serde(rename = "availableLocales", default, skip_serializing_if = "Vec::is_empty")] + pub available_locales: Vec, + #[doc = "The currency."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub currency: Option, + #[doc = "The number format."] + #[serde(rename = "currencyInstance", default, skip_serializing_if = "Option::is_none")] + pub currency_instance: Box>, + #[doc = "Determines if grouping is used."] + #[serde(rename = "groupingUsed", default, skip_serializing_if = "Option::is_none")] + pub grouping_used: Option, + #[doc = "The number format."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub instance: Box>, + #[doc = "The number format."] + #[serde(rename = "integerInstance", default, skip_serializing_if = "Option::is_none")] + pub integer_instance: Box>, + #[doc = "The maximum of fraction digits."] + #[serde(rename = "maximumFractionDigits", default, skip_serializing_if = "Option::is_none")] + pub maximum_fraction_digits: Option, + #[doc = "The maximum of integer digits."] + #[serde(rename = "maximumIntegerDigits", default, skip_serializing_if = "Option::is_none")] + pub maximum_integer_digits: Option, + #[doc = "The minimum of fraction digits."] + #[serde(rename = "minimumFractionDigits", default, skip_serializing_if = "Option::is_none")] + pub minimum_fraction_digits: Option, + #[doc = "The minimum of integer digits."] + #[serde(rename = "minimumIntegerDigits", default, skip_serializing_if = "Option::is_none")] + pub minimum_integer_digits: Option, + #[doc = "The number format."] + #[serde(rename = "numberInstance", default, skip_serializing_if = "Option::is_none")] + pub number_instance: Box>, + #[doc = "Determines if only integer is parsed."] + #[serde(rename = "parseIntegerOnly", default, skip_serializing_if = "Option::is_none")] + pub parse_integer_only: Option, + #[doc = "The number format."] + #[serde(rename = "percentInstance", default, skip_serializing_if = "Option::is_none")] + pub percent_instance: Box>, + #[doc = "The enum of rounding mode."] + #[serde(rename = "roundingMode", default, skip_serializing_if = "Option::is_none")] + pub rounding_mode: Option, +} +impl NumberFormat { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Paginated-list, for returning search results."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PList { + #[doc = "An array of objects."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub list: Vec, + #[doc = "The size of the page."] + #[serde(rename = "pageSize", default, skip_serializing_if = "Option::is_none")] + pub page_size: Option, + #[doc = "The sorted by field."] + #[serde(rename = "sortBy", default, skip_serializing_if = "Option::is_none")] + pub sort_by: Option, + #[doc = "to specify whether the result should be sorted? If yes, whether asc or desc."] + #[serde(rename = "sortType", default, skip_serializing_if = "Option::is_none")] + pub sort_type: Option, + #[doc = "The start index of the page."] + #[serde(rename = "startIndex", default, skip_serializing_if = "Option::is_none")] + pub start_index: Option, + #[doc = "The total count of items."] + #[serde(rename = "totalCount", default, skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} +impl PList { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The lineage parents relation with GUID of the parent entity and to child entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParentRelation { + #[doc = "The GUID of child entity."] + #[serde(rename = "childEntityId", default, skip_serializing_if = "Option::is_none")] + pub child_entity_id: Option, + #[doc = "The GUID of relationship."] + #[serde(rename = "relationshipId", default, skip_serializing_if = "Option::is_none")] + pub relationship_id: Option, + #[doc = "The GUID of parent entity."] + #[serde(rename = "parentEntityId", default, skip_serializing_if = "Option::is_none")] + pub parent_entity_id: Option, +} +impl ParentRelation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Relationship category determines the style of relationship around containment and lifecycle.\nUML terminology is used for the values.\n

\nASSOCIATION is a relationship with no containment.
\nCOMPOSITION and AGGREGATION are containment relationships.\n

\nThe difference being in the lifecycles of the container and its children. In the COMPOSITION case,\nthe children cannot exist without the container. For AGGREGATION, the life cycles\nof the container and children are totally independent."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RelationshipCategory { + #[serde(rename = "ASSOCIATION")] + Association, + #[serde(rename = "AGGREGATION")] + Aggregation, + #[serde(rename = "COMPOSITION")] + Composition, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ResourceLink { + #[doc = "Display name for url."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "web url. http or https"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, +} +impl ResourceLink { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The enum of rounding mode."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RoundingMode { + #[serde(rename = "UP")] + Up, + #[serde(rename = "DOWN")] + Down, + #[serde(rename = "CEILING")] + Ceiling, + #[serde(rename = "FLOOR")] + Floor, + #[serde(rename = "HALF_UP")] + HalfUp, + #[serde(rename = "HALF_DOWN")] + HalfDown, + #[serde(rename = "HALF_EVEN")] + HalfEven, + #[serde(rename = "UNNECESSARY")] + Unnecessary, +} +#[doc = "The content of a search facet result item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetItem { + #[doc = "The count of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The name of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub facet: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sort: Option, +} +impl SearchFacetItem { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The content of a search facet result item."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetItemValue { + #[doc = "The count of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "The name of the facet item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SearchFacetItemValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A facet list that consists of index fields assetType ,classification, contactId, and label. When the facet is specified in the request, the value of the facet is returned as an element of @search.facets."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchFacetResultValue { + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[serde(rename = "classificationCategory", default, skip_serializing_if = "Vec::is_empty")] + pub classification_category: Vec, + #[serde(rename = "contactId", default, skip_serializing_if = "Vec::is_empty")] + pub contact_id: Vec, + #[serde(rename = "fileExtension", default, skip_serializing_if = "Vec::is_empty")] + pub file_extension: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, +} +impl SearchFacetResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A highlight list that consists of index fields id ,qualifiedName, name, description, entityType. When the keyword appears in those fields, the value of the field, attached with emphasis mark, is returned as an element of @search.highlights."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchHighlights { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub id: Vec, + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Vec::is_empty")] + pub qualified_name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub name: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub description: Vec, + #[serde(rename = "entityType", default, skip_serializing_if = "Vec::is_empty")] + pub entity_type: Vec, +} +impl SearchHighlights { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The search query of advanced search request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchRequest { + #[doc = "The keywords applied to all searchable fields."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The offset. The default value is 0. The maximum value is 100000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offset: Option, + #[doc = "The limit of the number of the search result. default value is 50; maximum value is 1000."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the search. See examples for the usage of supported filters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub facets: Vec, + #[serde(rename = "taxonomySetting", default, skip_serializing_if = "Option::is_none")] + pub taxonomy_setting: Option, +} +impl SearchRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod search_request { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct TaxonomySetting { + #[serde(rename = "assetTypes", default, skip_serializing_if = "Vec::is_empty")] + pub asset_types: Vec, + #[doc = "The content of a search facet result item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub facet: Option, + } + impl TaxonomySetting { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The result of the search result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchResult { + #[doc = "The total number of search results (not the number of documents in a single page)."] + #[serde(rename = "@search.count", default, skip_serializing_if = "Option::is_none")] + pub search_count: Option, + #[doc = "A facet list that consists of index fields assetType ,classification, contactId, and label. When the facet is specified in the request, the value of the facet is returned as an element of @search.facets."] + #[serde(rename = "@search.facets", default, skip_serializing_if = "Option::is_none")] + pub search_facets: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SearchResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the search result."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SearchResultValue { + #[doc = "The search score calculated by the search engine. The results are ordered by search score by default."] + #[serde(rename = "@search.score", default, skip_serializing_if = "Option::is_none")] + pub search_score: Option, + #[doc = "A highlight list that consists of index fields id ,qualifiedName, name, description, entityType. When the keyword appears in those fields, the value of the field, attached with emphasis mark, is returned as an element of @search.highlights."] + #[serde(rename = "@search.highlights", default, skip_serializing_if = "Option::is_none")] + pub search_highlights: Option, + #[doc = "The target text that contains the keyword as prefix. The keyword is wrapped with emphasis mark."] + #[serde(rename = "@search.text", default, skip_serializing_if = "Option::is_none")] + pub search_text: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owner of the record. This is an Atlas native attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The classifications of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[doc = "The labels of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[doc = "The terms assigned to the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, + #[doc = "The contacts of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub contact: Vec, + #[doc = "The asset types of the record."] + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, +} +impl SearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "to specify whether the result should be sorted? If yes, whether asc or desc."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SortType { + #[serde(rename = "NONE")] + None, + #[serde(rename = "ASC")] + Asc, + #[serde(rename = "DESC")] + Desc, +} +#[doc = "Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DELETED")] + Deleted, +} +#[doc = "The enum of relationship status."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum StatusAtlasRelationship { + #[serde(rename = "ACTIVE")] + Active, + #[serde(rename = "DELETED")] + Deleted, +} +#[doc = "The query of suggest request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestRequest { + #[doc = "The keywords applied to all fields that support suggest operation. It must be at least 1 character, and no more than 100 characters. In the index schema we defined a default suggester which lists all the supported fields and specifies a search mode."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keywords: Option, + #[doc = "The number of suggestions we hope to return. The default value is 5. The value must be a number between 1 and 100."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[doc = "The filter for the search."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, +} +impl SuggestRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The result item of the search suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SuggestResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The value item of the search suggest."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SuggestResultValue { + #[doc = "The search score calculated by the search engine. The results are ordered by search score by default."] + #[serde(rename = "@search.score", default, skip_serializing_if = "Option::is_none")] + pub search_score: Option, + #[doc = "The target text that contains the keyword as prefix. The keyword is wrapped with emphasis mark."] + #[serde(rename = "@search.text", default, skip_serializing_if = "Option::is_none")] + pub search_text: Option, + #[doc = "The description of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The GUID of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the record."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The owner of the record. This is an Atlas native attribute."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub owner: Option, + #[doc = "The qualified name of the record."] + #[serde(rename = "qualifiedName", default, skip_serializing_if = "Option::is_none")] + pub qualified_name: Option, + #[doc = "The type name of the record."] + #[serde(rename = "entityType", default, skip_serializing_if = "Option::is_none")] + pub entity_type: Option, + #[doc = "The classifications of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classification: Vec, + #[doc = "The labels of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub label: Vec, + #[doc = "The terms assigned to the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub term: Vec, + #[doc = "The contacts of the record."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub contact: Vec, + #[doc = "The asset types of the record."] + #[serde(rename = "assetType", default, skip_serializing_if = "Vec::is_empty")] + pub asset_type: Vec, +} +impl SuggestResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The custom attributes of the term, which is map>.\nThe key of the first layer map is term template name."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermCustomAttributes {} +impl TermCustomAttributes { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The term attribute name and attribute value, which is map"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermCustomAttributesExtraProperties {} +impl TermCustomAttributesExtraProperties { + pub fn new() -> Self { + Self::default() + } +} +pub type TermGuid = String; +#[doc = "The context."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermSearchResultValue { + #[doc = "The name of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The name of the glossary which contains the term."] + #[serde(rename = "glossaryName", default, skip_serializing_if = "Option::is_none")] + pub glossary_name: Option, + #[doc = "The GUID of the term."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub guid: Option, +} +impl TermSearchResultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Status of the AtlasGlossaryTerm"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TermStatus { + Draft, + Approved, + Alert, + Expired, +} +#[doc = "term template definition for glossary term."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TermTemplateDef { + #[serde(flatten)] + pub atlas_struct_def: AtlasStructDef, +} +impl TermTemplateDef { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Captures time-boundary details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeBoundary { + #[doc = "The end of the time boundary."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The start of the time boundary."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The timezone of the time boundary."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, +} +impl TimeBoundary { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The timezone information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TimeZone { + #[doc = "The value of the daylight saving time."] + #[serde(rename = "dstSavings", default, skip_serializing_if = "Option::is_none")] + pub dst_savings: Option, + #[doc = "The ID of the timezone."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "An array of available IDs."] + #[serde(rename = "availableIds", default, skip_serializing_if = "Vec::is_empty")] + pub available_ids: Vec, + #[doc = "The timezone information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub default: Box>, + #[doc = "The display name of the timezone."] + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[doc = "The raw offset of the timezone."] + #[serde(rename = "rawOffset", default, skip_serializing_if = "Option::is_none")] + pub raw_offset: Option, +} +impl TimeZone { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The enum of type category."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TypeCategory { + #[serde(rename = "PRIMITIVE")] + Primitive, + #[serde(rename = "OBJECT_ID_TYPE")] + ObjectIdType, + #[serde(rename = "ENUM")] + Enum, + #[serde(rename = "STRUCT")] + Struct, + #[serde(rename = "CLASSIFICATION")] + Classification, + #[serde(rename = "ENTITY")] + Entity, + #[serde(rename = "ARRAY")] + Array, + #[serde(rename = "MAP")] + Map, + #[serde(rename = "RELATIONSHIP")] + Relationship, + #[serde(rename = "TERM_TEMPLATE")] + TermTemplate, +} diff --git a/services/svc/purview/src/package_preview_2022_03/operations.rs b/services/svc/purview/src/package_preview_2022_03/operations.rs new file mode 100644 index 0000000000..891560ec25 --- /dev/null +++ b/services/svc/purview/src/package_preview_2022_03/operations.rs @@ -0,0 +1,9115 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn collection(&self) -> collection::Client { + collection::Client(self.clone()) + } + pub fn discovery(&self) -> discovery::Client { + discovery::Client(self.clone()) + } + pub fn entity(&self) -> entity::Client { + entity::Client(self.clone()) + } + pub fn glossary(&self) -> glossary::Client { + glossary::Client(self.clone()) + } + pub fn lineage(&self) -> lineage::Client { + lineage::Client(self.clone()) + } + pub fn relationship(&self) -> relationship::Client { + relationship::Client(self.clone()) + } + pub fn types(&self) -> types::Client { + types::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + Entity_CreateOrUpdate(#[from] entity::create_or_update::Error), + #[error(transparent)] + Entity_ListByGuids(#[from] entity::list_by_guids::Error), + #[error(transparent)] + Entity_CreateOrUpdateEntities(#[from] entity::create_or_update_entities::Error), + #[error(transparent)] + Entity_DeleteByGuids(#[from] entity::delete_by_guids::Error), + #[error(transparent)] + Entity_AddClassification(#[from] entity::add_classification::Error), + #[error(transparent)] + Entity_GetByGuid(#[from] entity::get_by_guid::Error), + #[error(transparent)] + Entity_PartialUpdateEntityAttributeByGuid(#[from] entity::partial_update_entity_attribute_by_guid::Error), + #[error(transparent)] + Entity_DeleteByGuid(#[from] entity::delete_by_guid::Error), + #[error(transparent)] + Entity_GetClassification(#[from] entity::get_classification::Error), + #[error(transparent)] + Entity_DeleteClassification(#[from] entity::delete_classification::Error), + #[error(transparent)] + Entity_GetClassifications(#[from] entity::get_classifications::Error), + #[error(transparent)] + Entity_AddClassifications(#[from] entity::add_classifications::Error), + #[error(transparent)] + Entity_UpdateClassifications(#[from] entity::update_classifications::Error), + #[error(transparent)] + Entity_GetByUniqueAttributes(#[from] entity::get_by_unique_attributes::Error), + #[error(transparent)] + Entity_PartialUpdateEntityByUniqueAttributes(#[from] entity::partial_update_entity_by_unique_attributes::Error), + #[error(transparent)] + Entity_DeleteByUniqueAttribute(#[from] entity::delete_by_unique_attribute::Error), + #[error(transparent)] + Entity_DeleteClassificationByUniqueAttribute(#[from] entity::delete_classification_by_unique_attribute::Error), + #[error(transparent)] + Entity_AddClassificationsByUniqueAttribute(#[from] entity::add_classifications_by_unique_attribute::Error), + #[error(transparent)] + Entity_UpdateClassificationsByUniqueAttribute(#[from] entity::update_classifications_by_unique_attribute::Error), + #[error(transparent)] + Entity_SetClassifications(#[from] entity::set_classifications::Error), + #[error(transparent)] + Entity_GetEntitiesByUniqueAttributes(#[from] entity::get_entities_by_unique_attributes::Error), + #[error(transparent)] + Entity_GetHeader(#[from] entity::get_header::Error), + #[error(transparent)] + Entity_AddOrUpdateBusinessMetadata(#[from] entity::add_or_update_business_metadata::Error), + #[error(transparent)] + Entity_DeleteBusinessMetadata(#[from] entity::delete_business_metadata::Error), + #[error(transparent)] + Entity_AddOrUpdateBusinessAttributes(#[from] entity::add_or_update_business_attributes::Error), + #[error(transparent)] + Entity_DeleteBusinessAttributes(#[from] entity::delete_business_attributes::Error), + #[error(transparent)] + Entity_GetSampleBusinessMetadataTemplate(#[from] entity::get_sample_business_metadata_template::Error), + #[error(transparent)] + Entity_ImportBusinessAttributes(#[from] entity::import_business_attributes::Error), + #[error(transparent)] + Entity_SetLabels(#[from] entity::set_labels::Error), + #[error(transparent)] + Entity_AddLabel(#[from] entity::add_label::Error), + #[error(transparent)] + Entity_DeleteLabels(#[from] entity::delete_labels::Error), + #[error(transparent)] + Entity_SetLabelsByUniqueAttribute(#[from] entity::set_labels_by_unique_attribute::Error), + #[error(transparent)] + Entity_AddLabelsByUniqueAttribute(#[from] entity::add_labels_by_unique_attribute::Error), + #[error(transparent)] + Entity_DeleteLabelsByUniqueAttribute(#[from] entity::delete_labels_by_unique_attribute::Error), + #[error(transparent)] + Glossary_ListGlossaries(#[from] glossary::list_glossaries::Error), + #[error(transparent)] + Glossary_CreateGlossary(#[from] glossary::create_glossary::Error), + #[error(transparent)] + Glossary_CreateGlossaryCategories(#[from] glossary::create_glossary_categories::Error), + #[error(transparent)] + Glossary_CreateGlossaryCategory(#[from] glossary::create_glossary_category::Error), + #[error(transparent)] + Glossary_GetGlossaryCategory(#[from] glossary::get_glossary_category::Error), + #[error(transparent)] + Glossary_UpdateGlossaryCategory(#[from] glossary::update_glossary_category::Error), + #[error(transparent)] + Glossary_DeleteGlossaryCategory(#[from] glossary::delete_glossary_category::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossaryCategory(#[from] glossary::partial_update_glossary_category::Error), + #[error(transparent)] + Glossary_ListRelatedCategories(#[from] glossary::list_related_categories::Error), + #[error(transparent)] + Glossary_ListCategoryTerms(#[from] glossary::list_category_terms::Error), + #[error(transparent)] + Glossary_CreateGlossaryTerm(#[from] glossary::create_glossary_term::Error), + #[error(transparent)] + Glossary_GetGlossaryTerm(#[from] glossary::get_glossary_term::Error), + #[error(transparent)] + Glossary_UpdateGlossaryTerm(#[from] glossary::update_glossary_term::Error), + #[error(transparent)] + Glossary_DeleteGlossaryTerm(#[from] glossary::delete_glossary_term::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossaryTerm(#[from] glossary::partial_update_glossary_term::Error), + #[error(transparent)] + Glossary_CreateGlossaryTerms(#[from] glossary::create_glossary_terms::Error), + #[error(transparent)] + Glossary_GetEntitiesAssignedWithTerm(#[from] glossary::get_entities_assigned_with_term::Error), + #[error(transparent)] + Glossary_AssignTermToEntities(#[from] glossary::assign_term_to_entities::Error), + #[error(transparent)] + Glossary_RemoveTermAssignmentFromEntities(#[from] glossary::remove_term_assignment_from_entities::Error), + #[error(transparent)] + Glossary_DeleteTermAssignmentFromEntities(#[from] glossary::delete_term_assignment_from_entities::Error), + #[error(transparent)] + Glossary_ListRelatedTerms(#[from] glossary::list_related_terms::Error), + #[error(transparent)] + Glossary_GetGlossary(#[from] glossary::get_glossary::Error), + #[error(transparent)] + Glossary_UpdateGlossary(#[from] glossary::update_glossary::Error), + #[error(transparent)] + Glossary_DeleteGlossary(#[from] glossary::delete_glossary::Error), + #[error(transparent)] + Glossary_ListGlossaryCategories(#[from] glossary::list_glossary_categories::Error), + #[error(transparent)] + Glossary_ListGlossaryCategoriesHeaders(#[from] glossary::list_glossary_categories_headers::Error), + #[error(transparent)] + Glossary_GetDetailedGlossary(#[from] glossary::get_detailed_glossary::Error), + #[error(transparent)] + Glossary_PartialUpdateGlossary(#[from] glossary::partial_update_glossary::Error), + #[error(transparent)] + Glossary_ListGlossaryTerms(#[from] glossary::list_glossary_terms::Error), + #[error(transparent)] + Glossary_ListGlossaryTermHeaders(#[from] glossary::list_glossary_term_headers::Error), + #[error(transparent)] + Glossary_ImportGlossaryTermsViaCsv(#[from] glossary::import_glossary_terms_via_csv::Error), + #[error(transparent)] + Glossary_ImportGlossaryTermsViaCsvByGlossaryName(#[from] glossary::import_glossary_terms_via_csv_by_glossary_name::Error), + #[error(transparent)] + Glossary_GetImportCsvOperationStatus(#[from] glossary::get_import_csv_operation_status::Error), + #[error(transparent)] + Glossary_ExportGlossaryTermsAsCsv(#[from] glossary::export_glossary_terms_as_csv::Error), + #[error(transparent)] + Glossary_ListTermsByGlossaryName(#[from] glossary::list_terms_by_glossary_name::Error), + #[error(transparent)] + Discovery_Query(#[from] discovery::query::Error), + #[error(transparent)] + Discovery_Suggest(#[from] discovery::suggest::Error), + #[error(transparent)] + Discovery_Browse(#[from] discovery::browse::Error), + #[error(transparent)] + Discovery_AutoComplete(#[from] discovery::auto_complete::Error), + #[error(transparent)] + Lineage_GetLineageGraph(#[from] lineage::get_lineage_graph::Error), + #[error(transparent)] + Lineage_NextPageLineage(#[from] lineage::next_page_lineage::Error), + #[error(transparent)] + Lineage_GetLineageByUniqueAttribute(#[from] lineage::get_lineage_by_unique_attribute::Error), + #[error(transparent)] + Relationship_Create(#[from] relationship::create::Error), + #[error(transparent)] + Relationship_Update(#[from] relationship::update::Error), + #[error(transparent)] + Relationship_Get(#[from] relationship::get::Error), + #[error(transparent)] + Relationship_Delete(#[from] relationship::delete::Error), + #[error(transparent)] + Types_GetBusinessMetadataDefByGuid(#[from] types::get_business_metadata_def_by_guid::Error), + #[error(transparent)] + Types_GetBusinessMetadataDefByName(#[from] types::get_business_metadata_def_by_name::Error), + #[error(transparent)] + Types_GetClassificationDefByGuid(#[from] types::get_classification_def_by_guid::Error), + #[error(transparent)] + Types_GetClassificationDefByName(#[from] types::get_classification_def_by_name::Error), + #[error(transparent)] + Types_GetEntityDefinitionByGuid(#[from] types::get_entity_definition_by_guid::Error), + #[error(transparent)] + Types_GetEntityDefinitionByName(#[from] types::get_entity_definition_by_name::Error), + #[error(transparent)] + Types_GetEnumDefByGuid(#[from] types::get_enum_def_by_guid::Error), + #[error(transparent)] + Types_GetEnumDefByName(#[from] types::get_enum_def_by_name::Error), + #[error(transparent)] + Types_GetRelationshipDefByGuid(#[from] types::get_relationship_def_by_guid::Error), + #[error(transparent)] + Types_GetRelationshipDefByName(#[from] types::get_relationship_def_by_name::Error), + #[error(transparent)] + Types_GetStructDefByGuid(#[from] types::get_struct_def_by_guid::Error), + #[error(transparent)] + Types_GetStructDefByName(#[from] types::get_struct_def_by_name::Error), + #[error(transparent)] + Types_GetTypeDefinitionByGuid(#[from] types::get_type_definition_by_guid::Error), + #[error(transparent)] + Types_GetTypeDefinitionByName(#[from] types::get_type_definition_by_name::Error), + #[error(transparent)] + Types_DeleteTypeByName(#[from] types::delete_type_by_name::Error), + #[error(transparent)] + Types_GetAllTypeDefinitions(#[from] types::get_all_type_definitions::Error), + #[error(transparent)] + Types_CreateTypeDefinitions(#[from] types::create_type_definitions::Error), + #[error(transparent)] + Types_UpdateAtlasTypeDefinitions(#[from] types::update_atlas_type_definitions::Error), + #[error(transparent)] + Types_DeleteTypeDefinitions(#[from] types::delete_type_definitions::Error), + #[error(transparent)] + Types_ListTypeDefinitionHeaders(#[from] types::list_type_definition_headers::Error), + #[error(transparent)] + Types_GetTermTemplateDefByGuid(#[from] types::get_term_template_def_by_guid::Error), + #[error(transparent)] + Types_GetTermTemplateDefByName(#[from] types::get_term_template_def_by_name::Error), + #[error(transparent)] + Collection_CreateOrUpdate(#[from] collection::create_or_update::Error), + #[error(transparent)] + Collection_CreateOrUpdateBulk(#[from] collection::create_or_update_bulk::Error), + #[error(transparent)] + Collection_MoveEntitiesToCollection(#[from] collection::move_entities_to_collection::Error), +} +pub mod entity { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_or_update(&self, entity: impl Into) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + entity: entity.into(), + } + } + pub fn list_by_guids(&self, guid: Vec) -> list_by_guids::Builder { + list_by_guids::Builder { + client: self.0.clone(), + guid, + min_ext_info: None, + ignore_relationships: None, + exclude_relationship_types: Vec::new(), + } + } + pub fn create_or_update_entities( + &self, + entities: impl Into, + ) -> create_or_update_entities::Builder { + create_or_update_entities::Builder { + client: self.0.clone(), + entities: entities.into(), + } + } + pub fn delete_by_guids(&self, guid: Vec) -> delete_by_guids::Builder { + delete_by_guids::Builder { + client: self.0.clone(), + guid, + } + } + pub fn add_classification(&self, request: impl Into) -> add_classification::Builder { + add_classification::Builder { + client: self.0.clone(), + request: request.into(), + } + } + pub fn get_by_guid(&self, guid: impl Into) -> get_by_guid::Builder { + get_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + min_ext_info: None, + ignore_relationships: None, + } + } + pub fn partial_update_entity_attribute_by_guid( + &self, + guid: impl Into, + name: impl Into, + body: impl Into, + ) -> partial_update_entity_attribute_by_guid::Builder { + partial_update_entity_attribute_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + name: name.into(), + body: body.into(), + } + } + pub fn delete_by_guid(&self, guid: impl Into) -> delete_by_guid::Builder { + delete_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_classification(&self, guid: impl Into, classification_name: impl Into) -> get_classification::Builder { + get_classification::Builder { + client: self.0.clone(), + guid: guid.into(), + classification_name: classification_name.into(), + } + } + pub fn delete_classification( + &self, + guid: impl Into, + classification_name: impl Into, + ) -> delete_classification::Builder { + delete_classification::Builder { + client: self.0.clone(), + guid: guid.into(), + classification_name: classification_name.into(), + } + } + pub fn get_classifications(&self, guid: impl Into) -> get_classifications::Builder { + get_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn add_classifications( + &self, + guid: impl Into, + classifications: impl Into>, + ) -> add_classifications::Builder { + add_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + classifications: classifications.into(), + } + } + pub fn update_classifications( + &self, + guid: impl Into, + classifications: impl Into>, + ) -> update_classifications::Builder { + update_classifications::Builder { + client: self.0.clone(), + guid: guid.into(), + classifications: classifications.into(), + } + } + pub fn get_by_unique_attributes(&self, type_name: impl Into) -> get_by_unique_attributes::Builder { + get_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + min_ext_info: None, + ignore_relationships: None, + attr_qualified_name: None, + } + } + pub fn partial_update_entity_by_unique_attributes( + &self, + type_name: impl Into, + atlas_entity_with_ext_info: impl Into, + ) -> partial_update_entity_by_unique_attributes::Builder { + partial_update_entity_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_entity_with_ext_info: atlas_entity_with_ext_info.into(), + attr_qualified_name: None, + } + } + pub fn delete_by_unique_attribute(&self, type_name: impl Into) -> delete_by_unique_attribute::Builder { + delete_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + attr_qualified_name: None, + } + } + pub fn delete_classification_by_unique_attribute( + &self, + type_name: impl Into, + classification_name: impl Into, + ) -> delete_classification_by_unique_attribute::Builder { + delete_classification_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + classification_name: classification_name.into(), + attr_qualified_name: None, + } + } + pub fn add_classifications_by_unique_attribute( + &self, + type_name: impl Into, + atlas_classification_array: impl Into>, + ) -> add_classifications_by_unique_attribute::Builder { + add_classifications_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_classification_array: atlas_classification_array.into(), + attr_qualified_name: None, + } + } + pub fn update_classifications_by_unique_attribute( + &self, + type_name: impl Into, + atlas_classification_array: impl Into>, + ) -> update_classifications_by_unique_attribute::Builder { + update_classifications_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + atlas_classification_array: atlas_classification_array.into(), + attr_qualified_name: None, + } + } + pub fn set_classifications(&self, entity_headers: impl Into) -> set_classifications::Builder { + set_classifications::Builder { + client: self.0.clone(), + entity_headers: entity_headers.into(), + } + } + pub fn get_entities_by_unique_attributes(&self, type_name: impl Into) -> get_entities_by_unique_attributes::Builder { + get_entities_by_unique_attributes::Builder { + client: self.0.clone(), + type_name: type_name.into(), + min_ext_info: None, + ignore_relationships: None, + attr_n_qualified_name: None, + } + } + pub fn get_header(&self, guid: impl Into) -> get_header::Builder { + get_header::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn add_or_update_business_metadata(&self, guid: impl Into) -> add_or_update_business_metadata::Builder { + add_or_update_business_metadata::Builder { + client: self.0.clone(), + guid: guid.into(), + is_overwrite: None, + body: None, + } + } + pub fn delete_business_metadata(&self, guid: impl Into) -> delete_business_metadata::Builder { + delete_business_metadata::Builder { + client: self.0.clone(), + guid: guid.into(), + body: None, + } + } + pub fn add_or_update_business_attributes( + &self, + bm_name: impl Into, + guid: impl Into, + ) -> add_or_update_business_attributes::Builder { + add_or_update_business_attributes::Builder { + client: self.0.clone(), + bm_name: bm_name.into(), + guid: guid.into(), + body: None, + } + } + pub fn delete_business_attributes( + &self, + bm_name: impl Into, + guid: impl Into, + ) -> delete_business_attributes::Builder { + delete_business_attributes::Builder { + client: self.0.clone(), + bm_name: bm_name.into(), + guid: guid.into(), + body: None, + } + } + pub fn get_sample_business_metadata_template(&self) -> get_sample_business_metadata_template::Builder { + get_sample_business_metadata_template::Builder { client: self.0.clone() } + } + pub fn import_business_attributes(&self) -> import_business_attributes::Builder { + import_business_attributes::Builder { + client: self.0.clone(), + uploaded_input_stream: None, + } + } + pub fn set_labels(&self, guid: impl Into) -> set_labels::Builder { + set_labels::Builder { + client: self.0.clone(), + guid: guid.into(), + body: None, + } + } + pub fn add_label(&self, guid: impl Into) -> add_label::Builder { + add_label::Builder { + client: self.0.clone(), + guid: guid.into(), + body: None, + } + } + pub fn delete_labels(&self, guid: impl Into) -> delete_labels::Builder { + delete_labels::Builder { + client: self.0.clone(), + guid: guid.into(), + body: None, + } + } + pub fn set_labels_by_unique_attribute(&self, type_name: impl Into) -> set_labels_by_unique_attribute::Builder { + set_labels_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + attr_qualified_name: None, + body: None, + } + } + pub fn add_labels_by_unique_attribute(&self, type_name: impl Into) -> add_labels_by_unique_attribute::Builder { + add_labels_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + attr_qualified_name: None, + body: None, + } + } + pub fn delete_labels_by_unique_attribute(&self, type_name: impl Into) -> delete_labels_by_unique_attribute::Builder { + delete_labels_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + attr_qualified_name: None, + body: None, + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entity: models::AtlasEntityWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_by_guids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: Vec, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) exclude_relationship_types: Vec, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn exclude_relationship_types(mut self, exclude_relationship_types: Vec) -> Self { + self.exclude_relationship_types = exclude_relationship_types; + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let guid = &self.guid; + for value in &self.guid { + url.query_pairs_mut().append_pair("guid", &value.to_string()); + } + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + let exclude_relationship_types = &self.exclude_relationship_types; + for value in &self.exclude_relationship_types { + url.query_pairs_mut().append_pair("excludeRelationshipTypes", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntitiesWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entities: models::AtlasEntitiesWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entities).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_guids { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let guid = &self.guid; + for value in &self.guid { + url.query_pairs_mut().append_pair("guid", &value.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::ClassificationAssociateRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk/classification", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_entity_attribute_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) name: String, + pub(crate) body: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let name = &self.name; + url.query_pairs_mut().append_pair("name", name); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/classification/{}", + self.client.endpoint(), + &self.guid, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassification = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_classification { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classification_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/classification/{}", + self.client.endpoint(), + &self.guid, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassifications = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classifications: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.classifications).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) classifications: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/classifications", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.classifications).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_entity_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_entity_with_ext_info: models::AtlasEntityWithExtInfo, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_entity_with_ext_info).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_classification_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) classification_name: String, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classification/{}", + self.client.endpoint(), + &self.type_name, + &self.classification_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_classifications_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_classification_array: Vec, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classifications", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_classification_array).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_classifications_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) atlas_classification_array: Vec, + pub(crate) attr_qualified_name: Option, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/classifications", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_classification_array).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod set_classifications { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) entity_headers: models::AtlasEntityHeaders, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/bulk/setClassifications", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity_headers).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entities_by_unique_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) min_ext_info: Option, + pub(crate) ignore_relationships: Option, + pub(crate) attr_n_qualified_name: Option, + } + impl Builder { + pub fn min_ext_info(mut self, min_ext_info: bool) -> Self { + self.min_ext_info = Some(min_ext_info); + self + } + pub fn ignore_relationships(mut self, ignore_relationships: bool) -> Self { + self.ignore_relationships = Some(ignore_relationships); + self + } + pub fn attr_n_qualified_name(mut self, attr_n_qualified_name: impl Into) -> Self { + self.attr_n_qualified_name = Some(attr_n_qualified_name.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/bulk/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(min_ext_info) = &self.min_ext_info { + url.query_pairs_mut().append_pair("minExtInfo", &min_ext_info.to_string()); + } + if let Some(ignore_relationships) = &self.ignore_relationships { + url.query_pairs_mut() + .append_pair("ignoreRelationships", &ignore_relationships.to_string()); + } + if let Some(attr_n_qualified_name) = &self.attr_n_qualified_name { + url.query_pairs_mut().append_pair("attr_N:qualifiedName", attr_n_qualified_name); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntitiesWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_header { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/header", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityHeader = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_or_update_business_metadata { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) is_overwrite: Option, + pub(crate) body: Option, + } + impl Builder { + pub fn is_overwrite(mut self, is_overwrite: bool) -> Self { + self.is_overwrite = Some(is_overwrite); + self + } + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/businessmetadata", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(is_overwrite) = &self.is_overwrite { + url.query_pairs_mut().append_pair("isOverwrite", &is_overwrite.to_string()); + } + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_business_metadata { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/businessmetadata", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod add_or_update_business_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) bm_name: String, + pub(crate) guid: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/businessmetadata/{}", + self.client.endpoint(), + &self.guid, + &self.bm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_business_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) bm_name: String, + pub(crate) guid: String, + pub(crate) body: Option, + } + impl Builder { + pub fn body(mut self, body: impl Into) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/guid/{}/businessmetadata/{}", + self.client.endpoint(), + &self.guid, + &self.bm_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_sample_business_metadata_template { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/businessmetadata/import/template", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value = rsp_body; + Ok(rsp_value) + } + http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod import_business_attributes { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("Error response #response_type")] + Conflict409 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) uploaded_input_stream: Option, + } + impl Builder { + pub fn uploaded_input_stream(mut self, uploaded_input_stream: impl Into) -> Self { + self.uploaded_input_stream = Some(uploaded_input_stream.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/businessmetadata/import", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + unimplemented!("form data not yet supported"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BulkImportResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), + http::StatusCode::CONFLICT => Err(Error::Conflict409 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod set_labels { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) body: Option>, + } + impl Builder { + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/labels", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod add_label { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) body: Option>, + } + impl Builder { + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/labels", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_labels { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) body: Option>, + } + impl Builder { + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/entity/guid/{}/labels", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod set_labels_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) attr_qualified_name: Option, + pub(crate) body: Option>, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/labels", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod add_labels_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) attr_qualified_name: Option, + pub(crate) body: Option>, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/labels", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod delete_labels_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) attr_qualified_name: Option, + pub(crate) body: Option>, + } + impl Builder { + pub fn attr_qualified_name(mut self, attr_qualified_name: impl Into) -> Self { + self.attr_qualified_name = Some(attr_qualified_name.into()); + self + } + pub fn body(mut self, body: impl Into>) -> Self { + self.body = Some(body.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/entity/uniqueAttribute/type/{}/labels", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(attr_qualified_name) = &self.attr_qualified_name { + url.query_pairs_mut().append_pair("attr:qualifiedName", attr_qualified_name); + } + let req_body = if let Some(body) = &self.body { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(body).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod glossary { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_glossaries(&self) -> list_glossaries::Builder { + list_glossaries::Builder { + client: self.0.clone(), + limit: None, + offset: None, + sort: None, + ignore_terms_and_categories: None, + } + } + pub fn create_glossary(&self, atlas_glossary: impl Into) -> create_glossary::Builder { + create_glossary::Builder { + client: self.0.clone(), + atlas_glossary: atlas_glossary.into(), + } + } + pub fn create_glossary_categories( + &self, + glossary_category: impl Into>, + ) -> create_glossary_categories::Builder { + create_glossary_categories::Builder { + client: self.0.clone(), + glossary_category: glossary_category.into(), + } + } + pub fn create_glossary_category( + &self, + glossary_category: impl Into, + ) -> create_glossary_category::Builder { + create_glossary_category::Builder { + client: self.0.clone(), + glossary_category: glossary_category.into(), + } + } + pub fn get_glossary_category(&self, category_guid: impl Into) -> get_glossary_category::Builder { + get_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + } + } + pub fn update_glossary_category( + &self, + category_guid: impl Into, + glossary_category: impl Into, + ) -> update_glossary_category::Builder { + update_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + glossary_category: glossary_category.into(), + } + } + pub fn delete_glossary_category(&self, category_guid: impl Into) -> delete_glossary_category::Builder { + delete_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + } + } + pub fn partial_update_glossary_category( + &self, + category_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary_category::Builder { + partial_update_glossary_category::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + partial_updates: partial_updates.into(), + } + } + pub fn list_related_categories(&self, category_guid: impl Into) -> list_related_categories::Builder { + list_related_categories::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn list_category_terms(&self, category_guid: impl Into) -> list_category_terms::Builder { + list_category_terms::Builder { + client: self.0.clone(), + category_guid: category_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn create_glossary_term(&self, glossary_term: impl Into) -> create_glossary_term::Builder { + create_glossary_term::Builder { + client: self.0.clone(), + glossary_term: glossary_term.into(), + include_term_hierarchy: None, + } + } + pub fn get_glossary_term(&self, term_guid: impl Into) -> get_glossary_term::Builder { + get_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + include_term_hierarchy: None, + } + } + pub fn update_glossary_term( + &self, + term_guid: impl Into, + glossary_term: impl Into, + ) -> update_glossary_term::Builder { + update_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + glossary_term: glossary_term.into(), + } + } + pub fn delete_glossary_term(&self, term_guid: impl Into) -> delete_glossary_term::Builder { + delete_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + } + } + pub fn partial_update_glossary_term( + &self, + term_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary_term::Builder { + partial_update_glossary_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + partial_updates: partial_updates.into(), + include_term_hierarchy: None, + } + } + pub fn create_glossary_terms(&self, glossary_term: impl Into>) -> create_glossary_terms::Builder { + create_glossary_terms::Builder { + client: self.0.clone(), + glossary_term: glossary_term.into(), + include_term_hierarchy: None, + } + } + pub fn get_entities_assigned_with_term(&self, term_guid: impl Into) -> get_entities_assigned_with_term::Builder { + get_entities_assigned_with_term::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn assign_term_to_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> assign_term_to_entities::Builder { + assign_term_to_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn remove_term_assignment_from_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> remove_term_assignment_from_entities::Builder { + remove_term_assignment_from_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn delete_term_assignment_from_entities( + &self, + term_guid: impl Into, + related_object_ids: impl Into>, + ) -> delete_term_assignment_from_entities::Builder { + delete_term_assignment_from_entities::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + related_object_ids: related_object_ids.into(), + } + } + pub fn list_related_terms(&self, term_guid: impl Into) -> list_related_terms::Builder { + list_related_terms::Builder { + client: self.0.clone(), + term_guid: term_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn get_glossary(&self, glossary_guid: impl Into) -> get_glossary::Builder { + get_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + } + } + pub fn update_glossary( + &self, + glossary_guid: impl Into, + updated_glossary: impl Into, + ) -> update_glossary::Builder { + update_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + updated_glossary: updated_glossary.into(), + } + } + pub fn delete_glossary(&self, glossary_guid: impl Into) -> delete_glossary::Builder { + delete_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + } + } + pub fn list_glossary_categories(&self, glossary_guid: impl Into) -> list_glossary_categories::Builder { + list_glossary_categories::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn list_glossary_categories_headers(&self, glossary_guid: impl Into) -> list_glossary_categories_headers::Builder { + list_glossary_categories_headers::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn get_detailed_glossary(&self, glossary_guid: impl Into) -> get_detailed_glossary::Builder { + get_detailed_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + include_term_hierarchy: None, + } + } + pub fn partial_update_glossary( + &self, + glossary_guid: impl Into, + partial_updates: impl Into, + ) -> partial_update_glossary::Builder { + partial_update_glossary::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + partial_updates: partial_updates.into(), + include_term_hierarchy: None, + } + } + pub fn list_glossary_terms(&self, glossary_guid: impl Into) -> list_glossary_terms::Builder { + list_glossary_terms::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + include_term_hierarchy: None, + limit: None, + offset: None, + sort: None, + } + } + pub fn list_glossary_term_headers(&self, glossary_guid: impl Into) -> list_glossary_term_headers::Builder { + list_glossary_term_headers::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + limit: None, + offset: None, + sort: None, + } + } + pub fn import_glossary_terms_via_csv( + &self, + glossary_guid: impl Into, + file: impl Into, + ) -> import_glossary_terms_via_csv::Builder { + import_glossary_terms_via_csv::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + file: file.into(), + include_term_hierarchy: None, + } + } + pub fn import_glossary_terms_via_csv_by_glossary_name( + &self, + glossary_name: impl Into, + file: impl Into, + ) -> import_glossary_terms_via_csv_by_glossary_name::Builder { + import_glossary_terms_via_csv_by_glossary_name::Builder { + client: self.0.clone(), + glossary_name: glossary_name.into(), + file: file.into(), + include_term_hierarchy: None, + } + } + pub fn get_import_csv_operation_status(&self, operation_guid: impl Into) -> get_import_csv_operation_status::Builder { + get_import_csv_operation_status::Builder { + client: self.0.clone(), + operation_guid: operation_guid.into(), + } + } + pub fn export_glossary_terms_as_csv( + &self, + glossary_guid: impl Into, + term_guids: impl Into>, + ) -> export_glossary_terms_as_csv::Builder { + export_glossary_terms_as_csv::Builder { + client: self.0.clone(), + glossary_guid: glossary_guid.into(), + term_guids: term_guids.into(), + include_term_hierarchy: None, + } + } + pub fn list_terms_by_glossary_name(&self, glossary_name: impl Into) -> list_terms_by_glossary_name::Builder { + list_terms_by_glossary_name::Builder { + client: self.0.clone(), + glossary_name: glossary_name.into(), + limit: None, + offset: None, + include_term_hierarchy: None, + } + } + } + pub mod list_glossaries { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + pub(crate) ignore_terms_and_categories: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn ignore_terms_and_categories(mut self, ignore_terms_and_categories: bool) -> Self { + self.ignore_terms_and_categories = Some(ignore_terms_and_categories); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + if let Some(ignore_terms_and_categories) = &self.ignore_terms_and_categories { + url.query_pairs_mut() + .append_pair("ignoreTermsAndCategories", &ignore_terms_and_categories.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) atlas_glossary: models::AtlasGlossary, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.atlas_glossary).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_category: Vec, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/categories", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_category: models::AtlasGlossaryCategory, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) glossary_category: models::AtlasGlossaryCategory, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_category).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/category/{}", self.client.endpoint(), &self.category_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary_category { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) partial_updates: serde_json::Value, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/partial", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryCategory = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_related_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/related", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: serde_json::Value = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_category_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) category_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/category/{}/terms", + self.client.endpoint(), + &self.category_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_term: models::AtlasGlossaryTerm, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) glossary_term: models::AtlasGlossaryTerm, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) partial_updates: serde_json::Value, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/term/{}/partial", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryTerm = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_glossary_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_term: Vec, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/terms", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.glossary_term).map_err(Error::Serialize)?; + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entities_assigned_with_term { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod assign_term_to_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod remove_term_assignment_from_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_term_assignment_from_entities { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) related_object_ids: Vec, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/terms/{}/assignedEntities", + self.client.endpoint(), + &self.term_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.related_object_ids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_related_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) term_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/terms/{}/related", self.client.endpoint(), &self.term_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: serde_json::Value = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) updated_glossary: models::AtlasGlossary, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.updated_glossary).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_categories { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/categories", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_categories_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/glossary/{}/categories/headers", + self.client.endpoint(), + &self.glossary_guid + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_detailed_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/detailed", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossaryExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod partial_update_glossary { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) partial_updates: serde_json::Value, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/partial", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.partial_updates).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasGlossary = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_terms { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) include_term_hierarchy: Option, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/terms", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_glossary_term_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) sort: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn sort(mut self, sort: impl Into) -> Self { + self.sort = Some(sort.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/glossary/{}/terms/headers", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(sort) = &self.sort { + url.query_pairs_mut().append_pair("sort", sort); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod import_glossary_terms_via_csv { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) file: bytes::Bytes, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/{}/terms/import", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + unimplemented!("form data not yet supported"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod import_glossary_terms_via_csv_by_glossary_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_name: String, + pub(crate) file: bytes::Bytes, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/name/{}/terms/import", self.client.endpoint(), &self.glossary_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + unimplemented!("form data not yet supported"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_import_csv_operation_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) operation_guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/terms/import/{}", self.client.endpoint(), &self.operation_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ImportCsvOperation = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod export_glossary_terms_as_csv { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_guid: String, + pub(crate) term_guids: Vec, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/glossary/{}/terms/export", self.client.endpoint(), &self.glossary_guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.term_guids).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value = rsp_body; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_terms_by_glossary_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) glossary_name: String, + pub(crate) limit: Option, + pub(crate) offset: Option, + pub(crate) include_term_hierarchy: Option, + } + impl Builder { + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn include_term_hierarchy(mut self, include_term_hierarchy: bool) -> Self { + self.include_term_hierarchy = Some(include_term_hierarchy); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/glossary/name/{}/terms", self.client.endpoint(), &self.glossary_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(include_term_hierarchy) = &self.include_term_hierarchy { + url.query_pairs_mut() + .append_pair("includeTermHierarchy", &include_term_hierarchy.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod discovery { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn query(&self, search_request: impl Into) -> query::Builder { + query::Builder { + client: self.0.clone(), + search_request: search_request.into(), + } + } + pub fn suggest(&self, suggest_request: impl Into) -> suggest::Builder { + suggest::Builder { + client: self.0.clone(), + suggest_request: suggest_request.into(), + } + } + pub fn browse(&self, browse_request: impl Into) -> browse::Builder { + browse::Builder { + client: self.0.clone(), + browse_request: browse_request.into(), + } + } + pub fn auto_complete(&self, auto_complete_request: impl Into) -> auto_complete::Builder { + auto_complete::Builder { + client: self.0.clone(), + auto_complete_request: auto_complete_request.into(), + } + } + } + pub mod query { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) search_request: models::SearchRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/query", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.search_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SearchResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod suggest { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) suggest_request: models::SuggestRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/suggest", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.suggest_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SuggestResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod browse { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) browse_request: models::BrowseRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/browse", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.browse_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BrowseResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod auto_complete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) auto_complete_request: models::AutoCompleteRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/search/autocomplete", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.auto_complete_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AutoCompleteResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod lineage { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_lineage_graph(&self, guid: impl Into, direction: impl Into) -> get_lineage_graph::Builder { + get_lineage_graph::Builder { + client: self.0.clone(), + guid: guid.into(), + direction: direction.into(), + depth: None, + width: None, + include_parent: None, + get_derived_lineage: None, + } + } + pub fn next_page_lineage(&self, guid: impl Into, direction: impl Into) -> next_page_lineage::Builder { + next_page_lineage::Builder { + client: self.0.clone(), + guid: guid.into(), + direction: direction.into(), + get_derived_lineage: None, + offset: None, + limit: None, + } + } + pub fn get_lineage_by_unique_attribute( + &self, + type_name: impl Into, + direction: impl Into, + ) -> get_lineage_by_unique_attribute::Builder { + get_lineage_by_unique_attribute::Builder { + client: self.0.clone(), + type_name: type_name.into(), + direction: direction.into(), + depth: None, + width: None, + include_parent: None, + get_derived_lineage: None, + } + } + } + pub mod get_lineage_graph { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) direction: String, + pub(crate) depth: Option, + pub(crate) width: Option, + pub(crate) include_parent: Option, + pub(crate) get_derived_lineage: Option, + } + impl Builder { + pub fn depth(mut self, depth: i32) -> Self { + self.depth = Some(depth); + self + } + pub fn width(mut self, width: i32) -> Self { + self.width = Some(width); + self + } + pub fn include_parent(mut self, include_parent: bool) -> Self { + self.include_parent = Some(include_parent); + self + } + pub fn get_derived_lineage(mut self, get_derived_lineage: bool) -> Self { + self.get_derived_lineage = Some(get_derived_lineage); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/lineage/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(depth) = &self.depth { + url.query_pairs_mut().append_pair("depth", &depth.to_string()); + } + if let Some(width) = &self.width { + url.query_pairs_mut().append_pair("width", &width.to_string()); + } + let direction = &self.direction; + url.query_pairs_mut().append_pair("direction", direction); + if let Some(include_parent) = &self.include_parent { + url.query_pairs_mut().append_pair("includeParent", &include_parent.to_string()); + } + if let Some(get_derived_lineage) = &self.get_derived_lineage { + url.query_pairs_mut() + .append_pair("getDerivedLineage", &get_derived_lineage.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasLineageInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod next_page_lineage { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) direction: String, + pub(crate) get_derived_lineage: Option, + pub(crate) offset: Option, + pub(crate) limit: Option, + } + impl Builder { + pub fn get_derived_lineage(mut self, get_derived_lineage: bool) -> Self { + self.get_derived_lineage = Some(get_derived_lineage); + self + } + pub fn offset(mut self, offset: i32) -> Self { + self.offset = Some(offset); + self + } + pub fn limit(mut self, limit: i32) -> Self { + self.limit = Some(limit); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/lineage/{}/next/", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + let direction = &self.direction; + url.query_pairs_mut().append_pair("direction", direction); + if let Some(get_derived_lineage) = &self.get_derived_lineage { + url.query_pairs_mut() + .append_pair("getDerivedLineage", &get_derived_lineage.to_string()); + } + if let Some(offset) = &self.offset { + url.query_pairs_mut().append_pair("offset", &offset.to_string()); + } + if let Some(limit) = &self.limit { + url.query_pairs_mut().append_pair("limit", &limit.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasLineageInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_lineage_by_unique_attribute { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + BadRequest400 {}, + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) type_name: String, + pub(crate) direction: String, + pub(crate) depth: Option, + pub(crate) width: Option, + pub(crate) include_parent: Option, + pub(crate) get_derived_lineage: Option, + } + impl Builder { + pub fn depth(mut self, depth: i32) -> Self { + self.depth = Some(depth); + self + } + pub fn width(mut self, width: i32) -> Self { + self.width = Some(width); + self + } + pub fn include_parent(mut self, include_parent: bool) -> Self { + self.include_parent = Some(include_parent); + self + } + pub fn get_derived_lineage(mut self, get_derived_lineage: bool) -> Self { + self.get_derived_lineage = Some(get_derived_lineage); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/atlas/v2/lineage/uniqueAttribute/type/{}", + self.client.endpoint(), + &self.type_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(depth) = &self.depth { + url.query_pairs_mut().append_pair("depth", &depth.to_string()); + } + if let Some(width) = &self.width { + url.query_pairs_mut().append_pair("width", &width.to_string()); + } + let direction = &self.direction; + url.query_pairs_mut().append_pair("direction", direction); + if let Some(include_parent) = &self.include_parent { + url.query_pairs_mut().append_pair("includeParent", &include_parent.to_string()); + } + if let Some(get_derived_lineage) = &self.get_derived_lineage { + url.query_pairs_mut() + .append_pair("getDerivedLineage", &get_derived_lineage.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasLineageInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::BAD_REQUEST => Err(Error::BadRequest400 {}), + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod relationship { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create(&self, relationship: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + relationship: relationship.into(), + } + } + pub fn update(&self, relationship: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + relationship: relationship.into(), + } + } + pub fn get(&self, guid: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + guid: guid.into(), + extended_info: None, + } + } + pub fn delete(&self, guid: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + } + pub mod create { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) relationship: models::AtlasRelationship, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.relationship).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) relationship: models::AtlasRelationship, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.relationship).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationship = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + pub(crate) extended_info: Option, + } + impl Builder { + pub fn extended_info(mut self, extended_info: bool) -> Self { + self.extended_info = Some(extended_info); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(extended_info) = &self.extended_info { + url.query_pairs_mut().append_pair("extendedInfo", &extended_info.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipWithExtInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/relationship/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod types { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_business_metadata_def_by_guid(&self, guid: impl Into) -> get_business_metadata_def_by_guid::Builder { + get_business_metadata_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_business_metadata_def_by_name(&self, name: impl Into) -> get_business_metadata_def_by_name::Builder { + get_business_metadata_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_classification_def_by_guid(&self, guid: impl Into) -> get_classification_def_by_guid::Builder { + get_classification_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_classification_def_by_name(&self, name: impl Into) -> get_classification_def_by_name::Builder { + get_classification_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_entity_definition_by_guid(&self, guid: impl Into) -> get_entity_definition_by_guid::Builder { + get_entity_definition_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_entity_definition_by_name(&self, name: impl Into) -> get_entity_definition_by_name::Builder { + get_entity_definition_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_enum_def_by_guid(&self, guid: impl Into) -> get_enum_def_by_guid::Builder { + get_enum_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_enum_def_by_name(&self, name: impl Into) -> get_enum_def_by_name::Builder { + get_enum_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_relationship_def_by_guid(&self, guid: impl Into) -> get_relationship_def_by_guid::Builder { + get_relationship_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_relationship_def_by_name(&self, name: impl Into) -> get_relationship_def_by_name::Builder { + get_relationship_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_struct_def_by_guid(&self, guid: impl Into) -> get_struct_def_by_guid::Builder { + get_struct_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_struct_def_by_name(&self, name: impl Into) -> get_struct_def_by_name::Builder { + get_struct_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_type_definition_by_guid(&self, guid: impl Into) -> get_type_definition_by_guid::Builder { + get_type_definition_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_type_definition_by_name(&self, name: impl Into) -> get_type_definition_by_name::Builder { + get_type_definition_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn delete_type_by_name(&self, name: impl Into) -> delete_type_by_name::Builder { + delete_type_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + pub fn get_all_type_definitions(&self) -> get_all_type_definitions::Builder { + get_all_type_definitions::Builder { + client: self.0.clone(), + include_term_template: None, + type_: None, + } + } + pub fn create_type_definitions(&self, types_def: impl Into) -> create_type_definitions::Builder { + create_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn update_atlas_type_definitions(&self, types_def: impl Into) -> update_atlas_type_definitions::Builder { + update_atlas_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn delete_type_definitions(&self, types_def: impl Into) -> delete_type_definitions::Builder { + delete_type_definitions::Builder { + client: self.0.clone(), + types_def: types_def.into(), + } + } + pub fn list_type_definition_headers(&self) -> list_type_definition_headers::Builder { + list_type_definition_headers::Builder { + client: self.0.clone(), + include_term_template: None, + type_: None, + } + } + pub fn get_term_template_def_by_guid(&self, guid: impl Into) -> get_term_template_def_by_guid::Builder { + get_term_template_def_by_guid::Builder { + client: self.0.clone(), + guid: guid.into(), + } + } + pub fn get_term_template_def_by_name(&self, name: impl Into) -> get_term_template_def_by_name::Builder { + get_term_template_def_by_name::Builder { + client: self.0.clone(), + name: name.into(), + } + } + } + pub mod get_business_metadata_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/businessmetadatadef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasBusinessMetadataDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_business_metadata_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/businessmetadatadef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasBusinessMetadataDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_FOUND => Err(Error::NotFound404 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } + pub mod get_classification_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/classificationdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassificationDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_classification_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/classificationdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasClassificationDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_definition_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/entitydef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_entity_definition_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/entitydef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEntityDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_enum_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/enumdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEnumDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_enum_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/enumdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasEnumDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_relationship_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/relationshipdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_relationship_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/relationshipdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasRelationshipDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_struct_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/structdef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasStructDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_struct_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/structdef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasStructDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_type_definition_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypeDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_type_definition_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypeDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_type_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_all_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) include_term_template: Option, + pub(crate) type_: Option, + } + impl Builder { + pub fn include_term_template(mut self, include_term_template: bool) -> Self { + self.include_term_template = Some(include_term_template); + self + } + pub fn type_(mut self, type_: impl Into) -> Self { + self.type_ = Some(type_.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_template) = &self.include_term_template { + url.query_pairs_mut() + .append_pair("includeTermTemplate", &include_term_template.to_string()); + } + if let Some(type_) = &self.type_ { + url.query_pairs_mut().append_pair("type", type_); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_atlas_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AtlasTypesDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_type_definitions { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) types_def: models::AtlasTypesDef, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.types_def).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_type_definition_headers { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) include_term_template: Option, + pub(crate) type_: Option, + } + impl Builder { + pub fn include_term_template(mut self, include_term_template: bool) -> Self { + self.include_term_template = Some(include_term_template); + self + } + pub fn type_(mut self, type_: impl Into) -> Self { + self.type_ = Some(type_.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result, Error>> { + Box::pin(async move { + let url_str = &format!("{}/atlas/v2/types/typedefs/headers", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + if let Some(include_term_template) = &self.include_term_template { + url.query_pairs_mut() + .append_pair("includeTermTemplate", &include_term_template.to_string()); + } + if let Some(type_) = &self.type_ { + url.query_pairs_mut().append_pair("type", type_); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: Vec = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_term_template_def_by_guid { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) guid: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/types/termtemplatedef/guid/{}", self.client.endpoint(), &self.guid); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TermTemplateDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_term_template_def_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/types/termtemplatedef/name/{}", self.client.endpoint(), &self.name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TermTemplateDef = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod collection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_or_update( + &self, + collection: impl Into, + entity: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + collection: collection.into(), + entity: entity.into(), + } + } + pub fn create_or_update_bulk( + &self, + collection: impl Into, + entities: impl Into, + ) -> create_or_update_bulk::Builder { + create_or_update_bulk::Builder { + client: self.0.clone(), + collection: collection.into(), + entities: entities.into(), + } + } + pub fn move_entities_to_collection( + &self, + collection: impl Into, + move_entities_request: impl Into, + ) -> move_entities_to_collection::Builder { + move_entities_to_collection::Builder { + client: self.0.clone(), + collection: collection.into(), + move_entities_request: move_entities_request.into(), + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) entity: models::AtlasEntityWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entity).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_bulk { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) entities: models::AtlasEntitiesWithExtInfo, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity/bulk", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.entities).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod move_entities_to_collection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) collection: String, + pub(crate) move_entities_request: models::MoveEntitiesRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/collections/{}/entity/moveHere", self.client.endpoint(), &self.collection); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2022-03-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.move_entities_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::EntityMutationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/quantum/Cargo.toml b/services/svc/quantum/Cargo.toml index d7ae7ce615..05f39f12ab 100644 --- a/services/svc/quantum/Cargo.toml +++ b/services/svc/quantum/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_quantum" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/queuestorage/Cargo.toml b/services/svc/queuestorage/Cargo.toml index 88f024e307..5b03b7ae2e 100644 --- a/services/svc/queuestorage/Cargo.toml +++ b/services/svc/queuestorage/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_queuestorage" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/schemaregistry/Cargo.toml b/services/svc/schemaregistry/Cargo.toml index 1592db1f8f..15bee64cd6 100644 --- a/services/svc/schemaregistry/Cargo.toml +++ b/services/svc/schemaregistry/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_schemaregistry" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/servicefabric/Cargo.toml b/services/svc/servicefabric/Cargo.toml index b362122873..cf831e7077 100644 --- a/services/svc/servicefabric/Cargo.toml +++ b/services/svc/servicefabric/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_servicefabric" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/storagedatalake/Cargo.toml b/services/svc/storagedatalake/Cargo.toml index 79ac9d4ed5..df2d91094a 100644 --- a/services/svc/storagedatalake/Cargo.toml +++ b/services/svc/storagedatalake/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_storagedatalake" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/synapse/Cargo.toml b/services/svc/synapse/Cargo.toml index a515d8fcb7..63f42e4cf3 100644 --- a/services/svc/synapse/Cargo.toml +++ b/services/svc/synapse/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_synapse" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" @@ -24,13 +24,14 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1" } tokio = { version = "1.0", features = ["macros"] } [package.metadata.docs.rs] -features = ["no-default-tag", "package-artifacts-composite-v2", "package-artifacts-composite-v1", "package-artifacts-2021-06-01-preview", "package-vnet-2021-06-01-preview"] +features = ["no-default-tag", "package-artifacts-composite-v3", "package-artifacts-composite-v2", "package-artifacts-composite-v1", "package-artifacts-2021-06-01-preview"] [features] -default = ["package-artifacts-composite-v3", "enable_reqwest"] +default = ["package-artifacts-composite-v4", "enable_reqwest"] enable_reqwest = ["azure_core/enable_reqwest"] enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"] no-default-tag = [] +"package-artifacts-composite-v4" = [] "package-artifacts-composite-v3" = [] "package-artifacts-composite-v2" = [] "package-artifacts-composite-v1" = [] diff --git a/services/svc/synapse/README.md b/services/svc/synapse/README.md index c91c51bc01..13fa4ad359 100644 --- a/services/svc/synapse/README.md +++ b/services/svc/synapse/README.md @@ -6,10 +6,11 @@ https://github.com/Azure/azure-rest-api-specs/blob/main/specification/synapse/da To get started with these generated service crates, see the [examples](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/README.md#examples). -The default tag is `package-artifacts-composite-v3`. +The default tag is `package-artifacts-composite-v4`. The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available: +- `package-artifacts-composite-v4` has 101 operations from 6 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-07-01-preview`, `2021-11-01-preview`, `2021-12-01-preview`. Use crate feature `package-artifacts-composite-v4` to enable. The operations will be in the `package_artifacts_composite_v4` module. - `package-artifacts-composite-v3` has 90 operations from 5 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-07-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v3` to enable. The operations will be in the `package_artifacts_composite_v3` module. - `package-artifacts-composite-v2` has 86 operations from 4 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`, `2021-11-01-preview`. Use crate feature `package-artifacts-composite-v2` to enable. The operations will be in the `package_artifacts_composite_v2` module. - `package-artifacts-composite-v1` has 86 operations from 3 API versions: `2019-06-01-preview`, `2020-12-01`, `2021-06-01-preview`. Use crate feature `package-artifacts-composite-v1` to enable. The operations will be in the `package_artifacts_composite_v1` module. diff --git a/services/svc/synapse/src/lib.rs b/services/svc/synapse/src/lib.rs index de6b8df114..ca9f6e23ef 100644 --- a/services/svc/synapse/src/lib.rs +++ b/services/svc/synapse/src/lib.rs @@ -3,6 +3,10 @@ #![allow(clippy::ptr_arg)] #![allow(clippy::large_enum_variant)] #![doc = "generated by AutoRust"] +#[cfg(feature = "package-artifacts-composite-v4")] +pub mod package_artifacts_composite_v4; +#[cfg(all(feature = "package-artifacts-composite-v4", not(feature = "no-default-tag")))] +pub use package_artifacts_composite_v4::{models, operations, operations::Client, operations::ClientBuilder, operations::Error}; #[cfg(feature = "package-artifacts-composite-v3")] pub mod package_artifacts_composite_v3; #[cfg(all(feature = "package-artifacts-composite-v3", not(feature = "no-default-tag")))] diff --git a/services/svc/synapse/src/package_artifacts_2020_12_01/models.rs b/services/svc/synapse/src/package_artifacts_2020_12_01/models.rs index f6d5d276fc..d30b780137 100644 --- a/services/svc/synapse/src/package_artifacts_2020_12_01/models.rs +++ b/services/svc/synapse/src/package_artifacts_2020_12_01/models.rs @@ -791,6 +791,44 @@ impl AmazonS3ReadSettings { } } } +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} #[doc = "Append value for a Variable of type Array."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AppendVariableActivity { @@ -835,6 +873,41 @@ impl ArtifactRenameRequest { Self::default() } } +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct AutoPauseProperties { @@ -6059,6 +6132,41 @@ impl DatasetStorageFormat { } } } +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "The days of the week."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum DayOfWeek { @@ -7575,6 +7683,37 @@ pub mod expression { Expression, } } +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} #[doc = "File system linked service."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileServerLinkedService { @@ -19552,6 +19691,37 @@ impl TumblingWindowTriggerDependencyReference { } } } +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} #[doc = "Type conversion settings"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct TypeConversionSettings { diff --git a/services/svc/synapse/src/package_artifacts_2021_06_01_preview/models.rs b/services/svc/synapse/src/package_artifacts_2021_06_01_preview/models.rs index 4cc61538fd..96a7f44fc8 100644 --- a/services/svc/synapse/src/package_artifacts_2021_06_01_preview/models.rs +++ b/services/svc/synapse/src/package_artifacts_2021_06_01_preview/models.rs @@ -7548,6 +7548,37 @@ pub mod expression { Expression, } } +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} #[doc = "File system linked service."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileServerLinkedService { @@ -12435,9 +12466,9 @@ pub struct OperationResult { #[doc = "Operation status"] #[serde(default, skip_serializing_if = "Option::is_none")] pub status: Option, - #[doc = "The object that defines the structure of an Azure Synapse error."] + #[doc = "The object that defines the structure of an Azure Synapse error response."] #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, + pub error: Option, } impl OperationResult { pub fn new() -> Self { diff --git a/services/svc/synapse/src/package_artifacts_composite_v1/models.rs b/services/svc/synapse/src/package_artifacts_composite_v1/models.rs index a57c17958e..eef0e731d3 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v1/models.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v1/models.rs @@ -791,6 +791,44 @@ impl AmazonS3ReadSettings { } } } +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} #[doc = "Append value for a Variable of type Array."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AppendVariableActivity { @@ -835,6 +873,41 @@ impl ArtifactRenameRequest { Self::default() } } +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct AutoPauseProperties { @@ -6059,6 +6132,41 @@ impl DatasetStorageFormat { } } } +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "The days of the week."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum DayOfWeek { @@ -7575,6 +7683,37 @@ pub mod expression { Expression, } } +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} #[doc = "File system linked service."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileServerLinkedService { @@ -19699,6 +19838,37 @@ impl TumblingWindowTriggerDependencyReference { } } } +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} #[doc = "Type conversion settings"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct TypeConversionSettings { diff --git a/services/svc/synapse/src/package_artifacts_composite_v2/models.rs b/services/svc/synapse/src/package_artifacts_composite_v2/models.rs index 483f95e144..32e59b8924 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v2/models.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v2/models.rs @@ -791,6 +791,44 @@ impl AmazonS3ReadSettings { } } } +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} #[doc = "Append value for a Variable of type Array."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AppendVariableActivity { @@ -835,6 +873,41 @@ impl ArtifactRenameRequest { Self::default() } } +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct AutoPauseProperties { @@ -6059,6 +6132,41 @@ impl DatasetStorageFormat { } } } +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "The days of the week."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum DayOfWeek { @@ -7575,6 +7683,37 @@ pub mod expression { Expression, } } +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} #[doc = "File system linked service."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileServerLinkedService { @@ -19703,6 +19842,37 @@ impl TumblingWindowTriggerDependencyReference { } } } +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} #[doc = "Type conversion settings"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct TypeConversionSettings { diff --git a/services/svc/synapse/src/package_artifacts_composite_v3/models.rs b/services/svc/synapse/src/package_artifacts_composite_v3/models.rs index ff77577b83..4120b60846 100644 --- a/services/svc/synapse/src/package_artifacts_composite_v3/models.rs +++ b/services/svc/synapse/src/package_artifacts_composite_v3/models.rs @@ -791,6 +791,44 @@ impl AmazonS3ReadSettings { } } } +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} #[doc = "Append value for a Variable of type Array."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AppendVariableActivity { @@ -835,6 +873,41 @@ impl ArtifactRenameRequest { Self::default() } } +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct AutoPauseProperties { @@ -6059,6 +6132,41 @@ impl DatasetStorageFormat { } } } +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} #[doc = "The days of the week."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum DayOfWeek { @@ -7575,6 +7683,37 @@ pub mod expression { Expression, } } +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} #[doc = "File system linked service."] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct FileServerLinkedService { @@ -19717,6 +19856,37 @@ impl TumblingWindowTriggerDependencyReference { } } } +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} #[doc = "Type conversion settings"] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] pub struct TypeConversionSettings { diff --git a/services/svc/synapse/src/package_artifacts_composite_v4/mod.rs b/services/svc/synapse/src/package_artifacts_composite_v4/mod.rs new file mode 100644 index 0000000000..44a2340323 --- /dev/null +++ b/services/svc/synapse/src/package_artifacts_composite_v4/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod operations; diff --git a/services/svc/synapse/src/package_artifacts_composite_v4/models.rs b/services/svc/synapse/src/package_artifacts_composite_v4/models.rs new file mode 100644 index 0000000000..fdb2ba2db0 --- /dev/null +++ b/services/svc/synapse/src/package_artifacts_composite_v4/models.rs @@ -0,0 +1,21390 @@ +#![doc = "generated by AutoRust"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[doc = "A pipeline activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Activity { + #[doc = "Activity name."] + pub name: String, + #[doc = "Type of activity."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Activity description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Activity depends on condition."] + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + #[doc = "Activity user properties."] + #[serde(rename = "userProperties", default, skip_serializing_if = "Vec::is_empty")] + pub user_properties: Vec, +} +impl Activity { + pub fn new(name: String, type_: String) -> Self { + Self { + name, + type_, + description: None, + depends_on: Vec::new(), + user_properties: Vec::new(), + } + } +} +#[doc = "Activity dependency information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityDependency { + #[doc = "Activity name."] + pub activity: String, + #[doc = "Match-Condition for the dependency."] + #[serde(rename = "dependencyConditions")] + pub dependency_conditions: Vec, +} +impl ActivityDependency { + pub fn new(activity: String, dependency_conditions: Vec) -> Self { + Self { + activity, + dependency_conditions, + } + } +} +#[doc = "Execution policy for an activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActivityPolicy { + #[doc = "Specifies the timeout for the activity to run. The default timeout is 7 days. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "Maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retry: Option, + #[doc = "Interval between each retry attempt (in seconds). The default is 30 sec."] + #[serde(rename = "retryIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub retry_interval_in_seconds: Option, + #[doc = "When set to true, Input from activity is considered as secure and will not be logged to monitoring."] + #[serde(rename = "secureInput", default, skip_serializing_if = "Option::is_none")] + pub secure_input: Option, + #[doc = "When set to true, Output from activity is considered as secure and will not be logged to monitoring."] + #[serde(rename = "secureOutput", default, skip_serializing_if = "Option::is_none")] + pub secure_output: Option, +} +impl ActivityPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Information about an activity run in a pipeline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ActivityRun { + #[doc = "The name of the pipeline."] + #[serde(rename = "pipelineName", default, skip_serializing_if = "Option::is_none")] + pub pipeline_name: Option, + #[doc = "The id of the pipeline run."] + #[serde(rename = "pipelineRunId", default, skip_serializing_if = "Option::is_none")] + pub pipeline_run_id: Option, + #[doc = "The name of the activity."] + #[serde(rename = "activityName", default, skip_serializing_if = "Option::is_none")] + pub activity_name: Option, + #[doc = "The type of the activity."] + #[serde(rename = "activityType", default, skip_serializing_if = "Option::is_none")] + pub activity_type: Option, + #[doc = "The id of the activity run."] + #[serde(rename = "activityRunId", default, skip_serializing_if = "Option::is_none")] + pub activity_run_id: Option, + #[doc = "The name of the compute linked service."] + #[serde(rename = "linkedServiceName", default, skip_serializing_if = "Option::is_none")] + pub linked_service_name: Option, + #[doc = "The status of the activity run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The start time of the activity run in 'ISO 8601' format."] + #[serde(rename = "activityRunStart", default, skip_serializing_if = "Option::is_none")] + pub activity_run_start: Option, + #[doc = "The end time of the activity run in 'ISO 8601' format."] + #[serde(rename = "activityRunEnd", default, skip_serializing_if = "Option::is_none")] + pub activity_run_end: Option, + #[doc = "The duration of the activity run."] + #[serde(rename = "durationInMs", default, skip_serializing_if = "Option::is_none")] + pub duration_in_ms: Option, + #[doc = "The input for the activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub input: Option, + #[doc = "The output for the activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output: Option, + #[doc = "The error if any from the activity run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ActivityRun { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list activity runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityRunsQueryResponse { + #[doc = "List of activity runs."] + pub value: Vec, + #[doc = "The continuation token for getting the next page of results, if any remaining results exist, null otherwise."] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, +} +impl ActivityRunsQueryResponse { + pub fn new(value: Vec) -> Self { + Self { + value, + continuation_token: None, + } + } +} +#[doc = "Response body structure for starting data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AddDataFlowToDebugSessionResponse { + #[doc = "The ID of data flow debug job version."] + #[serde(rename = "jobVersion", default, skip_serializing_if = "Option::is_none")] + pub job_version: Option, +} +impl AddDataFlowToDebugSessionResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Specify the column name and value of additional columns."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AdditionalColumns { + #[doc = "Additional column name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Additional column value. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl AdditionalColumns { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Amazon Marketplace Web Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonMwsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Amazon Marketplace Web Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonMwsLinkedServiceTypeProperties, +} +impl AmazonMwsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AmazonMwsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Amazon Marketplace Web Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonMwsLinkedServiceTypeProperties { + #[doc = "The endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com)"] + pub endpoint: serde_json::Value, + #[doc = "The Amazon Marketplace ID you want to retrieve data from. To retrieve data from multiple Marketplace IDs, separate them with a comma (,). (i.e. A2EUQ1WTGCTBG2)"] + #[serde(rename = "marketplaceID")] + pub marketplace_id: serde_json::Value, + #[doc = "The Amazon seller ID."] + #[serde(rename = "sellerID")] + pub seller_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "mwsAuthToken", default, skip_serializing_if = "Option::is_none")] + pub mws_auth_token: Option, + #[doc = "The access key id used to access data."] + #[serde(rename = "accessKeyId")] + pub access_key_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "secretKey", default, skip_serializing_if = "Option::is_none")] + pub secret_key: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AmazonMwsLinkedServiceTypeProperties { + pub fn new( + endpoint: serde_json::Value, + marketplace_id: serde_json::Value, + seller_id: serde_json::Value, + access_key_id: serde_json::Value, + ) -> Self { + Self { + endpoint, + marketplace_id, + seller_id, + mws_auth_token: None, + access_key_id, + secret_key: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Amazon Marketplace Web Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonMwsObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AmazonMwsObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Amazon Marketplace Web Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonMwsSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl AmazonMwsSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "AmazonRdsForOracle database linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AmazonRdsForLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "AmazonRdsForOracle database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForOracleLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AmazonRdsForOracle database linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonRdsForLinkedServiceTypeProperties, +} +impl AmazonRdsForOracleLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AmazonRdsForLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AmazonRdsForOraclePartitionOption { + None, + PhysicalPartitionsOfTable, + DynamicRange, +} +#[doc = "The settings that will be leveraged for AmazonRdsForOracle source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonRdsForOraclePartitionSettings { + #[doc = "Names of the physical partitions of AmazonRdsForOracle table. "] + #[serde(rename = "partitionNames", default, skip_serializing_if = "Option::is_none")] + pub partition_names: Option, + #[doc = "The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, +} +impl AmazonRdsForOraclePartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity AmazonRdsForOracle source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForOracleSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "AmazonRdsForOracle reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "oracleReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub oracle_reader_query: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "The partition mechanism that will be used for AmazonRdsForOracle read in parallel. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for AmazonRdsForOracle source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl AmazonRdsForOracleSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + oracle_reader_query: None, + query_timeout: None, + partition_option: None, + partition_settings: None, + additional_columns: None, + } + } +} +#[doc = "The AmazonRdsForOracle database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForOracleTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "AmazonRdsForOracle dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AmazonRdsForOracleTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "AmazonRdsForOracle dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonRdsForOracleTableDatasetTypeProperties { + #[doc = "The schema name of the AmazonRdsForOracle database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the AmazonRdsForOracle database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AmazonRdsForOracleTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Amazon RDS for SQL Server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForSqlServerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "SQL Server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonRdsForSqlServerLinkedServiceTypeProperties, +} +impl AmazonRdsForSqlServerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AmazonRdsForSqlServerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "SQL Server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForSqlServerLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The on-premises Windows authentication user name. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AmazonRdsForSqlServerLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Amazon RDS for SQL Server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForSqlServerSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "Which additional types to produce."] + #[serde(rename = "produceAdditionalTypes", default, skip_serializing_if = "Option::is_none")] + pub produce_additional_types: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl AmazonRdsForSqlServerSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + produce_additional_types: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "The Amazon RDS for SQL Server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRdsForSqlServerTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "The Amazon RDS for SQL Server dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AmazonRdsForSqlServerTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "The Amazon RDS for SQL Server dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonRdsForSqlServerTableDatasetTypeProperties { + #[doc = "The schema name of the SQL Server dataset. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the SQL Server dataset. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AmazonRdsForSqlServerTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for Amazon Redshift."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRedshiftLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Amazon Redshift linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonRedshiftLinkedServiceTypeProperties, +} +impl AmazonRedshiftLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AmazonRedshiftLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Amazon Redshift linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRedshiftLinkedServiceTypeProperties { + #[doc = "The name of the Amazon Redshift server. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "The username of the Amazon Redshift source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The database name of the Amazon Redshift source. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, + #[doc = "The TCP port number that the Amazon Redshift server uses to listen for client connections. The default value is 5439. Type: integer (or Expression with resultType integer)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AmazonRedshiftLinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, database: serde_json::Value) -> Self { + Self { + server, + username: None, + password: None, + database, + port: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for Amazon Redshift Source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRedshiftSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this, data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the interim S3."] + #[serde(rename = "redshiftUnloadSettings", default, skip_serializing_if = "Option::is_none")] + pub redshift_unload_settings: Option, +} +impl AmazonRedshiftSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + redshift_unload_settings: None, + } + } +} +#[doc = "The Amazon Redshift table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonRedshiftTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Amazon Redshift table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AmazonRedshiftTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Amazon Redshift table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonRedshiftTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The Amazon Redshift table name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The Amazon Redshift schema name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl AmazonRedshiftTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A single Amazon Simple Storage Service (S3) object or a set of S3 objects."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3Dataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Amazon S3 dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonS3DatasetTypeProperties, +} +impl AmazonS3Dataset { + pub fn new(dataset: Dataset, type_properties: AmazonS3DatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Amazon S3 dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3DatasetTypeProperties { + #[doc = "The name of the Amazon S3 bucket. Type: string (or Expression with resultType string)."] + #[serde(rename = "bucketName")] + pub bucket_name: serde_json::Value, + #[doc = "The key of the Amazon S3 object. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + #[doc = "The prefix filter for the S3 object name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "The version for the S3 object. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[doc = "The start of S3 object's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of S3 object's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl AmazonS3DatasetTypeProperties { + pub fn new(bucket_name: serde_json::Value) -> Self { + Self { + bucket_name, + key: None, + prefix: None, + version: None, + modified_datetime_start: None, + modified_datetime_end: None, + format: None, + compression: None, + } + } +} +#[doc = "Linked service for Amazon S3."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3LinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Amazon S3 linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AmazonS3LinkedServiceTypeProperties, +} +impl AmazonS3LinkedService { + pub fn new(linked_service: LinkedService, type_properties: AmazonS3LinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Amazon S3 linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AmazonS3LinkedServiceTypeProperties { + #[doc = "The authentication type of S3. Allowed value: AccessKey (default) or TemporarySecurityCredentials. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The access key identifier of the Amazon S3 Identity and Access Management (IAM) user. Type: string (or Expression with resultType string)."] + #[serde(rename = "accessKeyId", default, skip_serializing_if = "Option::is_none")] + pub access_key_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "secretAccessKey", default, skip_serializing_if = "Option::is_none")] + pub secret_access_key: Option, + #[doc = "This value specifies the endpoint to access with the S3 Connector. This is an optional property; change it only if you want to try a different service endpoint or want to switch between https and http. Type: string (or Expression with resultType string)."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "sessionToken", default, skip_serializing_if = "Option::is_none")] + pub session_token: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AmazonS3LinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location of amazon S3 dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3Location { + #[serde(flatten)] + pub dataset_location: DatasetLocation, + #[doc = "Specify the bucketName of amazon S3. Type: string (or Expression with resultType string)"] + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[doc = "Specify the version of amazon S3. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl AmazonS3Location { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { + dataset_location, + bucket_name: None, + version: None, + } + } +} +#[doc = "Azure data lake store read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AmazonS3ReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "AmazonS3 wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "AmazonS3 wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "The prefix filter for the S3 object name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl AmazonS3ReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + prefix: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "Linked service for AppFigures."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "AppFigures linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppFiguresLinkedServiceTypeProperties, +} +impl AppFiguresLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AppFiguresLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "AppFigures linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppFiguresLinkedServiceTypeProperties { + #[doc = "The username of the Appfigures source."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientKey")] + pub client_key: SecretBase, +} +impl AppFiguresLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase, client_key: SecretBase) -> Self { + Self { + user_name, + password, + client_key, + } + } +} +#[doc = "Append value for a Variable of type Array."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AppendVariableActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "AppendVariable activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AppendVariableActivityTypeProperties, +} +impl AppendVariableActivity { + pub fn new(control_activity: ControlActivity, type_properties: AppendVariableActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "AppendVariable activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AppendVariableActivityTypeProperties { + #[doc = "Name of the variable whose value needs to be appended to."] + #[serde(rename = "variableName", default, skip_serializing_if = "Option::is_none")] + pub variable_name: Option, + #[doc = "Value to be appended. Could be a static value or Expression"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl AppendVariableActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body structure for rename artifact."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ArtifactRenameRequest { + #[doc = "New name of the artifact."] + #[serde(rename = "newName", default, skip_serializing_if = "Option::is_none")] + pub new_name: Option, +} +impl ArtifactRenameRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for Asana."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Asana linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AsanaLinkedServiceTypeProperties, +} +impl AsanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AsanaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Asana linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AsanaLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AsanaLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} +#[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoPauseProperties { + #[doc = "Number of minutes of idle time before the Big Data pool is automatically paused."] + #[serde(rename = "delayInMinutes", default, skip_serializing_if = "Option::is_none")] + pub delay_in_minutes: Option, + #[doc = "Whether auto-pausing is enabled for the Big Data pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl AutoPauseProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Auto-scaling properties of a Big Data pool powered by Apache Spark"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AutoScaleProperties { + #[doc = "The minimum number of nodes the Big Data pool can support."] + #[serde(rename = "minNodeCount", default, skip_serializing_if = "Option::is_none")] + pub min_node_count: Option, + #[doc = "Whether automatic scaling is enabled for the Big Data pool."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[doc = "The maximum number of nodes the Big Data pool can support."] + #[serde(rename = "maxNodeCount", default, skip_serializing_if = "Option::is_none")] + pub max_node_count: Option, +} +impl AutoScaleProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AvroCompressionCodecEnum { + #[serde(rename = "none")] + None, + #[serde(rename = "deflate")] + Deflate, + #[serde(rename = "snappy")] + Snappy, + #[serde(rename = "xz")] + Xz, + #[serde(rename = "bzip2")] + Bzip2, +} +#[doc = "Avro dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Avro dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AvroDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Avro dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "A string from AvroCompressionCodecEnum or an expression"] + #[serde(rename = "avroCompressionCodec", default, skip_serializing_if = "Option::is_none")] + pub avro_compression_codec: Option, + #[serde(rename = "avroCompressionLevel", default, skip_serializing_if = "Option::is_none")] + pub avro_compression_level: Option, +} +impl AvroDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + avro_compression_codec: None, + avro_compression_level: None, + } + } +} +#[doc = "The data stored in Avro format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroFormat { + #[serde(flatten)] + pub dataset_storage_format: DatasetStorageFormat, +} +impl AvroFormat { + pub fn new(dataset_storage_format: DatasetStorageFormat) -> Self { + Self { dataset_storage_format } + } +} +#[doc = "A copy activity Avro sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Avro write settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl AvroSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + format_settings: None, + } + } +} +#[doc = "A copy activity Avro source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl AvroSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + additional_columns: None, + } + } +} +#[doc = "Avro write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvroWriteSettings { + #[serde(flatten)] + pub format_write_settings: FormatWriteSettings, + #[doc = "Top level record name in write result, which is required in AVRO spec."] + #[serde(rename = "recordName", default, skip_serializing_if = "Option::is_none")] + pub record_name: Option, + #[doc = "Record namespace in the write result."] + #[serde(rename = "recordNamespace", default, skip_serializing_if = "Option::is_none")] + pub record_namespace: Option, + #[doc = "Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxRowsPerFile", default, skip_serializing_if = "Option::is_none")] + pub max_rows_per_file: Option, + #[doc = "Specifies the file name pattern _. when copy from non-file based store without partitionOptions. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub file_name_prefix: Option, +} +impl AvroWriteSettings { + pub fn new(format_write_settings: FormatWriteSettings) -> Self { + Self { + format_write_settings, + record_name: None, + record_namespace: None, + max_rows_per_file: None, + file_name_prefix: None, + } + } +} +#[doc = "Azure Batch linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBatchLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Batch linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureBatchLinkedServiceTypeProperties, +} +impl AzureBatchLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureBatchLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Batch linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBatchLinkedServiceTypeProperties { + #[doc = "The Azure Batch account name. Type: string (or Expression with resultType string)."] + #[serde(rename = "accountName")] + pub account_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] + pub access_key: Option, + #[doc = "The Azure Batch URI. Type: string (or Expression with resultType string)."] + #[serde(rename = "batchUri")] + pub batch_uri: serde_json::Value, + #[doc = "The Azure Batch pool name. Type: string (or Expression with resultType string)."] + #[serde(rename = "poolName")] + pub pool_name: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureBatchLinkedServiceTypeProperties { + pub fn new( + account_name: serde_json::Value, + batch_uri: serde_json::Value, + pool_name: serde_json::Value, + linked_service_name: LinkedServiceReference, + ) -> Self { + Self { + account_name, + access_key: None, + batch_uri, + pool_name, + linked_service_name, + encrypted_credential: None, + } + } +} +#[doc = "The Azure Blob storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Blob dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureBlobDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure Blob dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBlobDatasetTypeProperties { + #[doc = "The path of the Azure Blob storage. Type: string (or Expression with resultType string)."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "The root of blob path. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableRootLocation", default, skip_serializing_if = "Option::is_none")] + pub table_root_location: Option, + #[doc = "The name of the Azure Blob. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, + #[doc = "The start of Azure Blob's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of Azure Blob's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl AzureBlobDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Azure Data Lake Storage Gen2 storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Data Lake Storage Gen2 dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureBlobFsDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure Data Lake Storage Gen2 dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBlobFsDatasetTypeProperties { + #[doc = "The path of the Azure Data Lake Storage Gen2 storage. Type: string (or Expression with resultType string)."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "The name of the Azure Data Lake Storage Gen2. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl AzureBlobFsDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Data Lake Storage Gen2 linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Data Lake Storage Gen2 linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureBlobFsLinkedServiceTypeProperties, +} +impl AzureBlobFsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureBlobFsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Data Lake Storage Gen2 linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsLinkedServiceTypeProperties { + #[doc = "Endpoint for the Azure Data Lake Storage Gen2 service. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "Account key for the Azure Data Lake Storage Gen2 service. Type: string (or Expression with resultType string)."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "The ID of the application used to authenticate against the Azure Data Lake Storage Gen2 account. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "The service principal credential type to use in Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalCredentialType", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalCredential", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureBlobFsLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + account_key: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + service_principal_credential_type: None, + service_principal_credential: None, + encrypted_credential: None, + } + } +} +#[doc = "The location of azure blobFS dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, + #[doc = "Specify the fileSystem of azure blobFS. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileSystem", default, skip_serializing_if = "Option::is_none")] + pub file_system: Option, +} +impl AzureBlobFsLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { + dataset_location, + file_system: None, + } + } +} +#[doc = "Azure blobFS read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Azure blobFS wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Azure blobFS wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl AzureBlobFsReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "A copy activity Azure Data Lake Storage Gen2 sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The type of copy behavior for copy sink."] + #[serde(rename = "copyBehavior", default, skip_serializing_if = "Option::is_none")] + pub copy_behavior: Option, +} +impl AzureBlobFsSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + copy_behavior: None, + } + } +} +#[doc = "A copy activity Azure BlobFS source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Treat empty as null. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "treatEmptyAsNull", default, skip_serializing_if = "Option::is_none")] + pub treat_empty_as_null: Option, + #[doc = "Number of header lines to skip from each blob. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "skipHeaderLineCount", default, skip_serializing_if = "Option::is_none")] + pub skip_header_line_count: Option, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, +} +impl AzureBlobFsSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + treat_empty_as_null: None, + skip_header_line_count: None, + recursive: None, + } + } +} +#[doc = "Azure blobFS write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobFsWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, + #[doc = "Indicates the block size(MB) when writing data to blob. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "blockSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub block_size_in_mb: Option, +} +impl AzureBlobFsWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { + store_write_settings, + block_size_in_mb: None, + } + } +} +#[doc = "The azure blob storage linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobStorageLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Blob Storage linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureBlobStorageLinkedServiceTypeProperties, +} +impl AzureBlobStorageLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureBlobStorageLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Blob Storage linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureBlobStorageLinkedServiceTypeProperties { + #[doc = "The connection string. It is mutually exclusive with sasUri, serviceEndpoint property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "SAS URI of the Azure Blob Storage resource. It is mutually exclusive with connectionString, serviceEndpoint property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "sasUri", default, skip_serializing_if = "Option::is_none")] + pub sas_uri: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, + #[doc = "Blob service endpoint of the Azure Blob Storage resource. It is mutually exclusive with connectionString, sasUri property."] + #[serde(rename = "serviceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub service_endpoint: Option, + #[doc = "The ID of the service principal used to authenticate against Azure SQL Data Warehouse. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "Specify the kind of your storage account. Allowed values are: Storage (general purpose v1), StorageV2 (general purpose v2), BlobStorage, or BlockBlobStorage. Type: string (or Expression with resultType string)."] + #[serde(rename = "accountKind", default, skip_serializing_if = "Option::is_none")] + pub account_kind: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureBlobStorageLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location of azure blob dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobStorageLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, + #[doc = "Specify the container of azure blob. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub container: Option, +} +impl AzureBlobStorageLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { + dataset_location, + container: None, + } + } +} +#[doc = "Azure blob read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobStorageReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Azure blob wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Azure blob wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "The prefix filter for the Azure Blob name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl AzureBlobStorageReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + prefix: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "Azure blob write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureBlobStorageWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, + #[doc = "Indicates the block size(MB) when writing data to blob. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "blockSizeInMB", default, skip_serializing_if = "Option::is_none")] + pub block_size_in_mb: Option, +} +impl AzureBlobStorageWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { + store_write_settings, + block_size_in_mb: None, + } + } +} +#[doc = "Azure Data Explorer command activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerCommandActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Azure Data Explorer command activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDataExplorerCommandActivityTypeProperties, +} +impl AzureDataExplorerCommandActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: AzureDataExplorerCommandActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Azure Data Explorer command activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerCommandActivityTypeProperties { + #[doc = "A control command, according to the Azure Data Explorer command syntax. Type: string (or Expression with resultType string)."] + pub command: serde_json::Value, + #[doc = "Control command timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))..)"] + #[serde(rename = "commandTimeout", default, skip_serializing_if = "Option::is_none")] + pub command_timeout: Option, +} +impl AzureDataExplorerCommandActivityTypeProperties { + pub fn new(command: serde_json::Value) -> Self { + Self { + command, + command_timeout: None, + } + } +} +#[doc = "Azure Data Explorer (Kusto) dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataExplorerDatasetTypeProperties { + #[doc = "The table name of the Azure Data Explorer database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AzureDataExplorerDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Data Explorer (Kusto) linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Data Explorer (Kusto) linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDataExplorerLinkedServiceTypeProperties, +} +impl AzureDataExplorerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureDataExplorerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Data Explorer (Kusto) linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerLinkedServiceTypeProperties { + #[doc = "The endpoint of Azure Data Explorer (the engine's endpoint). URL will be in the format https://..kusto.windows.net. Type: string (or Expression with resultType string)"] + pub endpoint: serde_json::Value, + #[doc = "The ID of the service principal used to authenticate against Azure Data Explorer. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "Database name for connection. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, +} +impl AzureDataExplorerLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value, database: serde_json::Value) -> Self { + Self { + endpoint, + service_principal_id: None, + service_principal_key: None, + database, + tenant: None, + } + } +} +#[doc = "A copy activity Azure Data Explorer sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A name of a pre-created csv mapping that was defined on the target Kusto table. Type: string."] + #[serde(rename = "ingestionMappingName", default, skip_serializing_if = "Option::is_none")] + pub ingestion_mapping_name: Option, + #[doc = "An explicit column mapping description provided in a json format. Type: string."] + #[serde(rename = "ingestionMappingAsJson", default, skip_serializing_if = "Option::is_none")] + pub ingestion_mapping_as_json: Option, + #[doc = "If set to true, any aggregation will be skipped. Default is false. Type: boolean."] + #[serde(rename = "flushImmediately", default, skip_serializing_if = "Option::is_none")] + pub flush_immediately: Option, +} +impl AzureDataExplorerSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + ingestion_mapping_name: None, + ingestion_mapping_as_json: None, + flush_immediately: None, + } + } +} +#[doc = "A copy activity Azure Data Explorer (Kusto) source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Database query. Should be a Kusto Query Language (KQL) query. Type: string (or Expression with resultType string)."] + pub query: serde_json::Value, + #[doc = "The name of the Boolean option that controls whether truncation is applied to result-sets that go beyond a certain row-count limit."] + #[serde(rename = "noTruncation", default, skip_serializing_if = "Option::is_none")] + pub no_truncation: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9])).."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl AzureDataExplorerSource { + pub fn new(copy_source: CopySource, query: serde_json::Value) -> Self { + Self { + copy_source, + query, + no_truncation: None, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "The Azure Data Explorer (Kusto) dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataExplorerTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Data Explorer (Kusto) dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDataExplorerDatasetTypeProperties, +} +impl AzureDataExplorerTableDataset { + pub fn new(dataset: Dataset, type_properties: AzureDataExplorerDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Azure Data Lake Analytics linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeAnalyticsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Data Lake Analytics linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDataLakeAnalyticsLinkedServiceTypeProperties, +} +impl AzureDataLakeAnalyticsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureDataLakeAnalyticsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Data Lake Analytics linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeAnalyticsLinkedServiceTypeProperties { + #[doc = "The Azure Data Lake Analytics account name. Type: string (or Expression with resultType string)."] + #[serde(rename = "accountName")] + pub account_name: serde_json::Value, + #[doc = "The ID of the application used to authenticate against the Azure Data Lake Analytics account. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + pub tenant: serde_json::Value, + #[doc = "Data Lake Analytics account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string)."] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Data Lake Analytics account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string)."] + #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub resource_group_name: Option, + #[doc = "Azure Data Lake Analytics URI Type: string (or Expression with resultType string)."] + #[serde(rename = "dataLakeAnalyticsUri", default, skip_serializing_if = "Option::is_none")] + pub data_lake_analytics_uri: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureDataLakeAnalyticsLinkedServiceTypeProperties { + pub fn new(account_name: serde_json::Value, tenant: serde_json::Value) -> Self { + Self { + account_name, + service_principal_id: None, + service_principal_key: None, + tenant, + subscription_id: None, + resource_group_name: None, + data_lake_analytics_uri: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure Data Lake Store dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Data Lake Store dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureDataLakeStoreDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure Data Lake Store dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDataLakeStoreDatasetTypeProperties { + #[doc = "Path to the folder in the Azure Data Lake Store. Type: string (or Expression with resultType string)."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "The name of the file in the Azure Data Lake Store. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl AzureDataLakeStoreDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Data Lake Store linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Data Lake Store linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDataLakeStoreLinkedServiceTypeProperties, +} +impl AzureDataLakeStoreLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureDataLakeStoreLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Data Lake Store linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreLinkedServiceTypeProperties { + #[doc = "Data Lake Store service URI. Type: string (or Expression with resultType string)."] + #[serde(rename = "dataLakeStoreUri")] + pub data_lake_store_uri: serde_json::Value, + #[doc = "The ID of the application used to authenticate against the Azure Data Lake Store account. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "Data Lake Store account name. Type: string (or Expression with resultType string)."] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "Data Lake Store account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string)."] + #[serde(rename = "subscriptionId", default, skip_serializing_if = "Option::is_none")] + pub subscription_id: Option, + #[doc = "Data Lake Store account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string)."] + #[serde(rename = "resourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub resource_group_name: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureDataLakeStoreLinkedServiceTypeProperties { + pub fn new(data_lake_store_uri: serde_json::Value) -> Self { + Self { + data_lake_store_uri, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + account_name: None, + subscription_id: None, + resource_group_name: None, + encrypted_credential: None, + } + } +} +#[doc = "The location of azure data lake store dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl AzureDataLakeStoreLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "Azure data lake store read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "ADLS wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "ADLS wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Lists files after the value (exclusive) based on file/folder names’ lexicographical order. Applies under the folderPath in data set, and filter files/sub-folders under the folderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "listAfter", default, skip_serializing_if = "Option::is_none")] + pub list_after: Option, + #[doc = "Lists files before the value (inclusive) based on file/folder names’ lexicographical order. Applies under the folderPath in data set, and filter files/sub-folders under the folderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "listBefore", default, skip_serializing_if = "Option::is_none")] + pub list_before: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl AzureDataLakeStoreReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + file_list_path: None, + list_after: None, + list_before: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "A copy activity Azure Data Lake Store sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The type of copy behavior for copy sink."] + #[serde(rename = "copyBehavior", default, skip_serializing_if = "Option::is_none")] + pub copy_behavior: Option, + #[doc = "Single File Parallel."] + #[serde(rename = "enableAdlsSingleFileParallel", default, skip_serializing_if = "Option::is_none")] + pub enable_adls_single_file_parallel: Option, +} +impl AzureDataLakeStoreSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + copy_behavior: None, + enable_adls_single_file_parallel: None, + } + } +} +#[doc = "A copy activity Azure Data Lake source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, +} +impl AzureDataLakeStoreSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + recursive: None, + } + } +} +#[doc = "Azure data lake store write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDataLakeStoreWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, + #[doc = "Specifies the expiry time of the written files. The time is applied to the UTC time zone in the format of \"2018-12-01T05:00:00Z\". Default value is NULL. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "expiryDateTime", default, skip_serializing_if = "Option::is_none")] + pub expiry_date_time: Option, +} +impl AzureDataLakeStoreWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { + store_write_settings, + expiry_date_time: None, + } + } +} +#[doc = "Azure Databricks Delta Lake dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Databricks Delta Lake Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureDatabricksDeltaLakeDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure Databricks Delta Lake Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureDatabricksDeltaLakeDatasetTypeProperties { + #[doc = "The name of delta table. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The database name of delta table. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, +} +impl AzureDatabricksDeltaLakeDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Databricks Delta Lake export command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeExportCommand { + #[serde(flatten)] + pub export_settings: ExportSettings, + #[doc = "Specify the date format for the csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "dateFormat", default, skip_serializing_if = "Option::is_none")] + pub date_format: Option, + #[doc = "Specify the timestamp format for the csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "timestampFormat", default, skip_serializing_if = "Option::is_none")] + pub timestamp_format: Option, +} +impl AzureDatabricksDeltaLakeExportCommand { + pub fn new(export_settings: ExportSettings) -> Self { + Self { + export_settings, + date_format: None, + timestamp_format: None, + } + } +} +#[doc = "Azure Databricks Delta Lake import command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeImportCommand { + #[serde(flatten)] + pub import_settings: ImportSettings, + #[doc = "Specify the date format for csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "dateFormat", default, skip_serializing_if = "Option::is_none")] + pub date_format: Option, + #[doc = "Specify the timestamp format for csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "timestampFormat", default, skip_serializing_if = "Option::is_none")] + pub timestamp_format: Option, +} +impl AzureDatabricksDeltaLakeImportCommand { + pub fn new(import_settings: ImportSettings) -> Self { + Self { + import_settings, + date_format: None, + timestamp_format: None, + } + } +} +#[doc = "Azure Databricks Delta Lake linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Databricks Delta Lake linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDatabricksDetltaLakeLinkedServiceTypeProperties, +} +impl AzureDatabricksDeltaLakeLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureDatabricksDetltaLakeLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "A copy activity Azure Databricks Delta Lake sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "Azure Databricks Delta Lake import command settings."] + #[serde(rename = "importSettings", default, skip_serializing_if = "Option::is_none")] + pub import_settings: Option, +} +impl AzureDatabricksDeltaLakeSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + import_settings: None, + } + } +} +#[doc = "A copy activity Azure Databricks Delta Lake source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDeltaLakeSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Azure Databricks Delta Lake Sql query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Azure Databricks Delta Lake export command settings."] + #[serde(rename = "exportSettings", default, skip_serializing_if = "Option::is_none")] + pub export_settings: Option, +} +impl AzureDatabricksDeltaLakeSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + export_settings: None, + } + } +} +#[doc = "Azure Databricks Delta Lake linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksDetltaLakeLinkedServiceTypeProperties { + #[doc = ".azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string)."] + pub domain: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken")] + pub access_token: SecretBase, + #[doc = "The id of an existing interactive cluster that will be used for all runs of this job. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterId", default, skip_serializing_if = "Option::is_none")] + pub cluster_id: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureDatabricksDetltaLakeLinkedServiceTypeProperties { + pub fn new(domain: serde_json::Value, access_token: SecretBase) -> Self { + Self { + domain, + access_token, + cluster_id: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure Databricks linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Databricks linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureDatabricksLinkedServiceTypeProperties, +} +impl AzureDatabricksLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureDatabricksLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Databricks linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureDatabricksLinkedServiceTypeProperties { + #[doc = ".azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string)."] + pub domain: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[doc = "Required to specify MSI, if using Workspace resource id for databricks REST API. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authentication: Option, + #[doc = "Workspace resource id for databricks REST API. Type: string (or Expression with resultType string)."] + #[serde(rename = "workspaceResourceId", default, skip_serializing_if = "Option::is_none")] + pub workspace_resource_id: Option, + #[doc = "The id of an existing interactive cluster that will be used for all runs of this activity. Type: string (or Expression with resultType string)."] + #[serde(rename = "existingClusterId", default, skip_serializing_if = "Option::is_none")] + pub existing_cluster_id: Option, + #[doc = "The id of an existing instance pool that will be used for all runs of this activity. Type: string (or Expression with resultType string)."] + #[serde(rename = "instancePoolId", default, skip_serializing_if = "Option::is_none")] + pub instance_pool_id: Option, + #[doc = "If not using an existing interactive cluster, this specifies the Spark version of a new job cluster or instance pool nodes created for each run of this activity. Required if instancePoolId is specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "newClusterVersion", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_version: Option, + #[doc = "If not using an existing interactive cluster, this specifies the number of worker nodes to use for the new job cluster or instance pool. For new job clusters, this a string-formatted Int32, like '1' means numOfWorker is 1 or '1:10' means auto-scale from 1 (min) to 10 (max). For instance pools, this is a string-formatted Int32, and can only specify a fixed number of worker nodes, such as '2'. Required if newClusterVersion is specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "newClusterNumOfWorker", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_num_of_worker: Option, + #[doc = "The node type of the new job cluster. This property is required if newClusterVersion is specified and instancePoolId is not specified. If instancePoolId is specified, this property is ignored. Type: string (or Expression with resultType string)."] + #[serde(rename = "newClusterNodeType", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_node_type: Option, + #[doc = "A set of optional, user-specified Spark configuration key-value pairs."] + #[serde(rename = "newClusterSparkConf", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_spark_conf: Option, + #[doc = "A set of optional, user-specified Spark environment variables key-value pairs."] + #[serde(rename = "newClusterSparkEnvVars", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_spark_env_vars: Option, + #[doc = "Additional tags for cluster resources. This property is ignored in instance pool configurations."] + #[serde(rename = "newClusterCustomTags", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_custom_tags: Option, + #[doc = "Specify a location to deliver Spark driver, worker, and event logs. Type: string (or Expression with resultType string)."] + #[serde(rename = "newClusterLogDestination", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_log_destination: Option, + #[doc = "The driver node type for the new job cluster. This property is ignored in instance pool configurations. Type: string (or Expression with resultType string)."] + #[serde(rename = "newClusterDriverNodeType", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_driver_node_type: Option, + #[doc = "User-defined initialization scripts for the new cluster. Type: array of strings (or Expression with resultType array of strings)."] + #[serde(rename = "newClusterInitScripts", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_init_scripts: Option, + #[doc = "Enable the elastic disk on the new cluster. This property is now ignored, and takes the default elastic disk behavior in Databricks (elastic disks are always enabled). Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "newClusterEnableElasticDisk", default, skip_serializing_if = "Option::is_none")] + pub new_cluster_enable_elastic_disk: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "The policy id for limiting the ability to configure clusters based on a user defined set of rules. Type: string (or Expression with resultType string)."] + #[serde(rename = "policyId", default, skip_serializing_if = "Option::is_none")] + pub policy_id: Option, +} +impl AzureDatabricksLinkedServiceTypeProperties { + pub fn new(domain: serde_json::Value) -> Self { + Self { + domain, + access_token: None, + authentication: None, + workspace_resource_id: None, + existing_cluster_id: None, + instance_pool_id: None, + new_cluster_version: None, + new_cluster_num_of_worker: None, + new_cluster_node_type: None, + new_cluster_spark_conf: None, + new_cluster_spark_env_vars: None, + new_cluster_custom_tags: None, + new_cluster_log_destination: None, + new_cluster_driver_node_type: None, + new_cluster_init_scripts: None, + new_cluster_enable_elastic_disk: None, + encrypted_credential: None, + policy_id: None, + } + } +} +#[doc = "The resource model definition for an Azure Resource Manager resource with an etag."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureEntityResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource Etag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, +} +impl AzureEntityResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure File Storage linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileStorageLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure File Storage linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureFileStorageLinkedServiceTypeProperties, +} +impl AzureFileStorageLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureFileStorageLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure File Storage linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileStorageLinkedServiceTypeProperties { + #[doc = "Host name of the server. Type: string (or Expression with resultType string)."] + pub host: serde_json::Value, + #[doc = "User ID to logon the server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The connection string. It is mutually exclusive with sasUri property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "SAS URI of the Azure File resource. It is mutually exclusive with connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "sasUri", default, skip_serializing_if = "Option::is_none")] + pub sas_uri: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, + #[doc = "The azure file share name. It is required when auth with accountKey/sasToken. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileShare", default, skip_serializing_if = "Option::is_none")] + pub file_share: Option, + #[doc = "The azure file share snapshot version. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureFileStorageLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + user_id: None, + password: None, + connection_string: None, + account_key: None, + sas_uri: None, + sas_token: None, + file_share: None, + snapshot: None, + encrypted_credential: None, + } + } +} +#[doc = "The location of file server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileStorageLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl AzureFileStorageLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "Azure File Storage read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileStorageReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Azure File Storage wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Azure File Storage wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "The prefix filter for the Azure File name starting from root path. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl AzureFileStorageReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + prefix: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "Azure File Storage write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFileStorageWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, +} +impl AzureFileStorageWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { store_write_settings } + } +} +#[doc = "Azure Function activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFunctionActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Azure Function activity type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureFunctionActivityTypeProperties, +} +impl AzureFunctionActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: AzureFunctionActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "The list of HTTP methods supported by a AzureFunctionActivity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AzureFunctionActivityMethod { + #[serde(rename = "GET")] + Get, + #[serde(rename = "POST")] + Post, + #[serde(rename = "PUT")] + Put, + #[serde(rename = "DELETE")] + Delete, + #[serde(rename = "OPTIONS")] + Options, + #[serde(rename = "HEAD")] + Head, + #[serde(rename = "TRACE")] + Trace, +} +#[doc = "Azure Function activity type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFunctionActivityTypeProperties { + #[doc = "The list of HTTP methods supported by a AzureFunctionActivity."] + pub method: AzureFunctionActivityMethod, + #[doc = "Name of the Function that the Azure Function Activity will call. Type: string (or Expression with resultType string)"] + #[serde(rename = "functionName")] + pub function_name: serde_json::Value, + #[doc = "Represents the headers that will be sent to the request. For example, to set the language and type on a request: \"headers\" : { \"Accept-Language\": \"en-us\", \"Content-Type\": \"application/json\" }. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[doc = "Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, +} +impl AzureFunctionActivityTypeProperties { + pub fn new(method: AzureFunctionActivityMethod, function_name: serde_json::Value) -> Self { + Self { + method, + function_name, + headers: None, + body: None, + } + } +} +#[doc = "Azure Function linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFunctionLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Function linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureFunctionLinkedServiceTypeProperties, +} +impl AzureFunctionLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureFunctionLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Function linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureFunctionLinkedServiceTypeProperties { + #[doc = "The endpoint of the Azure Function App. URL will be in the format https://.azurewebsites.net."] + #[serde(rename = "functionAppUrl")] + pub function_app_url: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "functionKey", default, skip_serializing_if = "Option::is_none")] + pub function_key: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureFunctionLinkedServiceTypeProperties { + pub fn new(function_app_url: serde_json::Value) -> Self { + Self { + function_app_url, + function_key: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure Key Vault linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureKeyVaultLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Key Vault linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureKeyVaultLinkedServiceTypeProperties, +} +impl AzureKeyVaultLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureKeyVaultLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Key Vault linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureKeyVaultLinkedServiceTypeProperties { + #[doc = "The base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net Type: string (or Expression with resultType string)."] + #[serde(rename = "baseUrl")] + pub base_url: serde_json::Value, +} +impl AzureKeyVaultLinkedServiceTypeProperties { + pub fn new(base_url: serde_json::Value) -> Self { + Self { base_url } + } +} +#[doc = "Azure Key Vault secret reference."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureKeyVaultSecretReference { + #[serde(flatten)] + pub secret_base: SecretBase, + #[doc = "Linked service reference type."] + pub store: LinkedServiceReference, + #[doc = "The name of the secret in Azure Key Vault. Type: string (or Expression with resultType string)."] + #[serde(rename = "secretName")] + pub secret_name: serde_json::Value, + #[doc = "The version of the secret in Azure Key Vault. The default value is the latest version of the secret. Type: string (or Expression with resultType string)."] + #[serde(rename = "secretVersion", default, skip_serializing_if = "Option::is_none")] + pub secret_version: Option, +} +impl AzureKeyVaultSecretReference { + pub fn new(secret_base: SecretBase, store: LinkedServiceReference, secret_name: serde_json::Value) -> Self { + Self { + secret_base, + store, + secret_name, + secret_version: None, + } + } +} +#[doc = "Azure ML Batch Execution activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlBatchExecutionActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Azure ML Batch Execution activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMlBatchExecutionActivityTypeProperties, +} +impl AzureMlBatchExecutionActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: AzureMlBatchExecutionActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Azure ML Batch Execution activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMlBatchExecutionActivityTypeProperties { + #[doc = "Key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be passed in the GlobalParameters property of the Azure ML batch execution request."] + #[serde(rename = "globalParameters", default, skip_serializing_if = "Option::is_none")] + pub global_parameters: Option, + #[doc = "Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Outputs to AzureMLWebServiceFile objects specifying the output Blob locations. This information will be passed in the WebServiceOutputs property of the Azure ML batch execution request."] + #[serde(rename = "webServiceOutputs", default, skip_serializing_if = "Option::is_none")] + pub web_service_outputs: Option, + #[doc = "Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Inputs to AzureMLWebServiceFile objects specifying the input Blob locations.. This information will be passed in the WebServiceInputs property of the Azure ML batch execution request."] + #[serde(rename = "webServiceInputs", default, skip_serializing_if = "Option::is_none")] + pub web_service_inputs: Option, +} +impl AzureMlBatchExecutionActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure ML Execute Pipeline activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlExecutePipelineActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Azure ML Execute Pipeline activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMlExecutePipelineActivityTypeProperties, +} +impl AzureMlExecutePipelineActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: AzureMlExecutePipelineActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Azure ML Execute Pipeline activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlExecutePipelineActivityTypeProperties { + #[doc = "ID of the published Azure ML pipeline. Type: string (or Expression with resultType string)."] + #[serde(rename = "mlPipelineId")] + pub ml_pipeline_id: serde_json::Value, + #[doc = "Run history experiment name of the pipeline run. This information will be passed in the ExperimentName property of the published pipeline execution request. Type: string (or Expression with resultType string)."] + #[serde(rename = "experimentName", default, skip_serializing_if = "Option::is_none")] + pub experiment_name: Option, + #[doc = "Key,Value pairs to be passed to the published Azure ML pipeline endpoint. Keys must match the names of pipeline parameters defined in the published pipeline. Values will be passed in the ParameterAssignments property of the published pipeline execution request. Type: object with key value pairs (or Expression with resultType object)."] + #[serde(rename = "mlPipelineParameters", default, skip_serializing_if = "Option::is_none")] + pub ml_pipeline_parameters: Option, + #[doc = "The parent Azure ML Service pipeline run id. This information will be passed in the ParentRunId property of the published pipeline execution request. Type: string (or Expression with resultType string)."] + #[serde(rename = "mlParentRunId", default, skip_serializing_if = "Option::is_none")] + pub ml_parent_run_id: Option, + #[doc = "Whether to continue execution of other steps in the PipelineRun if a step fails. This information will be passed in the continueOnStepFailure property of the published pipeline execution request. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "continueOnStepFailure", default, skip_serializing_if = "Option::is_none")] + pub continue_on_step_failure: Option, +} +impl AzureMlExecutePipelineActivityTypeProperties { + pub fn new(ml_pipeline_id: serde_json::Value) -> Self { + Self { + ml_pipeline_id, + experiment_name: None, + ml_pipeline_parameters: None, + ml_parent_run_id: None, + continue_on_step_failure: None, + } + } +} +#[doc = "Azure ML Studio Web Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure ML Studio Web Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMlLinkedServiceTypeProperties, +} +impl AzureMlLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureMlLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure ML Studio Web Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlLinkedServiceTypeProperties { + #[doc = "The Batch Execution REST URL for an Azure ML Studio Web Service endpoint. Type: string (or Expression with resultType string)."] + #[serde(rename = "mlEndpoint")] + pub ml_endpoint: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiKey")] + pub api_key: SecretBase, + #[doc = "The Update Resource REST URL for an Azure ML Studio Web Service endpoint. Type: string (or Expression with resultType string)."] + #[serde(rename = "updateResourceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub update_resource_endpoint: Option, + #[doc = "The ID of the service principal used to authenticate against the ARM-based updateResourceEndpoint of an Azure ML Studio web service. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureMlLinkedServiceTypeProperties { + pub fn new(ml_endpoint: serde_json::Value, api_key: SecretBase) -> Self { + Self { + ml_endpoint, + api_key, + update_resource_endpoint: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + encrypted_credential: None, + } + } +} +#[doc = "Key,Value pairs to be passed to the published Azure ML pipeline endpoint. Keys must match the names of pipeline parameters defined in the published pipeline. Values will be passed in the ParameterAssignments property of the published pipeline execution request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMlPipelineParameters {} +impl AzureMlPipelineParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure ML Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlServiceLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure ML Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMlServiceLinkedServiceTypeProperties, +} +impl AzureMlServiceLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureMlServiceLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure ML Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlServiceLinkedServiceTypeProperties { + #[doc = "Azure ML Service workspace subscription ID. Type: string (or Expression with resultType string)."] + #[serde(rename = "subscriptionId")] + pub subscription_id: serde_json::Value, + #[doc = "Azure ML Service workspace resource group name. Type: string (or Expression with resultType string)."] + #[serde(rename = "resourceGroupName")] + pub resource_group_name: serde_json::Value, + #[doc = "Azure ML Service workspace name. Type: string (or Expression with resultType string)."] + #[serde(rename = "mlWorkspaceName")] + pub ml_workspace_name: serde_json::Value, + #[doc = "The ID of the service principal used to authenticate against the endpoint of a published Azure ML Service pipeline. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureMlServiceLinkedServiceTypeProperties { + pub fn new(subscription_id: serde_json::Value, resource_group_name: serde_json::Value, ml_workspace_name: serde_json::Value) -> Self { + Self { + subscription_id, + resource_group_name, + ml_workspace_name, + service_principal_id: None, + service_principal_key: None, + tenant: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure ML Update Resource management activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlUpdateResourceActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Azure ML Update Resource activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMlUpdateResourceActivityTypeProperties, +} +impl AzureMlUpdateResourceActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: AzureMlUpdateResourceActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Azure ML Update Resource activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlUpdateResourceActivityTypeProperties { + #[doc = "Name of the Trained Model module in the Web Service experiment to be updated. Type: string (or Expression with resultType string)."] + #[serde(rename = "trainedModelName")] + pub trained_model_name: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "trainedModelLinkedServiceName")] + pub trained_model_linked_service_name: LinkedServiceReference, + #[doc = "The relative file path in trainedModelLinkedService to represent the .ilearner file that will be uploaded by the update operation. Type: string (or Expression with resultType string)."] + #[serde(rename = "trainedModelFilePath")] + pub trained_model_file_path: serde_json::Value, +} +impl AzureMlUpdateResourceActivityTypeProperties { + pub fn new( + trained_model_name: serde_json::Value, + trained_model_linked_service_name: LinkedServiceReference, + trained_model_file_path: serde_json::Value, + ) -> Self { + Self { + trained_model_name, + trained_model_linked_service_name, + trained_model_file_path, + } + } +} +#[doc = "Azure ML WebService Input/Output file"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMlWebServiceFile { + #[doc = "The relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string)."] + #[serde(rename = "filePath")] + pub file_path: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, +} +impl AzureMlWebServiceFile { + pub fn new(file_path: serde_json::Value, linked_service_name: LinkedServiceReference) -> Self { + Self { + file_path, + linked_service_name, + } + } +} +#[doc = "Azure Database for MariaDB linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMariaDbLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Database for MariaDB linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMariaDbLinkedServiceTypeProperties, +} +impl AzureMariaDbLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureMariaDbLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Database for MariaDB linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMariaDbLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureMariaDbLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Azure MariaDB source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMariaDbSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl AzureMariaDbSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Azure Database for MariaDB dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMariaDbTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureMariaDbTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure MySQL database linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure MySQL database linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMySqlLinkedServiceTypeProperties, +} +impl AzureMySqlLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureMySqlLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure MySQL database linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureMySqlLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Azure MySql sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A query to execute before starting the copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl AzureMySqlSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity Azure MySQL source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl AzureMySqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The Azure MySQL database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureMySqlTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure MySQL database dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureMySqlTableDatasetTypeProperties, +} +impl AzureMySqlTableDataset { + pub fn new(dataset: Dataset, type_properties: AzureMySqlTableDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Azure MySQL database dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureMySqlTableDatasetTypeProperties { + #[doc = "The Azure MySQL database table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The name of Azure MySQL database table. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AzureMySqlTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure PostgreSQL linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure PostgreSQL linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzurePostgreSqlLinkedServiceTypeProperties, +} +impl AzurePostgreSqlLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzurePostgreSqlLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure PostgreSQL linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzurePostgreSqlLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Azure PostgreSQL sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A query to execute before starting the copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl AzurePostgreSqlSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity Azure PostgreSQL source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl AzurePostgreSqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Azure PostgreSQL dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzurePostgreSqlTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure PostgreSQL dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzurePostgreSqlTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure PostgreSQL dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzurePostgreSqlTableDatasetTypeProperties { + #[doc = "The table name of the Azure PostgreSQL database which includes both schema and table. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Azure PostgreSQL database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Azure PostgreSQL database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl AzurePostgreSqlTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Azure Queue sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureQueueSink { + #[serde(flatten)] + pub copy_sink: CopySink, +} +impl AzureQueueSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { copy_sink } + } +} +#[doc = "The Azure Search Index."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSearchIndexDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureSearchIndexDatasetTypeProperties, +} +impl AzureSearchIndexDataset { + pub fn new(dataset: Dataset, type_properties: AzureSearchIndexDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Properties specific to this dataset type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSearchIndexDatasetTypeProperties { + #[doc = "The name of the Azure Search Index. Type: string (or Expression with resultType string)."] + #[serde(rename = "indexName")] + pub index_name: serde_json::Value, +} +impl AzureSearchIndexDatasetTypeProperties { + pub fn new(index_name: serde_json::Value) -> Self { + Self { index_name } + } +} +#[doc = "A copy activity Azure Search Index sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSearchIndexSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Specify the write behavior when upserting documents into Azure Search Index."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, +} +impl AzureSearchIndexSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + } + } +} +pub mod azure_search_index_sink { + use super::*; + #[doc = "Specify the write behavior when upserting documents into Azure Search Index."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WriteBehavior { + Merge, + Upload, + } +} +#[doc = "Linked service for Windows Azure Search Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSearchLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Windows Azure Search Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureSearchLinkedServiceTypeProperties, +} +impl AzureSearchLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureSearchLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Windows Azure Search Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSearchLinkedServiceTypeProperties { + #[doc = "URL for Azure Search service. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureSearchLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + key: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure SQL Data Warehouse linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDwLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure SQL Data Warehouse linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureSqlDwLinkedServiceTypeProperties, +} +impl AzureSqlDwLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureSqlDwLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure SQL Data Warehouse linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDwLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The ID of the service principal used to authenticate against Azure SQL Data Warehouse. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureSqlDwLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + encrypted_credential: None, + } + } +} +#[doc = "The Azure SQL Data Warehouse dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDwTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure SQL Data Warehouse dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureSqlDwTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure SQL Data Warehouse dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlDwTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The schema name of the Azure SQL Data Warehouse. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the Azure SQL Data Warehouse. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AzureSqlDwTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Microsoft Azure SQL Database linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure SQL Database linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureSqlDatabaseLinkedServiceTypeProperties, +} +impl AzureSqlDatabaseLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureSqlDatabaseLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure SQL Database linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlDatabaseLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The ID of the service principal used to authenticate against Azure SQL Database. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureSqlDatabaseLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + encrypted_credential: None, + } + } +} +#[doc = "Azure SQL Managed Instance linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlMiLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure SQL Managed Instance linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureSqlMiLinkedServiceTypeProperties, +} +impl AzureSqlMiLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureSqlMiLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure SQL Managed Instance linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlMiLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The ID of the service principal used to authenticate against Azure SQL Managed Instance. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureSqlMiLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + encrypted_credential: None, + } + } +} +#[doc = "The Azure SQL Managed Instance dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlMiTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure SQL Managed Instance dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureSqlMiTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure SQL Managed Instance dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlMiTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The schema name of the Azure SQL Managed Instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the Azure SQL Managed Instance dataset. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AzureSqlMiTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Azure SQL sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL writer stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_stored_procedure_name: Option, + #[doc = "SQL writer table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterTableType", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_table_type: Option, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "SQL stored procedure parameters."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "The stored procedure parameter name of the table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureTableTypeParameterName", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_table_type_parameter_name: Option, + #[doc = "The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableOption", default, skip_serializing_if = "Option::is_none")] + pub table_option: Option, +} +impl AzureSqlSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + sql_writer_stored_procedure_name: None, + sql_writer_table_type: None, + pre_copy_script: None, + stored_procedure_parameters: None, + stored_procedure_table_type_parameter_name: None, + table_option: None, + } + } +} +#[doc = "A copy activity Azure SQL source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "Which additional types to produce."] + #[serde(rename = "produceAdditionalTypes", default, skip_serializing_if = "Option::is_none")] + pub produce_additional_types: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl AzureSqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + produce_additional_types: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "The Azure SQL Server database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureSqlTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure SQL dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl AzureSqlTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Azure SQL dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureSqlTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The schema name of the Azure SQL database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the Azure SQL database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl AzureSqlTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The storage account linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureStorageLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Storage linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureStorageLinkedServiceTypeProperties, +} +impl AzureStorageLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureStorageLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Azure Storage linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct AzureStorageLinkedServiceTypeProperties { + #[doc = "The connection string. It is mutually exclusive with sasUri property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "SAS URI of the Azure Storage resource. It is mutually exclusive with connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "sasUri", default, skip_serializing_if = "Option::is_none")] + pub sas_uri: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl AzureStorageLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Azure Table storage dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Azure Table dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureTableDatasetTypeProperties, +} +impl AzureTableDataset { + pub fn new(dataset: Dataset, type_properties: AzureTableDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Azure Table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureTableDatasetTypeProperties { + #[doc = "The table name of the Azure Table storage. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName")] + pub table_name: serde_json::Value, +} +impl AzureTableDatasetTypeProperties { + pub fn new(table_name: serde_json::Value) -> Self { + Self { table_name } + } +} +#[doc = "A copy activity Azure Table sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureTableSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Azure Table default partition key value. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureTableDefaultPartitionKeyValue", default, skip_serializing_if = "Option::is_none")] + pub azure_table_default_partition_key_value: Option, + #[doc = "Azure Table partition key name. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureTablePartitionKeyName", default, skip_serializing_if = "Option::is_none")] + pub azure_table_partition_key_name: Option, + #[doc = "Azure Table row key name. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureTableRowKeyName", default, skip_serializing_if = "Option::is_none")] + pub azure_table_row_key_name: Option, + #[doc = "Azure Table insert type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureTableInsertType", default, skip_serializing_if = "Option::is_none")] + pub azure_table_insert_type: Option, +} +impl AzureTableSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + azure_table_default_partition_key_value: None, + azure_table_partition_key_name: None, + azure_table_row_key_name: None, + azure_table_insert_type: None, + } + } +} +#[doc = "A copy activity Azure Table source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureTableSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Azure Table source query. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureTableSourceQuery", default, skip_serializing_if = "Option::is_none")] + pub azure_table_source_query: Option, + #[doc = "Azure Table source ignore table not found. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "azureTableSourceIgnoreTableNotFound", default, skip_serializing_if = "Option::is_none")] + pub azure_table_source_ignore_table_not_found: Option, +} +impl AzureTableSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + azure_table_source_query: None, + azure_table_source_ignore_table_not_found: None, + } + } +} +#[doc = "The azure table storage linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AzureTableStorageLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Azure Storage linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: AzureStorageLinkedServiceTypeProperties, +} +impl AzureTableStorageLinkedService { + pub fn new(linked_service: LinkedService, type_properties: AzureStorageLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Big data pool reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BigDataPoolParametrizationReference { + #[doc = "Big data pool reference type."] + #[serde(rename = "type")] + pub type_: big_data_pool_parametrization_reference::Type, + #[doc = "Reference big data pool name. Type: string (or Expression with resultType string)."] + #[serde(rename = "referenceName")] + pub reference_name: serde_json::Value, +} +impl BigDataPoolParametrizationReference { + pub fn new(type_: big_data_pool_parametrization_reference::Type, reference_name: serde_json::Value) -> Self { + Self { type_, reference_name } + } +} +pub mod big_data_pool_parametrization_reference { + use super::*; + #[doc = "Big data pool reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BigDataPoolReference, + } +} +#[doc = "Big data pool reference."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BigDataPoolReference { + #[doc = "Big data pool reference type."] + #[serde(rename = "type")] + pub type_: big_data_pool_reference::Type, + #[doc = "Reference big data pool name."] + #[serde(rename = "referenceName")] + pub reference_name: String, +} +impl BigDataPoolReference { + pub fn new(type_: big_data_pool_reference::Type, reference_name: String) -> Self { + Self { type_, reference_name } + } +} +pub mod big_data_pool_reference { + use super::*; + #[doc = "Big data pool reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BigDataPoolReference, + } +} +#[doc = "A Big Data pool"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BigDataPoolResourceInfo { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Properties of a Big Data pool powered by Apache Spark"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl BigDataPoolResourceInfo { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + } + } +} +#[doc = "Collection of Big Data pool information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BigDataPoolResourceInfoListResult { + #[doc = "Link to the next page of results"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "List of Big Data pools"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl BigDataPoolResourceInfoListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a Big Data pool powered by Apache Spark"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct BigDataPoolResourceProperties { + #[doc = "The state of the Big Data pool."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Auto-scaling properties of a Big Data pool powered by Apache Spark"] + #[serde(rename = "autoScale", default, skip_serializing_if = "Option::is_none")] + pub auto_scale: Option, + #[doc = "The time when the Big Data pool was created."] + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, + #[doc = "Auto-pausing properties of a Big Data pool powered by Apache Spark"] + #[serde(rename = "autoPause", default, skip_serializing_if = "Option::is_none")] + pub auto_pause: Option, + #[doc = "Whether compute isolation is required or not."] + #[serde(rename = "isComputeIsolationEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_compute_isolation_enabled: Option, + #[doc = "Whether session level packages enabled."] + #[serde(rename = "sessionLevelPackagesEnabled", default, skip_serializing_if = "Option::is_none")] + pub session_level_packages_enabled: Option, + #[doc = "The cache size"] + #[serde(rename = "cacheSize", default, skip_serializing_if = "Option::is_none")] + pub cache_size: Option, + #[doc = "Dynamic Executor Allocation Properties"] + #[serde(rename = "dynamicExecutorAllocation", default, skip_serializing_if = "Option::is_none")] + pub dynamic_executor_allocation: Option, + #[doc = "The Spark events folder"] + #[serde(rename = "sparkEventsFolder", default, skip_serializing_if = "Option::is_none")] + pub spark_events_folder: Option, + #[doc = "The number of nodes in the Big Data pool."] + #[serde(rename = "nodeCount", default, skip_serializing_if = "Option::is_none")] + pub node_count: Option, + #[doc = "Library requirements for a Big Data pool powered by Apache Spark"] + #[serde(rename = "libraryRequirements", default, skip_serializing_if = "Option::is_none")] + pub library_requirements: Option, + #[doc = "List of custom libraries/packages associated with the spark pool."] + #[serde(rename = "customLibraries", default, skip_serializing_if = "Vec::is_empty")] + pub custom_libraries: Vec, + #[doc = "Library requirements for a Big Data pool powered by Apache Spark"] + #[serde(rename = "sparkConfigProperties", default, skip_serializing_if = "Option::is_none")] + pub spark_config_properties: Option, + #[doc = "The Apache Spark version."] + #[serde(rename = "sparkVersion", default, skip_serializing_if = "Option::is_none")] + pub spark_version: Option, + #[doc = "The default folder where Spark logs will be written."] + #[serde(rename = "defaultSparkLogFolder", default, skip_serializing_if = "Option::is_none")] + pub default_spark_log_folder: Option, + #[doc = "The level of compute power that each node in the Big Data pool has."] + #[serde(rename = "nodeSize", default, skip_serializing_if = "Option::is_none")] + pub node_size: Option, + #[doc = "The kind of nodes that the Big Data pool provides."] + #[serde(rename = "nodeSizeFamily", default, skip_serializing_if = "Option::is_none")] + pub node_size_family: Option, + #[doc = "The time when the Big Data pool was updated successfully."] + #[serde(rename = "lastSucceededTimestamp", default, skip_serializing_if = "Option::is_none")] + pub last_succeeded_timestamp: Option, +} +impl BigDataPoolResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod big_data_pool_resource_properties { + use super::*; + #[doc = "The level of compute power that each node in the Big Data pool has."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NodeSize { + None, + Small, + Medium, + Large, + XLarge, + #[serde(rename = "XXLarge")] + XxLarge, + #[serde(rename = "XXXLarge")] + XxxLarge, + } + #[doc = "The kind of nodes that the Big Data pool provides."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum NodeSizeFamily { + None, + MemoryOptimized, + } +} +#[doc = "Binary dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BinaryDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Binary dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl BinaryDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Binary dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BinaryDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl BinaryDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + compression: None, + } + } +} +#[doc = "Binary read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BinaryReadSettings { + #[serde(flatten)] + pub format_read_settings: FormatReadSettings, + #[doc = "Compression read settings."] + #[serde(rename = "compressionProperties", default, skip_serializing_if = "Option::is_none")] + pub compression_properties: Option, +} +impl BinaryReadSettings { + pub fn new(format_read_settings: FormatReadSettings) -> Self { + Self { + format_read_settings, + compression_properties: None, + } + } +} +#[doc = "A copy activity Binary sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BinarySink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, +} +impl BinarySink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + } + } +} +#[doc = "A copy activity Binary source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BinarySource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Binary read settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl BinarySource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + format_settings: None, + } + } +} +pub type BlobEventTypes = Vec; +#[doc = "Trigger that runs every time a Blob event occurs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobEventsTrigger { + #[serde(flatten)] + pub multiple_pipeline_trigger: MultiplePipelineTrigger, + #[doc = "Blob Events Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: blob_events_trigger::TypeProperties, +} +impl BlobEventsTrigger { + pub fn new(multiple_pipeline_trigger: MultiplePipelineTrigger, type_properties: blob_events_trigger::TypeProperties) -> Self { + Self { + multiple_pipeline_trigger, + type_properties, + } + } +} +pub mod blob_events_trigger { + use super::*; + #[doc = "Blob Events Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "The blob path must begin with the pattern provided for trigger to fire. For example, '/records/blobs/december/' will only fire the trigger for blobs in the december folder under the records container. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith."] + #[serde(rename = "blobPathBeginsWith", default, skip_serializing_if = "Option::is_none")] + pub blob_path_begins_with: Option, + #[doc = "The blob path must end with the pattern provided for trigger to fire. For example, 'december/boxes.csv' will only fire the trigger for blobs named boxes in a december folder. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith."] + #[serde(rename = "blobPathEndsWith", default, skip_serializing_if = "Option::is_none")] + pub blob_path_ends_with: Option, + #[doc = "If set to true, blobs with zero bytes will be ignored."] + #[serde(rename = "ignoreEmptyBlobs", default, skip_serializing_if = "Option::is_none")] + pub ignore_empty_blobs: Option, + #[doc = "Blob event types."] + pub events: BlobEventTypes, + #[doc = "The ARM resource ID of the Storage Account."] + pub scope: String, + } + impl TypeProperties { + pub fn new(events: BlobEventTypes, scope: String) -> Self { + Self { + blob_path_begins_with: None, + blob_path_ends_with: None, + ignore_empty_blobs: None, + events, + scope, + } + } + } +} +#[doc = "A copy activity Azure Blob sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Blob writer overwrite files. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "blobWriterOverwriteFiles", default, skip_serializing_if = "Option::is_none")] + pub blob_writer_overwrite_files: Option, + #[doc = "Blob writer date time format. Type: string (or Expression with resultType string)."] + #[serde(rename = "blobWriterDateTimeFormat", default, skip_serializing_if = "Option::is_none")] + pub blob_writer_date_time_format: Option, + #[doc = "Blob writer add header. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "blobWriterAddHeader", default, skip_serializing_if = "Option::is_none")] + pub blob_writer_add_header: Option, + #[doc = "The type of copy behavior for copy sink."] + #[serde(rename = "copyBehavior", default, skip_serializing_if = "Option::is_none")] + pub copy_behavior: Option, +} +impl BlobSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + blob_writer_overwrite_files: None, + blob_writer_date_time_format: None, + blob_writer_add_header: None, + copy_behavior: None, + } + } +} +#[doc = "A copy activity Azure Blob source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Treat empty as null. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "treatEmptyAsNull", default, skip_serializing_if = "Option::is_none")] + pub treat_empty_as_null: Option, + #[doc = "Number of header lines to skip from each blob. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "skipHeaderLineCount", default, skip_serializing_if = "Option::is_none")] + pub skip_header_line_count: Option, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, +} +impl BlobSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + treat_empty_as_null: None, + skip_header_line_count: None, + recursive: None, + } + } +} +#[doc = "Trigger that runs every time the selected Blob container changes."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobTrigger { + #[serde(flatten)] + pub multiple_pipeline_trigger: MultiplePipelineTrigger, + #[doc = "Blob Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: blob_trigger::TypeProperties, +} +impl BlobTrigger { + pub fn new(multiple_pipeline_trigger: MultiplePipelineTrigger, type_properties: blob_trigger::TypeProperties) -> Self { + Self { + multiple_pipeline_trigger, + type_properties, + } + } +} +pub mod blob_trigger { + use super::*; + #[doc = "Blob Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "The path of the container/folder that will trigger the pipeline."] + #[serde(rename = "folderPath")] + pub folder_path: String, + #[doc = "The max number of parallel files to handle when it is triggered."] + #[serde(rename = "maxConcurrency")] + pub max_concurrency: i64, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService")] + pub linked_service: LinkedServiceReference, + } + impl TypeProperties { + pub fn new(folder_path: String, max_concurrency: i64, linked_service: LinkedServiceReference) -> Self { + Self { + folder_path, + max_concurrency, + linked_service, + } + } + } +} +#[doc = "Linked service for Cassandra data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Cassandra linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CassandraLinkedServiceTypeProperties, +} +impl CassandraLinkedService { + pub fn new(linked_service: LinkedService, type_properties: CassandraLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Cassandra linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraLinkedServiceTypeProperties { + #[doc = "Host name for connection. Type: string (or Expression with resultType string)."] + pub host: serde_json::Value, + #[doc = "AuthenticationType to be used for connection. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The port for the connection. Type: integer (or Expression with resultType integer)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Username for authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl CassandraLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + authentication_type: None, + port: None, + username: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for a Cassandra database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Should be a SQL-92 query expression or Cassandra Query Language (CQL) command. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The consistency level specifies how many Cassandra servers must respond to a read request before returning data to the client application. Cassandra checks the specified number of Cassandra servers for data to satisfy the read request. Must be one of cassandraSourceReadConsistencyLevels. The default value is 'ONE'. It is case-insensitive."] + #[serde(rename = "consistencyLevel", default, skip_serializing_if = "Option::is_none")] + pub consistency_level: Option, +} +impl CassandraSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + consistency_level: None, + } + } +} +pub mod cassandra_source { + use super::*; + #[doc = "The consistency level specifies how many Cassandra servers must respond to a read request before returning data to the client application. Cassandra checks the specified number of Cassandra servers for data to satisfy the read request. Must be one of cassandraSourceReadConsistencyLevels. The default value is 'ONE'. It is case-insensitive."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ConsistencyLevel { + #[serde(rename = "ALL")] + All, + #[serde(rename = "EACH_QUORUM")] + EachQuorum, + #[serde(rename = "QUORUM")] + Quorum, + #[serde(rename = "LOCAL_QUORUM")] + LocalQuorum, + #[serde(rename = "ONE")] + One, + #[serde(rename = "TWO")] + Two, + #[serde(rename = "THREE")] + Three, + #[serde(rename = "LOCAL_ONE")] + LocalOne, + #[serde(rename = "SERIAL")] + Serial, + #[serde(rename = "LOCAL_SERIAL")] + LocalSerial, + } +} +#[doc = "The Cassandra database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Cassandra dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl CassandraTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Cassandra dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CassandraTableDatasetTypeProperties { + #[doc = "The table name of the Cassandra database. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The keyspace of the Cassandra database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keyspace: Option, +} +impl CassandraTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trigger that allows the referenced pipeline to depend on other pipeline runs based on runDimension Name/Value pairs. Upstream pipelines should declare the same runDimension Name and their runs should have the values for those runDimensions. The referenced pipeline run would be triggered if the values for the runDimension match for all upstream pipeline runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ChainingTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "Pipeline that needs to be triggered with the given parameters."] + pub pipeline: TriggerPipelineReference, + #[doc = "Chaining Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: chaining_trigger::TypeProperties, +} +impl ChainingTrigger { + pub fn new(trigger: Trigger, pipeline: TriggerPipelineReference, type_properties: chaining_trigger::TypeProperties) -> Self { + Self { + trigger, + pipeline, + type_properties, + } + } +} +pub mod chaining_trigger { + use super::*; + #[doc = "Chaining Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "Upstream Pipelines."] + #[serde(rename = "dependsOn")] + pub depends_on: Vec, + #[doc = "Run Dimension property that needs to be emitted by upstream pipelines."] + #[serde(rename = "runDimension")] + pub run_dimension: String, + } + impl TypeProperties { + pub fn new(depends_on: Vec, run_dimension: String) -> Self { + Self { depends_on, run_dimension } + } + } +} +#[doc = "The object that defines the structure of an Azure Synapse error response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[doc = "The object that defines the structure of an Azure Synapse error."] + pub error: CloudErrorBody, +} +impl CloudError { + pub fn new(error: CloudErrorBody) -> Self { + Self { error } + } +} +#[doc = "The object that defines the structure of an Azure Synapse error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudErrorBody { + #[doc = "Error code."] + pub code: String, + #[doc = "Error message."] + pub message: String, + #[doc = "Property name/path in request associated with error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "Array with additional error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, +} +impl CloudErrorBody { + pub fn new(code: String, message: String) -> Self { + Self { + code, + message, + target: None, + details: Vec::new(), + } + } +} +#[doc = "The Common Data Service for Apps entity dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonDataServiceForAppsEntityDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Common Data Service for Apps entity dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl CommonDataServiceForAppsEntityDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Common Data Service for Apps entity dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CommonDataServiceForAppsEntityDatasetTypeProperties { + #[doc = "The logical name of the entity. Type: string (or Expression with resultType string)."] + #[serde(rename = "entityName", default, skip_serializing_if = "Option::is_none")] + pub entity_name: Option, +} +impl CommonDataServiceForAppsEntityDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common Data Service for Apps linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonDataServiceForAppsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Common Data Service for Apps linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CommonDataServiceForAppsLinkedServiceTypeProperties, +} +impl CommonDataServiceForAppsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: CommonDataServiceForAppsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Common Data Service for Apps linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonDataServiceForAppsLinkedServiceTypeProperties { + #[doc = "The deployment type of the Common Data Service for Apps instance. 'Online' for Common Data Service for Apps Online and 'OnPremisesWithIfd' for Common Data Service for Apps on-premises with Ifd. Type: string (or Expression with resultType string)."] + #[serde(rename = "deploymentType")] + pub deployment_type: serde_json::Value, + #[doc = "The host name of the on-premises Common Data Service for Apps server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string)."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "The port of on-premises Common Data Service for Apps server. The property is required for on-prem and not allowed for online. Default is 443. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The URL to the Microsoft Common Data Service for Apps server. The property is required for on-line and not allowed for on-prem. Type: string (or Expression with resultType string)."] + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[doc = "The organization name of the Common Data Service for Apps instance. The property is required for on-prem and required for online when there are more than one Common Data Service for Apps instances associated with the user. Type: string (or Expression with resultType string)."] + #[serde(rename = "organizationName", default, skip_serializing_if = "Option::is_none")] + pub organization_name: Option, + #[doc = "The authentication type to connect to Common Data Service for Apps server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType")] + pub authentication_type: serde_json::Value, + #[doc = "User name to access the Common Data Service for Apps instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The client ID of the application in Azure Active Directory used for Server-To-Server authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "A string from ServicePrincipalCredentialEnum or an expression"] + #[serde(rename = "servicePrincipalCredentialType", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalCredential", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl CommonDataServiceForAppsLinkedServiceTypeProperties { + pub fn new(deployment_type: serde_json::Value, authentication_type: serde_json::Value) -> Self { + Self { + deployment_type, + host_name: None, + port: None, + service_uri: None, + organization_name: None, + authentication_type, + username: None, + password: None, + service_principal_id: None, + service_principal_credential_type: None, + service_principal_credential: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Common Data Service for Apps sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonDataServiceForAppsSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Defines values for DynamicsSinkWriteBehavior."] + #[serde(rename = "writeBehavior")] + pub write_behavior: DynamicsSinkWriteBehavior, + #[doc = "The flag indicating whether to ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "ignoreNullValues", default, skip_serializing_if = "Option::is_none")] + pub ignore_null_values: Option, + #[doc = "The logical name of the alternate key which will be used when upserting records. Type: string (or Expression with resultType string)."] + #[serde(rename = "alternateKeyName", default, skip_serializing_if = "Option::is_none")] + pub alternate_key_name: Option, +} +impl CommonDataServiceForAppsSink { + pub fn new(copy_sink: CopySink, write_behavior: DynamicsSinkWriteBehavior) -> Self { + Self { + copy_sink, + write_behavior, + ignore_null_values: None, + alternate_key_name: None, + } + } +} +#[doc = "A copy activity Common Data Service for Apps source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CommonDataServiceForAppsSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "FetchXML is a proprietary query language that is used in Microsoft Common Data Service for Apps (online & on-premises). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl CommonDataServiceForAppsSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[doc = "All available compressionCodec values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CompressionCodec { + #[serde(rename = "none")] + None, + #[serde(rename = "lzo")] + Lzo, + #[serde(rename = "bzip2")] + Bzip2, + #[serde(rename = "gzip")] + Gzip, + #[serde(rename = "deflate")] + Deflate, + #[serde(rename = "zipDeflate")] + ZipDeflate, + #[serde(rename = "snappy")] + Snappy, + #[serde(rename = "lz4")] + Lz4, + #[serde(rename = "tar")] + Tar, + #[serde(rename = "tarGZip")] + TarGZip, +} +#[doc = "All available compression levels."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CompressionLevel {} +impl CompressionLevel { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Compression read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CompressionReadSettings { + #[doc = "The Compression setting type."] + #[serde(rename = "type")] + pub type_: String, +} +impl CompressionReadSettings { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Concur Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConcurLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Concur Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ConcurLinkedServiceTypeProperties, +} +impl ConcurLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ConcurLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Concur Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConcurLinkedServiceTypeProperties { + #[doc = "Properties used to connect to Concur. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "Application client_id supplied by Concur App Management."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The user name that you use to access Concur Service."] + pub username: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ConcurLinkedServiceTypeProperties { + pub fn new(client_id: serde_json::Value, username: serde_json::Value) -> Self { + Self { + connection_properties: None, + client_id, + username, + password: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Concur Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConcurObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ConcurObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Concur Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConcurSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ConcurSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Base class for all control activities like IfCondition, ForEach , Until."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ControlActivity { + #[serde(flatten)] + pub activity: Activity, +} +impl ControlActivity { + pub fn new(activity: Activity) -> Self { + Self { activity } + } +} +#[doc = "Copy activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Copy activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CopyActivityTypeProperties, + #[doc = "List of inputs for the activity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub inputs: Vec, + #[doc = "List of outputs for the activity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub outputs: Vec, +} +impl CopyActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: CopyActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + inputs: Vec::new(), + outputs: Vec::new(), + } + } +} +#[doc = "Settings for copy activity log."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CopyActivityLogSettings { + #[doc = "Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string)."] + #[serde(rename = "logLevel", default, skip_serializing_if = "Option::is_none")] + pub log_level: Option, + #[doc = "Specifies whether to enable reliable logging. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableReliableLogging", default, skip_serializing_if = "Option::is_none")] + pub enable_reliable_logging: Option, +} +impl CopyActivityLogSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Copy activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyActivityTypeProperties { + #[doc = "A copy activity source."] + pub source: CopySource, + #[doc = "A copy activity sink."] + pub sink: CopySink, + #[doc = "Copy activity translator. If not specified, tabular translator is used."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub translator: Option, + #[doc = "Specifies whether to copy data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableStaging", default, skip_serializing_if = "Option::is_none")] + pub enable_staging: Option, + #[doc = "Staging settings."] + #[serde(rename = "stagingSettings", default, skip_serializing_if = "Option::is_none")] + pub staging_settings: Option, + #[doc = "Maximum number of concurrent sessions opened on the source or sink to avoid overloading the data store. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(rename = "parallelCopies", default, skip_serializing_if = "Option::is_none")] + pub parallel_copies: Option, + #[doc = "Maximum number of data integration units that can be used to perform this data movement. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(rename = "dataIntegrationUnits", default, skip_serializing_if = "Option::is_none")] + pub data_integration_units: Option, + #[doc = "Whether to skip incompatible row. Default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableSkipIncompatibleRow", default, skip_serializing_if = "Option::is_none")] + pub enable_skip_incompatible_row: Option, + #[doc = "Redirect incompatible row settings"] + #[serde(rename = "redirectIncompatibleRowSettings", default, skip_serializing_if = "Option::is_none")] + pub redirect_incompatible_row_settings: Option, + #[doc = "(Deprecated. Please use LogSettings) Log storage settings."] + #[serde(rename = "logStorageSettings", default, skip_serializing_if = "Option::is_none")] + pub log_storage_settings: Option, + #[doc = "Log settings."] + #[serde(rename = "logSettings", default, skip_serializing_if = "Option::is_none")] + pub log_settings: Option, + #[doc = "Preserve Rules."] + #[serde(rename = "preserveRules", default, skip_serializing_if = "Vec::is_empty")] + pub preserve_rules: Vec, + #[doc = "Preserve rules."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub preserve: Vec, + #[doc = "Whether to enable Data Consistency validation. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "validateDataConsistency", default, skip_serializing_if = "Option::is_none")] + pub validate_data_consistency: Option, + #[doc = "Skip error file."] + #[serde(rename = "skipErrorFile", default, skip_serializing_if = "Option::is_none")] + pub skip_error_file: Option, +} +impl CopyActivityTypeProperties { + pub fn new(source: CopySource, sink: CopySink) -> Self { + Self { + source, + sink, + translator: None, + enable_staging: None, + staging_settings: None, + parallel_copies: None, + data_integration_units: None, + enable_skip_incompatible_row: None, + redirect_incompatible_row_settings: None, + log_storage_settings: None, + log_settings: None, + preserve_rules: Vec::new(), + preserve: Vec::new(), + validate_data_consistency: None, + skip_error_file: None, + } + } +} +#[doc = "All available types of copy behavior."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CopyBehaviorType { + PreserveHierarchy, + FlattenHierarchy, + MergeFiles, +} +#[doc = "A copy activity sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopySink { + #[doc = "Copy sink type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Write batch size. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(rename = "writeBatchSize", default, skip_serializing_if = "Option::is_none")] + pub write_batch_size: Option, + #[doc = "Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "writeBatchTimeout", default, skip_serializing_if = "Option::is_none")] + pub write_batch_timeout: Option, + #[doc = "Sink retry count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "sinkRetryCount", default, skip_serializing_if = "Option::is_none")] + pub sink_retry_count: Option, + #[doc = "Sink retry wait. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "sinkRetryWait", default, skip_serializing_if = "Option::is_none")] + pub sink_retry_wait: Option, + #[doc = "The maximum concurrent connection count for the sink data store. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxConcurrentConnections", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_connections: Option, +} +impl CopySink { + pub fn new(type_: String) -> Self { + Self { + type_, + write_batch_size: None, + write_batch_timeout: None, + sink_retry_count: None, + sink_retry_wait: None, + max_concurrent_connections: None, + } + } +} +#[doc = "A copy activity source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopySource { + #[doc = "Copy source type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Source retry count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "sourceRetryCount", default, skip_serializing_if = "Option::is_none")] + pub source_retry_count: Option, + #[doc = "Source retry wait. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "sourceRetryWait", default, skip_serializing_if = "Option::is_none")] + pub source_retry_wait: Option, + #[doc = "The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxConcurrentConnections", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_connections: Option, +} +impl CopySource { + pub fn new(type_: String) -> Self { + Self { + type_, + source_retry_count: None, + source_retry_wait: None, + max_concurrent_connections: None, + } + } +} +#[doc = "A copy activity translator."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CopyTranslator { + #[doc = "Copy translator type."] + #[serde(rename = "type")] + pub type_: String, +} +impl CopyTranslator { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Microsoft Azure Cosmos Database (CosmosDB) linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "CosmosDB linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CosmosDbLinkedServiceTypeProperties, +} +impl CosmosDbLinkedService { + pub fn new(linked_service: LinkedService, type_properties: CosmosDbLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "CosmosDB linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CosmosDbLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "The endpoint of the Azure CosmosDB account. Type: string (or Expression with resultType string)"] + #[serde(rename = "accountEndpoint", default, skip_serializing_if = "Option::is_none")] + pub account_endpoint: Option, + #[doc = "The name of the database. Type: string (or Expression with resultType string)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accountKey", default, skip_serializing_if = "Option::is_none")] + pub account_key: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl CosmosDbLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The CosmosDB (MongoDB API) database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiCollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "CosmosDB (MongoDB API) database dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CosmosDbMongoDbApiCollectionDatasetTypeProperties, +} +impl CosmosDbMongoDbApiCollectionDataset { + pub fn new(dataset: Dataset, type_properties: CosmosDbMongoDbApiCollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "CosmosDB (MongoDB API) database dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiCollectionDatasetTypeProperties { + #[doc = "The collection name of the CosmosDB (MongoDB API) database. Type: string (or Expression with resultType string)."] + pub collection: serde_json::Value, +} +impl CosmosDbMongoDbApiCollectionDatasetTypeProperties { + pub fn new(collection: serde_json::Value) -> Self { + Self { collection } + } +} +#[doc = "Linked service for CosmosDB (MongoDB API) data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "CosmosDB (MongoDB API) linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CosmosDbMongoDbApiLinkedServiceTypeProperties, +} +impl CosmosDbMongoDbApiLinkedService { + pub fn new(linked_service: LinkedService, type_properties: CosmosDbMongoDbApiLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "CosmosDB (MongoDB API) linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiLinkedServiceTypeProperties { + #[doc = "The CosmosDB (MongoDB API) connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The name of the CosmosDB (MongoDB API) database that you want to access. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, +} +impl CosmosDbMongoDbApiLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value, database: serde_json::Value) -> Self { + Self { + connection_string, + database, + } + } +} +#[doc = "A copy activity sink for a CosmosDB (MongoDB API) database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Specifies whether the document with same key to be overwritten (upsert) rather than throw exception (insert). The default value is \"insert\". Type: string (or Expression with resultType string). Type: string (or Expression with resultType string)."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, +} +impl CosmosDbMongoDbApiSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + } + } +} +#[doc = "A copy activity source for a CosmosDB (MongoDB API) database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbMongoDbApiSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Specifies selection filter using query operators. To return all documents in a collection, omit this parameter or pass an empty document ({}). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[doc = "Cursor methods for Mongodb query"] + #[serde(rename = "cursorMethods", default, skip_serializing_if = "Option::is_none")] + pub cursor_methods: Option, + #[doc = "Specifies the number of documents to return in each batch of the response from MongoDB instance. In most cases, modifying the batch size will not affect the user or the application. This property's main purpose is to avoid hit the limitation of response size. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "batchSize", default, skip_serializing_if = "Option::is_none")] + pub batch_size: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl CosmosDbMongoDbApiSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + filter: None, + cursor_methods: None, + batch_size: None, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "Microsoft Azure CosmosDB (SQL API) Collection dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbSqlApiCollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "CosmosDB (SQL API) Collection dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CosmosDbSqlApiCollectionDatasetTypeProperties, +} +impl CosmosDbSqlApiCollectionDataset { + pub fn new(dataset: Dataset, type_properties: CosmosDbSqlApiCollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "CosmosDB (SQL API) Collection dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbSqlApiCollectionDatasetTypeProperties { + #[doc = "CosmosDB (SQL API) collection name. Type: string (or Expression with resultType string)."] + #[serde(rename = "collectionName")] + pub collection_name: serde_json::Value, +} +impl CosmosDbSqlApiCollectionDatasetTypeProperties { + pub fn new(collection_name: serde_json::Value) -> Self { + Self { collection_name } + } +} +#[doc = "A copy activity Azure CosmosDB (SQL API) Collection sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbSqlApiSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Describes how to write data to Azure Cosmos DB. Type: string (or Expression with resultType string). Allowed values: insert and upsert."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, +} +impl CosmosDbSqlApiSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + } + } +} +#[doc = "A copy activity Azure CosmosDB (SQL API) Collection source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CosmosDbSqlApiSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "SQL API query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Page size of the result. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "pageSize", default, skip_serializing_if = "Option::is_none")] + pub page_size: Option, + #[doc = "Preferred regions. Type: array of strings (or Expression with resultType array of strings)."] + #[serde(rename = "preferredRegions", default, skip_serializing_if = "Option::is_none")] + pub preferred_regions: Option, + #[doc = "Whether detect primitive values as datetime values. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "detectDatetime", default, skip_serializing_if = "Option::is_none")] + pub detect_datetime: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl CosmosDbSqlApiSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + page_size: None, + preferred_regions: None, + detect_datetime: None, + additional_columns: None, + } + } +} +#[doc = "Couchbase server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CouchbaseLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Couchbase server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CouchbaseLinkedServiceTypeProperties, +} +impl CouchbaseLinkedService { + pub fn new(linked_service: LinkedService, type_properties: CouchbaseLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Couchbase server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CouchbaseLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(rename = "credString", default, skip_serializing_if = "Option::is_none")] + pub cred_string: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl CouchbaseLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Couchbase server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CouchbaseSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl CouchbaseSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Couchbase server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CouchbaseTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl CouchbaseTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Request body structure for creating data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateDataFlowDebugSessionRequest { + #[doc = "Compute type of the cluster. The value will be overwritten by the same setting in integration runtime if provided."] + #[serde(rename = "computeType", default, skip_serializing_if = "Option::is_none")] + pub compute_type: Option, + #[doc = "Core count of the cluster. The value will be overwritten by the same setting in integration runtime if provided."] + #[serde(rename = "coreCount", default, skip_serializing_if = "Option::is_none")] + pub core_count: Option, + #[doc = "Time to live setting of the cluster in minutes."] + #[serde(rename = "timeToLive", default, skip_serializing_if = "Option::is_none")] + pub time_to_live: Option, + #[doc = "Integration runtime debug resource."] + #[serde(rename = "integrationRuntime", default, skip_serializing_if = "Option::is_none")] + pub integration_runtime: Option, +} +impl CreateDataFlowDebugSessionRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response body structure for creating data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CreateDataFlowDebugSessionResponse { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} +impl CreateDataFlowDebugSessionResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response body with a run identifier."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateRunResponse { + #[doc = "Identifier of a run."] + #[serde(rename = "runId")] + pub run_id: String, +} +impl CreateRunResponse { + pub fn new(run_id: String) -> Self { + Self { run_id } + } +} +#[doc = "Custom activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Custom activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: CustomActivityTypeProperties, +} +impl CustomActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: CustomActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Reference objects for custom activity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomActivityReferenceObject { + #[doc = "Linked service references."] + #[serde(rename = "linkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub linked_services: Vec, + #[doc = "Dataset references."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datasets: Vec, +} +impl CustomActivityReferenceObject { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Custom activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomActivityTypeProperties { + #[doc = "Command for custom activity Type: string (or Expression with resultType string)."] + pub command: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "resourceLinkedService", default, skip_serializing_if = "Option::is_none")] + pub resource_linked_service: Option, + #[doc = "Folder path for resource files Type: string (or Expression with resultType string)."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "Reference objects for custom activity"] + #[serde(rename = "referenceObjects", default, skip_serializing_if = "Option::is_none")] + pub reference_objects: Option, + #[doc = "User defined property bag. There is no restriction on the keys or values that can be used. The user specified custom activity has the full responsibility to consume and interpret the content defined."] + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, + #[doc = "The retention time for the files submitted for custom activity. Type: double (or Expression with resultType double)."] + #[serde(rename = "retentionTimeInDays", default, skip_serializing_if = "Option::is_none")] + pub retention_time_in_days: Option, + #[doc = "Elevation level and scope for the user, default is nonadmin task. Type: string (or Expression with resultType double)."] + #[serde(rename = "autoUserSpecification", default, skip_serializing_if = "Option::is_none")] + pub auto_user_specification: Option, +} +impl CustomActivityTypeProperties { + pub fn new(command: serde_json::Value) -> Self { + Self { + command, + resource_linked_service: None, + folder_path: None, + reference_objects: None, + extended_properties: None, + retention_time_in_days: None, + auto_user_specification: None, + } + } +} +#[doc = "Custom linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDataSourceLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Custom linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: serde_json::Value, +} +impl CustomDataSourceLinkedService { + pub fn new(linked_service: LinkedService, type_properties: serde_json::Value) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "The custom dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Custom dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl CustomDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Trigger that runs every time a custom event is received."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomEventsTrigger { + #[serde(flatten)] + pub multiple_pipeline_trigger: MultiplePipelineTrigger, + #[doc = "Custom Events Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: custom_events_trigger::TypeProperties, +} +impl CustomEventsTrigger { + pub fn new(multiple_pipeline_trigger: MultiplePipelineTrigger, type_properties: custom_events_trigger::TypeProperties) -> Self { + Self { + multiple_pipeline_trigger, + type_properties, + } + } +} +pub mod custom_events_trigger { + use super::*; + #[doc = "Custom Events Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "The event subject must begin with the pattern provided for trigger to fire. At least one of these must be provided: subjectBeginsWith, subjectEndsWith."] + #[serde(rename = "subjectBeginsWith", default, skip_serializing_if = "Option::is_none")] + pub subject_begins_with: Option, + #[doc = "The event subject must end with the pattern provided for trigger to fire. At least one of these must be provided: subjectBeginsWith, subjectEndsWith."] + #[serde(rename = "subjectEndsWith", default, skip_serializing_if = "Option::is_none")] + pub subject_ends_with: Option, + #[doc = "The list of event types that cause this trigger to fire."] + pub events: Vec, + #[doc = "The ARM resource ID of the Azure Event Grid Topic."] + pub scope: String, + } + impl TypeProperties { + pub fn new(events: Vec, scope: String) -> Self { + Self { + subject_begins_with: None, + subject_ends_with: None, + events, + scope, + } + } + } +} +#[doc = "Details of the customer managed key associated with the workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct CustomerManagedKeyDetails { + #[doc = "The customer managed key status on the workspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Details of the customer managed key associated with the workspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, +} +impl CustomerManagedKeyDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Default value."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DwCopyCommandDefaultValue { + #[doc = "Column name. Type: object (or Expression with resultType string)."] + #[serde(rename = "columnName", default, skip_serializing_if = "Option::is_none")] + pub column_name: Option, + #[doc = "The default value of the column. Type: object (or Expression with resultType string)."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, +} +impl DwCopyCommandDefaultValue { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DW Copy Command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DwCopyCommandSettings { + #[doc = "Specifies the default values for each target column in SQL DW. The default values in the property overwrite the DEFAULT constraint set in the DB, and identity column cannot have a default value. Type: array of objects (or Expression with resultType array of objects)."] + #[serde(rename = "defaultValues", default, skip_serializing_if = "Vec::is_empty")] + pub default_values: Vec, + #[doc = "Additional options directly passed to SQL DW in Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: \"additionalOptions\": { \"MAXERRORS\": \"1000\", \"DATEFORMAT\": \"'ymd'\" }"] + #[serde(rename = "additionalOptions", default, skip_serializing_if = "Option::is_none")] + pub additional_options: Option, +} +impl DwCopyCommandSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Synapse nested object which contains a flow with data movements and transformations."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlow { + #[doc = "Type of data flow."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "The description of the data flow."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "List of tags that can be used for describing the data flow."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, + #[doc = "The folder that this data flow is in. If not specified, Data flow will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl DataFlow { + pub fn new(type_: String) -> Self { + Self { + type_, + description: None, + annotations: Vec::new(), + folder: None, + } + } +} +pub mod data_flow { + use super::*; + #[doc = "The folder that this data flow is in. If not specified, Data flow will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this data flow is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Structure of command payload."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowDebugCommandPayload { + #[doc = "The stream name which is used for preview."] + #[serde(rename = "streamName")] + pub stream_name: String, + #[doc = "Row limits for preview response."] + #[serde(rename = "rowLimits", default, skip_serializing_if = "Option::is_none")] + pub row_limits: Option, + #[doc = "Array of column names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, + #[doc = "The expression which is used for preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, +} +impl DataFlowDebugCommandPayload { + pub fn new(stream_name: String) -> Self { + Self { + stream_name, + row_limits: None, + columns: Vec::new(), + expression: None, + } + } +} +#[doc = "Request body structure for data flow expression preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugCommandRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The command type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub command: Option, + #[doc = "Structure of command payload."] + #[serde(rename = "commandPayload", default, skip_serializing_if = "Option::is_none")] + pub command_payload: Option, +} +impl DataFlowDebugCommandRequest { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_flow_debug_command_request { + use super::*; + #[doc = "The command type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Command { + #[serde(rename = "executePreviewQuery")] + ExecutePreviewQuery, + #[serde(rename = "executeStatisticsQuery")] + ExecuteStatisticsQuery, + #[serde(rename = "executeExpressionQuery")] + ExecuteExpressionQuery, + } +} +#[doc = "Response body structure of data flow result for data preview, statistics or expression preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugCommandResponse { + #[doc = "The run status of data preview, statistics or expression preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The result data of data preview, statistics or expression preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, +} +impl DataFlowDebugCommandResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body structure for starting data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugPackage { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "Data flow debug resource."] + #[serde(rename = "dataFlow", default, skip_serializing_if = "Option::is_none")] + pub data_flow: Option, + #[doc = "List of Data flows"] + #[serde(rename = "dataFlows", default, skip_serializing_if = "Vec::is_empty")] + pub data_flows: Vec, + #[doc = "List of datasets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datasets: Vec, + #[doc = "List of linked services."] + #[serde(rename = "linkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub linked_services: Vec, + #[doc = "Staging info for execute data flow activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub staging: Option, + #[doc = "Data flow debug settings."] + #[serde(rename = "debugSettings", default, skip_serializing_if = "Option::is_none")] + pub debug_settings: Option, +} +impl DataFlowDebugPackage { + pub fn new() -> Self { + Self::default() + } +} +pub mod data_flow_debug_package { + use super::*; + #[doc = "Data flow debug settings."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct DebugSettings { + #[doc = "Source setting for data flow debug."] + #[serde(rename = "sourceSettings", default, skip_serializing_if = "Vec::is_empty")] + pub source_settings: Vec, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "Parameters for dataset."] + #[serde(rename = "datasetParameters", default, skip_serializing_if = "Option::is_none")] + pub dataset_parameters: Option, + } + impl DebugSettings { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Request body structure for data flow preview data."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugPreviewDataRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The data flow which contains the debug session."] + #[serde(rename = "dataFlowName", default, skip_serializing_if = "Option::is_none")] + pub data_flow_name: Option, + #[doc = "The output stream name."] + #[serde(rename = "streamName", default, skip_serializing_if = "Option::is_none")] + pub stream_name: Option, + #[doc = "The row limit for preview request."] + #[serde(rename = "rowLimits", default, skip_serializing_if = "Option::is_none")] + pub row_limits: Option, +} +impl DataFlowDebugPreviewDataRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response body structure of data flow query for data preview, statistics or expression preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugQueryResponse { + #[doc = "The run ID of data flow debug session."] + #[serde(rename = "runId", default, skip_serializing_if = "Option::is_none")] + pub run_id: Option, +} +impl DataFlowDebugQueryResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Data flow debug resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowDebugResource { + #[serde(flatten)] + pub sub_resource_debug_resource: SubResourceDebugResource, + #[doc = "Azure Synapse nested object which contains a flow with data movements and transformations."] + pub properties: DataFlow, +} +impl DataFlowDebugResource { + pub fn new(properties: DataFlow) -> Self { + Self { + sub_resource_debug_resource: SubResourceDebugResource::default(), + properties, + } + } +} +#[doc = "Response body structure of data flow result for data preview, statistics or expression preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugResultResponse { + #[doc = "The run status of data preview, statistics or expression preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The result data of data preview, statistics or expression preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, +} +impl DataFlowDebugResultResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Data flow debug session info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugSessionInfo { + #[doc = "The name of the data flow."] + #[serde(rename = "dataFlowName", default, skip_serializing_if = "Option::is_none")] + pub data_flow_name: Option, + #[doc = "Compute type of the cluster."] + #[serde(rename = "computeType", default, skip_serializing_if = "Option::is_none")] + pub compute_type: Option, + #[doc = "Core count of the cluster."] + #[serde(rename = "coreCount", default, skip_serializing_if = "Option::is_none")] + pub core_count: Option, + #[doc = "Node count of the cluster. (deprecated property)"] + #[serde(rename = "nodeCount", default, skip_serializing_if = "Option::is_none")] + pub node_count: Option, + #[doc = "Attached integration runtime name of data flow debug session."] + #[serde(rename = "integrationRuntimeName", default, skip_serializing_if = "Option::is_none")] + pub integration_runtime_name: Option, + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "Start time of data flow debug session."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Compute type of the cluster."] + #[serde(rename = "timeToLiveInMinutes", default, skip_serializing_if = "Option::is_none")] + pub time_to_live_in_minutes: Option, + #[doc = "Last activity time of data flow debug session."] + #[serde(rename = "lastActivityTime", default, skip_serializing_if = "Option::is_none")] + pub last_activity_time: Option, +} +impl DataFlowDebugSessionInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body structure for data flow statistics."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowDebugStatisticsRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The data flow which contains the debug session."] + #[serde(rename = "dataFlowName", default, skip_serializing_if = "Option::is_none")] + pub data_flow_name: Option, + #[doc = "The output stream name."] + #[serde(rename = "streamName", default, skip_serializing_if = "Option::is_none")] + pub stream_name: Option, + #[doc = "List of column names."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, +} +impl DataFlowDebugStatisticsRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of data flow resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowListResponse { + #[doc = "List of data flows."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DataFlowListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Data flow reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowReference { + #[doc = "Data flow reference type."] + #[serde(rename = "type")] + pub type_: data_flow_reference::Type, + #[doc = "Reference data flow name."] + #[serde(rename = "referenceName")] + pub reference_name: String, + #[doc = "Reference data flow parameters from dataset."] + #[serde(rename = "datasetParameters", default, skip_serializing_if = "Option::is_none")] + pub dataset_parameters: Option, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl DataFlowReference { + pub fn new(type_: data_flow_reference::Type, reference_name: String) -> Self { + Self { + type_, + reference_name, + dataset_parameters: None, + parameters: None, + } + } +} +pub mod data_flow_reference { + use super::*; + #[doc = "Data flow reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + DataFlowReference, + } +} +#[doc = "Data flow resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Azure Synapse nested object which contains a flow with data movements and transformations."] + pub properties: DataFlow, +} +impl DataFlowResource { + pub fn new(properties: DataFlow) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Transformation for data flow sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowSink { + #[serde(flatten)] + pub transformation: Transformation, + #[doc = "Dataset reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dataset: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "schemaLinkedService", default, skip_serializing_if = "Option::is_none")] + pub schema_linked_service: Option, + #[doc = "Data flow reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub flowlet: Option, +} +impl DataFlowSink { + pub fn new(transformation: Transformation) -> Self { + Self { + transformation, + dataset: None, + linked_service: None, + schema_linked_service: None, + flowlet: None, + } + } +} +#[doc = "Transformation for data flow source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataFlowSource { + #[serde(flatten)] + pub transformation: Transformation, + #[doc = "Dataset reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dataset: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "schemaLinkedService", default, skip_serializing_if = "Option::is_none")] + pub schema_linked_service: Option, + #[doc = "Data flow reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub flowlet: Option, +} +impl DataFlowSource { + pub fn new(transformation: Transformation) -> Self { + Self { + transformation, + dataset: None, + linked_service: None, + schema_linked_service: None, + flowlet: None, + } + } +} +#[doc = "Definition of data flow source setting for debug."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowSourceSetting { + #[doc = "The data flow source name."] + #[serde(rename = "sourceName", default, skip_serializing_if = "Option::is_none")] + pub source_name: Option, + #[doc = "Defines the row limit of data flow source in debug."] + #[serde(rename = "rowLimit", default, skip_serializing_if = "Option::is_none")] + pub row_limit: Option, +} +impl DataFlowSourceSetting { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Staging info for execute data flow activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataFlowStagingInfo { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[doc = "Folder path for staging blob."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, +} +impl DataFlowStagingInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Data Lake Analytics U-SQL activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataLakeAnalyticsUsqlActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "DataLakeAnalyticsU-SQL activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataLakeAnalyticsUsqlActivityTypeProperties, +} +impl DataLakeAnalyticsUsqlActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: DataLakeAnalyticsUsqlActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "DataLakeAnalyticsU-SQL activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataLakeAnalyticsUsqlActivityTypeProperties { + #[doc = "Case-sensitive path to folder that contains the U-SQL script. Type: string (or Expression with resultType string)."] + #[serde(rename = "scriptPath")] + pub script_path: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "scriptLinkedService")] + pub script_linked_service: LinkedServiceReference, + #[doc = "The maximum number of nodes simultaneously used to run the job. Default value is 1. Type: integer (or Expression with resultType integer), minimum: 1."] + #[serde(rename = "degreeOfParallelism", default, skip_serializing_if = "Option::is_none")] + pub degree_of_parallelism: Option, + #[doc = "Determines which jobs out of all that are queued should be selected to run first. The lower the number, the higher the priority. Default value is 1000. Type: integer (or Expression with resultType integer), minimum: 1."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[doc = "Parameters for U-SQL job request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "Runtime version of the U-SQL engine to use. Type: string (or Expression with resultType string)."] + #[serde(rename = "runtimeVersion", default, skip_serializing_if = "Option::is_none")] + pub runtime_version: Option, + #[doc = "Compilation mode of U-SQL. Must be one of these values : Semantic, Full and SingleBox. Type: string (or Expression with resultType string)."] + #[serde(rename = "compilationMode", default, skip_serializing_if = "Option::is_none")] + pub compilation_mode: Option, +} +impl DataLakeAnalyticsUsqlActivityTypeProperties { + pub fn new(script_path: serde_json::Value, script_linked_service: LinkedServiceReference) -> Self { + Self { + script_path, + script_linked_service, + degree_of_parallelism: None, + priority: None, + parameters: None, + runtime_version: None, + compilation_mode: None, + } + } +} +#[doc = "Details of the data lake storage account associated with the workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DataLakeStorageAccountDetails { + #[doc = "Account URL"] + #[serde(rename = "accountUrl", default, skip_serializing_if = "Option::is_none")] + pub account_url: Option, + #[doc = "Filesystem name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filesystem: Option, +} +impl DataLakeStorageAccountDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "DatabricksNotebook activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksNotebookActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Databricks Notebook activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DatabricksNotebookActivityTypeProperties, +} +impl DatabricksNotebookActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: DatabricksNotebookActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Databricks Notebook activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksNotebookActivityTypeProperties { + #[doc = "The absolute path of the notebook to be run in the Databricks Workspace. This path must begin with a slash. Type: string (or Expression with resultType string)."] + #[serde(rename = "notebookPath")] + pub notebook_path: serde_json::Value, + #[doc = "Base parameters to be used for each run of this job.If the notebook takes a parameter that is not specified, the default value from the notebook will be used."] + #[serde(rename = "baseParameters", default, skip_serializing_if = "Option::is_none")] + pub base_parameters: Option, + #[doc = "A list of libraries to be installed on the cluster that will execute the job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub libraries: Vec, +} +impl DatabricksNotebookActivityTypeProperties { + pub fn new(notebook_path: serde_json::Value) -> Self { + Self { + notebook_path, + base_parameters: None, + libraries: Vec::new(), + } + } +} +#[doc = "DatabricksSparkJar activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksSparkJarActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Databricks SparkJar activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DatabricksSparkJarActivityTypeProperties, +} +impl DatabricksSparkJarActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: DatabricksSparkJarActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Databricks SparkJar activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksSparkJarActivityTypeProperties { + #[doc = "The full name of the class containing the main method to be executed. This class must be contained in a JAR provided as a library. Type: string (or Expression with resultType string)."] + #[serde(rename = "mainClassName")] + pub main_class_name: serde_json::Value, + #[doc = "Parameters that will be passed to the main method."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, + #[doc = "A list of libraries to be installed on the cluster that will execute the job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub libraries: Vec, +} +impl DatabricksSparkJarActivityTypeProperties { + pub fn new(main_class_name: serde_json::Value) -> Self { + Self { + main_class_name, + parameters: Vec::new(), + libraries: Vec::new(), + } + } +} +#[doc = "DatabricksSparkPython activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksSparkPythonActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Databricks SparkPython activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DatabricksSparkPythonActivityTypeProperties, +} +impl DatabricksSparkPythonActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: DatabricksSparkPythonActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Databricks SparkPython activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabricksSparkPythonActivityTypeProperties { + #[doc = "The URI of the Python file to be executed. DBFS paths are supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "pythonFile")] + pub python_file: serde_json::Value, + #[doc = "Command line parameters that will be passed to the Python file."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, + #[doc = "A list of libraries to be installed on the cluster that will execute the job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub libraries: Vec, +} +impl DatabricksSparkPythonActivityTypeProperties { + pub fn new(python_file: serde_json::Value) -> Self { + Self { + python_file, + parameters: Vec::new(), + libraries: Vec::new(), + } + } +} +#[doc = "The Azure Data Factory nested object which identifies data within different data stores, such as tables, files, folders, and documents."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Dataset { + #[doc = "Type of dataset."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Dataset description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub structure: Option, + #[doc = "Columns that define the physical type schema of the dataset. Type: array (or Expression with resultType array), itemType: DatasetSchemaDataElement."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "Definition of all parameters for an entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "List of tags that can be used for describing the Dataset."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, + #[doc = "The folder that this Dataset is in. If not specified, Dataset will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl Dataset { + pub fn new(type_: String, linked_service_name: LinkedServiceReference) -> Self { + Self { + type_, + description: None, + structure: None, + schema: None, + linked_service_name, + parameters: None, + annotations: Vec::new(), + folder: None, + } + } +} +pub mod dataset { + use super::*; + #[doc = "The folder that this Dataset is in. If not specified, Dataset will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this Dataset is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The compression method used on a dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetCompression { + #[doc = "Type of dataset compression. Type: string (or Expression with resultType string)."] + #[serde(rename = "type")] + pub type_: serde_json::Value, + #[doc = "The dataset compression level. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, +} +impl DatasetCompression { + pub fn new(type_: serde_json::Value) -> Self { + Self { type_, level: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DatasetCompressionLevelEnum { + Optimal, + Fastest, +} +#[doc = "Columns that define the structure of the dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatasetDataElement { + #[doc = "Name of the column. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the column. Type: string (or Expression with resultType string)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DatasetDataElement { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dataset debug resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetDebugResource { + #[serde(flatten)] + pub sub_resource_debug_resource: SubResourceDebugResource, + #[doc = "The Azure Data Factory nested object which identifies data within different data stores, such as tables, files, folders, and documents."] + pub properties: Dataset, +} +impl DatasetDebugResource { + pub fn new(properties: Dataset) -> Self { + Self { + sub_resource_debug_resource: SubResourceDebugResource::default(), + properties, + } + } +} +#[doc = "A list of dataset resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetListResponse { + #[doc = "List of datasets."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl DatasetListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Dataset location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetLocation { + #[doc = "Type of dataset storage location."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Specify the folder path of dataset. Type: string (or Expression with resultType string)"] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "Specify the file name of dataset. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, +} +impl DatasetLocation { + pub fn new(type_: String) -> Self { + Self { + type_, + folder_path: None, + file_name: None, + } + } +} +#[doc = "Dataset reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetReference { + #[doc = "Dataset reference type."] + #[serde(rename = "type")] + pub type_: dataset_reference::Type, + #[doc = "Reference dataset name."] + #[serde(rename = "referenceName")] + pub reference_name: String, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl DatasetReference { + pub fn new(type_: dataset_reference::Type, reference_name: String) -> Self { + Self { + type_, + reference_name, + parameters: None, + } + } +} +pub mod dataset_reference { + use super::*; + #[doc = "Dataset reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + DatasetReference, + } +} +#[doc = "Dataset resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "The Azure Data Factory nested object which identifies data within different data stores, such as tables, files, folders, and documents."] + pub properties: Dataset, +} +impl DatasetResource { + pub fn new(properties: Dataset) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Columns that define the physical type schema of the dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DatasetSchemaDataElement { + #[doc = "Name of the schema column. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Type of the schema column. Type: string (or Expression with resultType string)."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl DatasetSchemaDataElement { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The format definition of a storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatasetStorageFormat { + #[doc = "Type of dataset storage format."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Serializer. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub serializer: Option, + #[doc = "Deserializer. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deserializer: Option, +} +impl DatasetStorageFormat { + pub fn new(type_: String) -> Self { + Self { + type_, + serializer: None, + deserializer: None, + } + } +} +#[doc = "Linked service for Dataworld."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dataworld linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DataworldLinkedServiceTypeProperties, +} +impl DataworldLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DataworldLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dataworld linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DataworldLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DataworldLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} +#[doc = "The days of the week."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DayOfWeek { + Sunday, + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, +} +#[doc = "Linked service for DB2 data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Db2LinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "DB2 linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: Db2LinkedServiceTypeProperties, +} +impl Db2LinkedService { + pub fn new(linked_service: LinkedService, type_properties: Db2LinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "DB2 linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Db2LinkedServiceTypeProperties { + #[doc = "The connection string. It is mutually exclusive with server, database, authenticationType, userName, packageCollection and certificateCommonName property. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Server name for connection. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "Database name for connection. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, + #[doc = "AuthenticationType to be used for connection. It is mutually exclusive with connectionString property."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "Username for authentication. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Under where packages are created when querying database. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + #[serde(rename = "packageCollection", default, skip_serializing_if = "Option::is_none")] + pub package_collection: Option, + #[doc = "Certificate Common Name when TLS is enabled. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + #[serde(rename = "certificateCommonName", default, skip_serializing_if = "Option::is_none")] + pub certificate_common_name: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. It is mutually exclusive with connectionString property. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl Db2LinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, database: serde_json::Value) -> Self { + Self { + connection_string: None, + server, + database, + authentication_type: None, + username: None, + password: None, + package_collection: None, + certificate_common_name: None, + encrypted_credential: None, + } + } +} +pub mod db2_linked_service_type_properties { + use super::*; + #[doc = "AuthenticationType to be used for connection. It is mutually exclusive with connectionString property."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + } +} +#[doc = "A copy activity source for Db2 databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Db2Source { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl Db2Source { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The Db2 table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Db2TableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Db2 table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl Db2TableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Db2 table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Db2TableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The Db2 schema name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The Db2 table name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl Db2TableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delete activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Delete activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DeleteActivityTypeProperties, +} +impl DeleteActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: DeleteActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Delete activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DeleteActivityTypeProperties { + #[doc = "If true, files or sub-folders under current folder path will be deleted recursively. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "The max concurrent connections to connect data source at the same time."] + #[serde(rename = "maxConcurrentConnections", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_connections: Option, + #[doc = "Whether to record detailed logs of delete-activity execution. Default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableLogging", default, skip_serializing_if = "Option::is_none")] + pub enable_logging: Option, + #[doc = "(Deprecated. Please use LogSettings) Log storage settings."] + #[serde(rename = "logStorageSettings", default, skip_serializing_if = "Option::is_none")] + pub log_storage_settings: Option, + #[doc = "Dataset reference type."] + pub dataset: DatasetReference, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, +} +impl DeleteActivityTypeProperties { + pub fn new(dataset: DatasetReference) -> Self { + Self { + recursive: None, + max_concurrent_connections: None, + enable_logging: None, + log_storage_settings: None, + dataset, + store_settings: None, + } + } +} +#[doc = "Request body structure for deleting data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DeleteDataFlowDebugSessionRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The data flow which contains the debug session."] + #[serde(rename = "dataFlowName", default, skip_serializing_if = "Option::is_none")] + pub data_flow_name: Option, +} +impl DeleteDataFlowDebugSessionRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Delimited text dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "DelimitedText dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl DelimitedTextDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "DelimitedText dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The column delimiter. Type: string (or Expression with resultType string)."] + #[serde(rename = "columnDelimiter", default, skip_serializing_if = "Option::is_none")] + pub column_delimiter: Option, + #[doc = "The row delimiter. Type: string (or Expression with resultType string)."] + #[serde(rename = "rowDelimiter", default, skip_serializing_if = "Option::is_none")] + pub row_delimiter: Option, + #[doc = "The code page name of the preferred encoding. If miss, the default value is UTF-8, unless BOM denotes another Unicode encoding. Refer to the name column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string)."] + #[serde(rename = "encodingName", default, skip_serializing_if = "Option::is_none")] + pub encoding_name: Option, + #[doc = "The data compressionCodec. Type: string (or Expression with resultType string)."] + #[serde(rename = "compressionCodec", default, skip_serializing_if = "Option::is_none")] + pub compression_codec: Option, + #[doc = "The data compression method used for DelimitedText."] + #[serde(rename = "compressionLevel", default, skip_serializing_if = "Option::is_none")] + pub compression_level: Option, + #[doc = "The quote character. Type: string (or Expression with resultType string)."] + #[serde(rename = "quoteChar", default, skip_serializing_if = "Option::is_none")] + pub quote_char: Option, + #[doc = "The escape character. Type: string (or Expression with resultType string)."] + #[serde(rename = "escapeChar", default, skip_serializing_if = "Option::is_none")] + pub escape_char: Option, + #[doc = "When used as input, treat the first row of data as headers. When used as output,write the headers into the output as the first row of data. The default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "firstRowAsHeader", default, skip_serializing_if = "Option::is_none")] + pub first_row_as_header: Option, + #[doc = "The null value string. Type: string (or Expression with resultType string)."] + #[serde(rename = "nullValue", default, skip_serializing_if = "Option::is_none")] + pub null_value: Option, +} +impl DelimitedTextDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + column_delimiter: None, + row_delimiter: None, + encoding_name: None, + compression_codec: None, + compression_level: None, + quote_char: None, + escape_char: None, + first_row_as_header: None, + null_value: None, + } + } +} +#[doc = "Delimited text read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextReadSettings { + #[serde(flatten)] + pub format_read_settings: FormatReadSettings, + #[doc = "Indicates the number of non-empty rows to skip when reading data from input files. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "skipLineCount", default, skip_serializing_if = "Option::is_none")] + pub skip_line_count: Option, + #[doc = "Compression read settings."] + #[serde(rename = "compressionProperties", default, skip_serializing_if = "Option::is_none")] + pub compression_properties: Option, +} +impl DelimitedTextReadSettings { + pub fn new(format_read_settings: FormatReadSettings) -> Self { + Self { + format_read_settings, + skip_line_count: None, + compression_properties: None, + } + } +} +#[doc = "A copy activity DelimitedText sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Delimited text write settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl DelimitedTextSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + format_settings: None, + } + } +} +#[doc = "A copy activity DelimitedText source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Delimited text read settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl DelimitedTextSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + format_settings: None, + additional_columns: None, + } + } +} +#[doc = "Delimited text write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DelimitedTextWriteSettings { + #[serde(flatten)] + pub format_write_settings: FormatWriteSettings, + #[doc = "Indicates whether string values should always be enclosed with quotes. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "quoteAllText", default, skip_serializing_if = "Option::is_none")] + pub quote_all_text: Option, + #[doc = "The file extension used to create the files. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileExtension")] + pub file_extension: serde_json::Value, + #[doc = "Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxRowsPerFile", default, skip_serializing_if = "Option::is_none")] + pub max_rows_per_file: Option, + #[doc = "Specifies the file name pattern _. when copy from non-file based store without partitionOptions. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub file_name_prefix: Option, +} +impl DelimitedTextWriteSettings { + pub fn new(format_write_settings: FormatWriteSettings, file_extension: serde_json::Value) -> Self { + Self { + format_write_settings, + quote_all_text: None, + file_extension, + max_rows_per_file: None, + file_name_prefix: None, + } + } +} +#[doc = "Referenced dependency."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DependencyReference { + #[doc = "The type of dependency reference."] + #[serde(rename = "type")] + pub type_: String, +} +impl DependencyReference { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Distcp settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DistcpSettings { + #[doc = "Specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string)."] + #[serde(rename = "resourceManagerEndpoint")] + pub resource_manager_endpoint: serde_json::Value, + #[doc = "Specifies an existing folder path which will be used to store temp Distcp command script. The script file is generated by ADF and will be removed after Copy job finished. Type: string (or Expression with resultType string)."] + #[serde(rename = "tempScriptPath")] + pub temp_script_path: serde_json::Value, + #[doc = "Specifies the Distcp options. Type: string (or Expression with resultType string)."] + #[serde(rename = "distcpOptions", default, skip_serializing_if = "Option::is_none")] + pub distcp_options: Option, +} +impl DistcpSettings { + pub fn new(resource_manager_endpoint: serde_json::Value, temp_script_path: serde_json::Value) -> Self { + Self { + resource_manager_endpoint, + temp_script_path, + distcp_options: None, + } + } +} +#[doc = "Microsoft Azure Document Database Collection dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DocumentDbCollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "DocumentDB Collection dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DocumentDbCollectionDatasetTypeProperties, +} +impl DocumentDbCollectionDataset { + pub fn new(dataset: Dataset, type_properties: DocumentDbCollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "DocumentDB Collection dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DocumentDbCollectionDatasetTypeProperties { + #[doc = "Document Database collection name. Type: string (or Expression with resultType string)."] + #[serde(rename = "collectionName")] + pub collection_name: serde_json::Value, +} +impl DocumentDbCollectionDatasetTypeProperties { + pub fn new(collection_name: serde_json::Value) -> Self { + Self { collection_name } + } +} +#[doc = "A copy activity Document Database Collection sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DocumentDbCollectionSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Nested properties separator. Default is . (dot). Type: string (or Expression with resultType string)."] + #[serde(rename = "nestingSeparator", default, skip_serializing_if = "Option::is_none")] + pub nesting_separator: Option, + #[doc = "Describes how to write data to Azure Cosmos DB. Type: string (or Expression with resultType string). Allowed values: insert and upsert."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, +} +impl DocumentDbCollectionSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + nesting_separator: None, + write_behavior: None, + } + } +} +#[doc = "A copy activity Document Database Collection source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DocumentDbCollectionSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Documents query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Nested properties separator. Type: string (or Expression with resultType string)."] + #[serde(rename = "nestingSeparator", default, skip_serializing_if = "Option::is_none")] + pub nesting_separator: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl DocumentDbCollectionSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + nesting_separator: None, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "Drill Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DrillDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Drill. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Drill. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl DrillDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Drill server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DrillLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Drill server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DrillLinkedServiceTypeProperties, +} +impl DrillLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DrillLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Drill server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DrillLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DrillLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Drill server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DrillSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl DrillSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Drill server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DrillTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Drill Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl DrillTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Dynamic Executor Allocation Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DynamicExecutorAllocation { + #[doc = "Indicates whether Dynamic Executor Allocation is enabled or not."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl DynamicExecutorAllocation { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dynamics AX linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsAxLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dynamics AX linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DynamicsAxLinkedServiceTypeProperties, +} +impl DynamicsAxLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DynamicsAxLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dynamics AX linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsAxLinkedServiceTypeProperties { + #[doc = "The Dynamics AX (or Dynamics 365 Finance and Operations) instance OData endpoint."] + pub url: serde_json::Value, + #[doc = "Specify the application's client ID. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId")] + pub service_principal_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey")] + pub service_principal_key: SecretBase, + #[doc = "Specify the tenant information (domain name or tenant ID) under which your application resides. Retrieve it by hovering the mouse in the top-right corner of the Azure portal. Type: string (or Expression with resultType string)."] + pub tenant: serde_json::Value, + #[doc = "Specify the resource you are requesting authorization. Type: string (or Expression with resultType string)."] + #[serde(rename = "aadResourceId")] + pub aad_resource_id: serde_json::Value, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DynamicsAxLinkedServiceTypeProperties { + pub fn new( + url: serde_json::Value, + service_principal_id: serde_json::Value, + service_principal_key: SecretBase, + tenant: serde_json::Value, + aad_resource_id: serde_json::Value, + ) -> Self { + Self { + url, + service_principal_id, + service_principal_key, + tenant, + aad_resource_id, + encrypted_credential: None, + } + } +} +#[doc = "The path of the Dynamics AX OData entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsAxResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Dynamics AX OData resource dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DynamicsAxResourceDatasetTypeProperties, +} +impl DynamicsAxResourceDataset { + pub fn new(dataset: Dataset, type_properties: DynamicsAxResourceDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Dynamics AX OData resource dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsAxResourceDatasetTypeProperties { + #[doc = "The path of the Dynamics AX OData entity. Type: string (or Expression with resultType string)."] + pub path: serde_json::Value, +} +impl DynamicsAxResourceDatasetTypeProperties { + pub fn new(path: serde_json::Value) -> Self { + Self { path } + } +} +#[doc = "A copy activity Dynamics AX source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsAxSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:05:00. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl DynamicsAxSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + http_request_timeout: None, + } + } +} +#[doc = "All available dynamicsAuthenticationType values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DynamicsAuthenticationType { + Office365, + Ifd, + #[serde(rename = "AADServicePrincipal")] + AadServicePrincipal, +} +#[doc = "The Dynamics CRM entity dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsCrmEntityDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Dynamics CRM entity dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl DynamicsCrmEntityDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Dynamics CRM entity dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DynamicsCrmEntityDatasetTypeProperties { + #[doc = "The logical name of the entity. Type: string (or Expression with resultType string)."] + #[serde(rename = "entityName", default, skip_serializing_if = "Option::is_none")] + pub entity_name: Option, +} +impl DynamicsCrmEntityDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dynamics CRM linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsCrmLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dynamics CRM linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DynamicsCrmLinkedServiceTypeProperties, +} +impl DynamicsCrmLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DynamicsCrmLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dynamics CRM linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsCrmLinkedServiceTypeProperties { + #[doc = "The deployment type of the Dynamics CRM instance. 'Online' for Dynamics CRM Online and 'OnPremisesWithIfd' for Dynamics CRM on-premises with Ifd. Type: string (or Expression with resultType string)."] + #[serde(rename = "deploymentType")] + pub deployment_type: serde_json::Value, + #[doc = "The host name of the on-premises Dynamics CRM server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string)."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "The port of on-premises Dynamics CRM server. The property is required for on-prem and not allowed for online. Default is 443. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The URL to the Microsoft Dynamics CRM server. The property is required for on-line and not allowed for on-prem. Type: string (or Expression with resultType string)."] + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[doc = "The organization name of the Dynamics CRM instance. The property is required for on-prem and required for online when there are more than one Dynamics CRM instances associated with the user. Type: string (or Expression with resultType string)."] + #[serde(rename = "organizationName", default, skip_serializing_if = "Option::is_none")] + pub organization_name: Option, + #[doc = "The authentication type to connect to Dynamics CRM server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType")] + pub authentication_type: serde_json::Value, + #[doc = "User name to access the Dynamics CRM instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The client ID of the application in Azure Active Directory used for Server-To-Server authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "A string from ServicePrincipalCredentialEnum or an expression"] + #[serde(rename = "servicePrincipalCredentialType", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalCredential", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DynamicsCrmLinkedServiceTypeProperties { + pub fn new(deployment_type: serde_json::Value, authentication_type: serde_json::Value) -> Self { + Self { + deployment_type, + host_name: None, + port: None, + service_uri: None, + organization_name: None, + authentication_type, + username: None, + password: None, + service_principal_id: None, + service_principal_credential_type: None, + service_principal_credential: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Dynamics CRM sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsCrmSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Defines values for DynamicsSinkWriteBehavior."] + #[serde(rename = "writeBehavior")] + pub write_behavior: DynamicsSinkWriteBehavior, + #[doc = "The flag indicating whether to ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "ignoreNullValues", default, skip_serializing_if = "Option::is_none")] + pub ignore_null_values: Option, + #[doc = "The logical name of the alternate key which will be used when upserting records. Type: string (or Expression with resultType string)."] + #[serde(rename = "alternateKeyName", default, skip_serializing_if = "Option::is_none")] + pub alternate_key_name: Option, +} +impl DynamicsCrmSink { + pub fn new(copy_sink: CopySink, write_behavior: DynamicsSinkWriteBehavior) -> Self { + Self { + copy_sink, + write_behavior, + ignore_null_values: None, + alternate_key_name: None, + } + } +} +#[doc = "A copy activity Dynamics CRM source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsCrmSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "FetchXML is a proprietary query language that is used in Microsoft Dynamics CRM (online & on-premises). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl DynamicsCrmSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[doc = "All available dynamicsDeploymentType values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DynamicsDeploymentType { + Online, + OnPremisesWithIfd, +} +#[doc = "The Dynamics entity dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsEntityDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Dynamics entity dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl DynamicsEntityDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Dynamics entity dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct DynamicsEntityDatasetTypeProperties { + #[doc = "The logical name of the entity. Type: string (or Expression with resultType string)."] + #[serde(rename = "entityName", default, skip_serializing_if = "Option::is_none")] + pub entity_name: Option, +} +impl DynamicsEntityDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Dynamics linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Dynamics linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: DynamicsLinkedServiceTypeProperties, +} +impl DynamicsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: DynamicsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Dynamics linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsLinkedServiceTypeProperties { + #[doc = "The deployment type of the Dynamics instance. 'Online' for Dynamics Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: string (or Expression with resultType string)."] + #[serde(rename = "deploymentType")] + pub deployment_type: serde_json::Value, + #[doc = "The host name of the on-premises Dynamics server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string)."] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "The port of on-premises Dynamics server. The property is required for on-prem and not allowed for online. Default is 443. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The URL to the Microsoft Dynamics server. The property is required for on-line and not allowed for on-prem. Type: string (or Expression with resultType string)."] + #[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")] + pub service_uri: Option, + #[doc = "The organization name of the Dynamics instance. The property is required for on-prem and required for online when there are more than one Dynamics instances associated with the user. Type: string (or Expression with resultType string)."] + #[serde(rename = "organizationName", default, skip_serializing_if = "Option::is_none")] + pub organization_name: Option, + #[doc = "The authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType")] + pub authentication_type: serde_json::Value, + #[doc = "User name to access the Dynamics instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The client ID of the application in Azure Active Directory used for Server-To-Server authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The service principal credential type to use in Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalCredentialType", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalCredential", default, skip_serializing_if = "Option::is_none")] + pub service_principal_credential: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl DynamicsLinkedServiceTypeProperties { + pub fn new(deployment_type: serde_json::Value, authentication_type: serde_json::Value) -> Self { + Self { + deployment_type, + host_name: None, + port: None, + service_uri: None, + organization_name: None, + authentication_type, + username: None, + password: None, + service_principal_id: None, + service_principal_credential_type: None, + service_principal_credential: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Dynamics sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Defines values for DynamicsSinkWriteBehavior."] + #[serde(rename = "writeBehavior")] + pub write_behavior: DynamicsSinkWriteBehavior, + #[doc = "The flag indicating whether ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "ignoreNullValues", default, skip_serializing_if = "Option::is_none")] + pub ignore_null_values: Option, + #[doc = "The logical name of the alternate key which will be used when upserting records. Type: string (or Expression with resultType string)."] + #[serde(rename = "alternateKeyName", default, skip_serializing_if = "Option::is_none")] + pub alternate_key_name: Option, +} +impl DynamicsSink { + pub fn new(copy_sink: CopySink, write_behavior: DynamicsSinkWriteBehavior) -> Self { + Self { + copy_sink, + write_behavior, + ignore_null_values: None, + alternate_key_name: None, + } + } +} +#[doc = "Defines values for DynamicsSinkWriteBehavior."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DynamicsSinkWriteBehavior { + Upsert, +} +#[doc = "A copy activity Dynamics source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DynamicsSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "FetchXML is a proprietary query language that is used in Microsoft Dynamics (online & on-premises). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl DynamicsSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EditTablesRequest { + #[doc = "Edit link tables request"] + #[serde(rename = "linkTables", default, skip_serializing_if = "Vec::is_empty")] + pub link_tables: Vec, +} +impl EditTablesRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Eloqua server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EloquaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Eloqua server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: EloquaLinkedServiceTypeProperties, +} +impl EloquaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: EloquaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Eloqua server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EloquaLinkedServiceTypeProperties { + #[doc = "The endpoint of the Eloqua server. (i.e. eloqua.example.com)"] + pub endpoint: serde_json::Value, + #[doc = "The site name and user name of your Eloqua account in the form: sitename/username. (i.e. Eloqua/Alice)"] + pub username: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl EloquaLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value, username: serde_json::Value) -> Self { + Self { + endpoint, + username, + password: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Eloqua server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EloquaObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl EloquaObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Eloqua server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EloquaSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl EloquaSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Details of the encryption associated with the workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EncryptionDetails { + #[doc = "Double Encryption enabled"] + #[serde(rename = "doubleEncryptionEnabled", default, skip_serializing_if = "Option::is_none")] + pub double_encryption_enabled: Option, + #[doc = "Details of the customer managed key associated with the workspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cmk: Option, +} +impl EncryptionDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource management error additional info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorAdditionalInfo { + #[doc = "The additional info type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The additional info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub info: Option, +} +impl ErrorAdditionalInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Contains details when the response code indicates an error."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorContract { + #[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl ErrorContract { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ErrorResponse { + #[doc = "The error code."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[doc = "The error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The error target."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "The error details."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub details: Vec, + #[doc = "The error additional info."] + #[serde(rename = "additionalInfo", default, skip_serializing_if = "Vec::is_empty")] + pub additional_info: Vec, +} +impl ErrorResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Request body structure for data flow expression preview."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct EvaluateDataFlowExpressionRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "The data flow which contains the debug session."] + #[serde(rename = "dataFlowName", default, skip_serializing_if = "Option::is_none")] + pub data_flow_name: Option, + #[doc = "The output stream name."] + #[serde(rename = "streamName", default, skip_serializing_if = "Option::is_none")] + pub stream_name: Option, + #[doc = "The row limit for preview request."] + #[serde(rename = "rowLimits", default, skip_serializing_if = "Option::is_none")] + pub row_limits: Option, + #[doc = "The expression for preview."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub expression: Option, +} +impl EvaluateDataFlowExpressionRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Excel dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExcelDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Excel dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ExcelDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Excel dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExcelDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The sheet of excel file. Type: string (or Expression with resultType string)."] + #[serde(rename = "sheetName")] + pub sheet_name: serde_json::Value, + #[doc = "The partial data of one sheet. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub range: Option, + #[doc = "When used as input, treat the first row of data as headers. When used as output,write the headers into the output as the first row of data. The default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "firstRowAsHeader", default, skip_serializing_if = "Option::is_none")] + pub first_row_as_header: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, + #[doc = "The null value string. Type: string (or Expression with resultType string)."] + #[serde(rename = "nullValue", default, skip_serializing_if = "Option::is_none")] + pub null_value: Option, +} +impl ExcelDatasetTypeProperties { + pub fn new(location: DatasetLocation, sheet_name: serde_json::Value) -> Self { + Self { + location, + sheet_name, + range: None, + first_row_as_header: None, + compression: None, + null_value: None, + } + } +} +#[doc = "A copy activity excel source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExcelSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl ExcelSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + additional_columns: None, + } + } +} +#[doc = "Execute data flow activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecuteDataFlowActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Execute data flow activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ExecuteDataFlowActivityTypeProperties, +} +impl ExecuteDataFlowActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: ExecuteDataFlowActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Execute data flow activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecuteDataFlowActivityTypeProperties { + #[doc = "Data flow reference type."] + pub dataflow: DataFlowReference, + #[doc = "Staging info for execute data flow activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub staging: Option, + #[doc = "Integration runtime reference type."] + #[serde(rename = "integrationRuntime", default, skip_serializing_if = "Option::is_none")] + pub integration_runtime: Option, + #[doc = "Compute properties for data flow activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compute: Option, + #[doc = "Trace level setting used for data flow monitoring output. Supported values are: 'coarse', 'fine', and 'none'. Type: string (or Expression with resultType string)"] + #[serde(rename = "traceLevel", default, skip_serializing_if = "Option::is_none")] + pub trace_level: Option, + #[doc = "Continue on error setting used for data flow execution. Enables processing to continue if a sink fails. Type: boolean (or Expression with resultType boolean)"] + #[serde(rename = "continueOnError", default, skip_serializing_if = "Option::is_none")] + pub continue_on_error: Option, + #[doc = "Concurrent run setting used for data flow execution. Allows sinks with the same save order to be processed concurrently. Type: boolean (or Expression with resultType boolean)"] + #[serde(rename = "runConcurrently", default, skip_serializing_if = "Option::is_none")] + pub run_concurrently: Option, +} +impl ExecuteDataFlowActivityTypeProperties { + pub fn new(dataflow: DataFlowReference) -> Self { + Self { + dataflow, + staging: None, + integration_runtime: None, + compute: None, + trace_level: None, + continue_on_error: None, + run_concurrently: None, + } + } +} +pub mod execute_data_flow_activity_type_properties { + use super::*; + #[doc = "Compute properties for data flow activity."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Compute { + #[doc = "Compute type of the cluster which will execute data flow job."] + #[serde(rename = "computeType", default, skip_serializing_if = "Option::is_none")] + pub compute_type: Option, + #[doc = "Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272."] + #[serde(rename = "coreCount", default, skip_serializing_if = "Option::is_none")] + pub core_count: Option, + } + impl Compute { + pub fn new() -> Self { + Self::default() + } + } + pub mod compute { + use super::*; + #[doc = "Compute type of the cluster which will execute data flow job."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ComputeType { + General, + MemoryOptimized, + ComputeOptimized, + } + } +} +#[doc = "Execute pipeline activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecutePipelineActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Execute pipeline activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ExecutePipelineActivityTypeProperties, +} +impl ExecutePipelineActivity { + pub fn new(control_activity: ControlActivity, type_properties: ExecutePipelineActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Execute pipeline activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecutePipelineActivityTypeProperties { + #[doc = "Pipeline reference type."] + pub pipeline: PipelineReference, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "Defines whether activity execution will wait for the dependent pipeline execution to finish. Default is false."] + #[serde(rename = "waitOnCompletion", default, skip_serializing_if = "Option::is_none")] + pub wait_on_completion: Option, +} +impl ExecutePipelineActivityTypeProperties { + pub fn new(pipeline: PipelineReference) -> Self { + Self { + pipeline, + parameters: None, + wait_on_completion: None, + } + } +} +#[doc = "Execute SSIS package activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecuteSsisPackageActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Execute SSIS package activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ExecuteSsisPackageActivityTypeProperties, +} +impl ExecuteSsisPackageActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: ExecuteSsisPackageActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Execute SSIS package activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecuteSsisPackageActivityTypeProperties { + #[doc = "SSIS package location."] + #[serde(rename = "packageLocation")] + pub package_location: SsisPackageLocation, + #[doc = "Specifies the runtime to execute SSIS package. The value should be \"x86\" or \"x64\". Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub runtime: Option, + #[doc = "The logging level of SSIS package execution. Type: string (or Expression with resultType string)."] + #[serde(rename = "loggingLevel", default, skip_serializing_if = "Option::is_none")] + pub logging_level: Option, + #[doc = "The environment path to execute the SSIS package. Type: string (or Expression with resultType string)."] + #[serde(rename = "environmentPath", default, skip_serializing_if = "Option::is_none")] + pub environment_path: Option, + #[doc = "SSIS package execution credential."] + #[serde(rename = "executionCredential", default, skip_serializing_if = "Option::is_none")] + pub execution_credential: Option, + #[doc = "Integration runtime reference type."] + #[serde(rename = "connectVia")] + pub connect_via: IntegrationRuntimeReference, + #[doc = "The project level parameters to execute the SSIS package."] + #[serde(rename = "projectParameters", default, skip_serializing_if = "Option::is_none")] + pub project_parameters: Option, + #[doc = "The package level parameters to execute the SSIS package."] + #[serde(rename = "packageParameters", default, skip_serializing_if = "Option::is_none")] + pub package_parameters: Option, + #[doc = "The project level connection managers to execute the SSIS package."] + #[serde(rename = "projectConnectionManagers", default, skip_serializing_if = "Option::is_none")] + pub project_connection_managers: Option, + #[doc = "The package level connection managers to execute the SSIS package."] + #[serde(rename = "packageConnectionManagers", default, skip_serializing_if = "Option::is_none")] + pub package_connection_managers: Option, + #[doc = "The property overrides to execute the SSIS package."] + #[serde(rename = "propertyOverrides", default, skip_serializing_if = "Option::is_none")] + pub property_overrides: Option, + #[doc = "SSIS package execution log location"] + #[serde(rename = "logLocation", default, skip_serializing_if = "Option::is_none")] + pub log_location: Option, +} +impl ExecuteSsisPackageActivityTypeProperties { + pub fn new(package_location: SsisPackageLocation, connect_via: IntegrationRuntimeReference) -> Self { + Self { + package_location, + runtime: None, + logging_level: None, + environment_path: None, + execution_credential: None, + connect_via, + project_parameters: None, + package_parameters: None, + project_connection_managers: None, + package_connection_managers: None, + property_overrides: None, + log_location: None, + } + } +} +#[doc = "Base class for all execution activities."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExecutionActivity { + #[serde(flatten)] + pub activity: Activity, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName", default, skip_serializing_if = "Option::is_none")] + pub linked_service_name: Option, + #[doc = "Execution policy for an activity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub policy: Option, +} +impl ExecutionActivity { + pub fn new(activity: Activity) -> Self { + Self { + activity, + linked_service_name: None, + policy: None, + } + } +} +#[doc = "Export command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportSettings { + #[doc = "The export setting type."] + #[serde(rename = "type")] + pub type_: String, +} +impl ExportSettings { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "The exposure control request."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExposureControlRequest { + #[doc = "The feature name."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, + #[doc = "The feature type."] + #[serde(rename = "featureType", default, skip_serializing_if = "Option::is_none")] + pub feature_type: Option, +} +impl ExposureControlRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The exposure control response."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ExposureControlResponse { + #[doc = "The feature name."] + #[serde(rename = "featureName", default, skip_serializing_if = "Option::is_none")] + pub feature_name: Option, + #[doc = "The feature value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl ExposureControlResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Synapse expression definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Expression { + #[doc = "Expression type."] + #[serde(rename = "type")] + pub type_: expression::Type, + #[doc = "Expression value."] + pub value: String, +} +impl Expression { + pub fn new(type_: expression::Type, value: String) -> Self { + Self { type_, value } + } +} +pub mod expression { + use super::*; + #[doc = "Expression type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Expression, + } +} +#[doc = "This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Fail activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FailActivityTypeProperties, +} +impl FailActivity { + pub fn new(control_activity: ControlActivity, type_properties: FailActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Fail activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailActivityTypeProperties { + #[doc = "The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + pub message: serde_json::Value, + #[doc = "The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string)."] + #[serde(rename = "errorCode")] + pub error_code: serde_json::Value, +} +impl FailActivityTypeProperties { + pub fn new(message: serde_json::Value, error_code: serde_json::Value) -> Self { + Self { message, error_code } + } +} +#[doc = "File system linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileServerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "File system linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FileServerLinkedServiceTypeProperties, +} +impl FileServerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: FileServerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "File system linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileServerLinkedServiceTypeProperties { + #[doc = "Host name of the server. Type: string (or Expression with resultType string)."] + pub host: serde_json::Value, + #[doc = "User ID to logon the server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl FileServerLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + user_id: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "The location of file server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileServerLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl FileServerLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "File server read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileServerReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "FileServer wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "FileServer wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "Specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileFilter", default, skip_serializing_if = "Option::is_none")] + pub file_filter: Option, +} +impl FileServerReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + file_filter: None, + } + } +} +#[doc = "File server write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileServerWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, +} +impl FileServerWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { store_write_settings } + } +} +#[doc = "An on-premises file system dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileShareDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "On-premises file system dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl FileShareDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "On-premises file system dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FileShareDatasetTypeProperties { + #[doc = "The path of the on-premises file system. Type: string (or Expression with resultType string)."] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "The name of the on-premises file system. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")] + pub file_name: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "Specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileFilter", default, skip_serializing_if = "Option::is_none")] + pub file_filter: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl FileShareDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity file system sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileSystemSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The type of copy behavior for copy sink."] + #[serde(rename = "copyBehavior", default, skip_serializing_if = "Option::is_none")] + pub copy_behavior: Option, +} +impl FileSystemSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + copy_behavior: None, + } + } +} +#[doc = "A copy activity file system source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FileSystemSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl FileSystemSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + recursive: None, + additional_columns: None, + } + } +} +#[doc = "Filter and return results from input array based on the conditions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilterActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Filter activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: FilterActivityTypeProperties, +} +impl FilterActivity { + pub fn new(control_activity: ControlActivity, type_properties: FilterActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Filter activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FilterActivityTypeProperties { + #[doc = "Azure Synapse expression definition."] + pub items: Expression, + #[doc = "Azure Synapse expression definition."] + pub condition: Expression, +} +impl FilterActivityTypeProperties { + pub fn new(items: Expression, condition: Expression) -> Self { + Self { items, condition } + } +} +#[doc = "Data flow flowlet"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Flowlet { + #[serde(flatten)] + pub data_flow: DataFlow, + #[doc = "Flowlet type properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl Flowlet { + pub fn new(data_flow: DataFlow) -> Self { + Self { + data_flow, + type_properties: None, + } + } +} +#[doc = "Flowlet type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct FlowletTypeProperties { + #[doc = "List of sources in Flowlet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sources: Vec, + #[doc = "List of sinks in Flowlet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sinks: Vec, + #[doc = "List of transformations in Flowlet."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transformations: Vec, + #[doc = "Flowlet script."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub script: Option, + #[doc = "Flowlet script lines."] + #[serde(rename = "scriptLines", default, skip_serializing_if = "Vec::is_empty")] + pub script_lines: Vec, +} +impl FlowletTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This activity is used for iterating over a collection and execute given activities."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ForEachActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "ForEach activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ForEachActivityTypeProperties, +} +impl ForEachActivity { + pub fn new(control_activity: ControlActivity, type_properties: ForEachActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "ForEach activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ForEachActivityTypeProperties { + #[doc = "Should the loop be executed in sequence or in parallel (max 50)"] + #[serde(rename = "isSequential", default, skip_serializing_if = "Option::is_none")] + pub is_sequential: Option, + #[doc = "Batch count to be used for controlling the number of parallel execution (when isSequential is set to false)."] + #[serde(rename = "batchCount", default, skip_serializing_if = "Option::is_none")] + pub batch_count: Option, + #[doc = "Azure Synapse expression definition."] + pub items: Expression, + #[doc = "List of activities to execute ."] + pub activities: Vec, +} +impl ForEachActivityTypeProperties { + pub fn new(items: Expression, activities: Vec) -> Self { + Self { + is_sequential: None, + batch_count: None, + items, + activities, + } + } +} +#[doc = "Format read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FormatReadSettings { + #[doc = "The read setting type."] + #[serde(rename = "type")] + pub type_: String, +} +impl FormatReadSettings { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Format write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FormatWriteSettings { + #[doc = "The write setting type."] + #[serde(rename = "type")] + pub type_: String, +} +impl FormatWriteSettings { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Ftp read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FtpReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Ftp wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Ftp wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Specify whether to use binary transfer mode for FTP stores."] + #[serde(rename = "useBinaryTransfer", default, skip_serializing_if = "Option::is_none")] + pub use_binary_transfer: Option, + #[doc = "If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "disableChunking", default, skip_serializing_if = "Option::is_none")] + pub disable_chunking: Option, +} +impl FtpReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + file_list_path: None, + use_binary_transfer: None, + disable_chunking: None, + } + } +} +#[doc = "A FTP server Linked Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FtpServerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: FtpServerLinkedServiceTypeProperties, +} +impl FtpServerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: FtpServerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FtpServerLinkedServiceTypeProperties { + #[doc = "Host name of the FTP server. Type: string (or Expression with resultType string)."] + pub host: serde_json::Value, + #[doc = "The TCP port number that the FTP server uses to listen for client connections. Default value is 21. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The authentication type to be used to connect to the FTP server."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "Username to logon the FTP server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "If true, connect to the FTP server over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "If true, validate the FTP server SSL certificate when connect over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableServerCertificateValidation", default, skip_serializing_if = "Option::is_none")] + pub enable_server_certificate_validation: Option, +} +impl FtpServerLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + port: None, + authentication_type: None, + user_name: None, + password: None, + encrypted_credential: None, + enable_ssl: None, + enable_server_certificate_validation: None, + } + } +} +pub mod ftp_server_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to be used to connect to the FTP server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Anonymous, + } +} +#[doc = "The location of ftp server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FtpServerLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl FtpServerLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "Properties specific to this dataset type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GenericDatasetTypeProperties { + #[doc = "The table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl GenericDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Activity to get metadata of dataset"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetMetadataActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "GetMetadata activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: GetMetadataActivityTypeProperties, +} +impl GetMetadataActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: GetMetadataActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "GetMetadata activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetMetadataActivityTypeProperties { + #[doc = "Dataset reference type."] + pub dataset: DatasetReference, + #[doc = "Fields of metadata to get from dataset."] + #[serde(rename = "fieldList", default, skip_serializing_if = "Vec::is_empty")] + pub field_list: Vec, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Format read settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl GetMetadataActivityTypeProperties { + pub fn new(dataset: DatasetReference) -> Self { + Self { + dataset, + field_list: Vec::new(), + store_settings: None, + format_settings: None, + } + } +} +#[doc = "The request payload of get SSIS object metadata."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GetSsisObjectMetadataRequest { + #[doc = "Metadata path."] + #[serde(rename = "metadataPath", default, skip_serializing_if = "Option::is_none")] + pub metadata_path: Option, +} +impl GetSsisObjectMetadataRequest { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GitHubAccessTokenRequest { + #[doc = "The GitHub Client Id."] + #[serde(rename = "gitHubClientId")] + pub git_hub_client_id: String, + #[doc = "The GitHub Access code."] + #[serde(rename = "gitHubAccessCode")] + pub git_hub_access_code: String, + #[doc = "The GitHub access token base URL."] + #[serde(rename = "gitHubAccessTokenBaseUrl")] + pub git_hub_access_token_base_url: String, +} +impl GitHubAccessTokenRequest { + pub fn new(git_hub_client_id: String, git_hub_access_code: String, git_hub_access_token_base_url: String) -> Self { + Self { + git_hub_client_id, + git_hub_access_code, + git_hub_access_token_base_url, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GitHubAccessTokenResponse { + #[serde(rename = "gitHubAccessToken", default, skip_serializing_if = "Option::is_none")] + pub git_hub_access_token: Option, +} +impl GitHubAccessTokenResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Client secret information for factory's bring your own app repository configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GitHubClientSecret { + #[doc = "Bring your own app client secret AKV URL"] + #[serde(rename = "byoaSecretAkvUrl", default, skip_serializing_if = "Option::is_none")] + pub byoa_secret_akv_url: Option, + #[doc = "Bring your own app client secret name in AKV"] + #[serde(rename = "byoaSecretName", default, skip_serializing_if = "Option::is_none")] + pub byoa_secret_name: Option, +} +impl GitHubClientSecret { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Google AdWords service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleAdWordsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Google AdWords service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: GoogleAdWordsLinkedServiceTypeProperties, +} +impl GoogleAdWordsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: GoogleAdWordsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Google AdWords service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GoogleAdWordsLinkedServiceTypeProperties { + #[doc = "Properties used to connect to GoogleAds. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The Client customer ID of the AdWords account that you want to fetch report data for."] + #[serde(rename = "clientCustomerID", default, skip_serializing_if = "Option::is_none")] + pub client_customer_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "developerToken", default, skip_serializing_if = "Option::is_none")] + pub developer_token: Option, + #[doc = "The OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] + pub refresh_token: Option, + #[doc = "The client id of the google application used to acquire the refresh token. Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "The service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + #[doc = "The full path to the .p12 key file that is used to authenticate the service account email address and can only be used on self-hosted IR."] + #[serde(rename = "keyFilePath", default, skip_serializing_if = "Option::is_none")] + pub key_file_path: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl GoogleAdWordsLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod google_ad_words_linked_service_type_properties { + use super::*; + #[doc = "The OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + ServiceAuthentication, + UserAuthentication, + } +} +#[doc = "Google AdWords service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleAdWordsObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl GoogleAdWordsObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Google AdWords service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleAdWordsSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl GoogleAdWordsSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Google BigQuery Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GoogleBigQueryDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using database + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Google BigQuery. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The database name of the Google BigQuery. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dataset: Option, +} +impl GoogleBigQueryDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Google BigQuery service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleBigQueryLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Google BigQuery service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: GoogleBigQueryLinkedServiceTypeProperties, +} +impl GoogleBigQueryLinkedService { + pub fn new(linked_service: LinkedService, type_properties: GoogleBigQueryLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Google BigQuery service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleBigQueryLinkedServiceTypeProperties { + #[doc = "The default BigQuery project to query against."] + pub project: serde_json::Value, + #[doc = "A comma-separated list of public BigQuery projects to access."] + #[serde(rename = "additionalProjects", default, skip_serializing_if = "Option::is_none")] + pub additional_projects: Option, + #[doc = "Whether to request access to Google Drive. Allowing Google Drive access enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is false."] + #[serde(rename = "requestGoogleDriveScope", default, skip_serializing_if = "Option::is_none")] + pub request_google_drive_scope: Option, + #[doc = "The OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR."] + #[serde(rename = "authenticationType")] + pub authentication_type: google_big_query_linked_service_type_properties::AuthenticationType, + #[doc = "The base definition of a secret type."] + #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] + pub refresh_token: Option, + #[doc = "The client id of the google application used to acquire the refresh token. Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "The service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + #[doc = "The full path to the .p12 key file that is used to authenticate the service account email address and can only be used on self-hosted IR."] + #[serde(rename = "keyFilePath", default, skip_serializing_if = "Option::is_none")] + pub key_file_path: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl GoogleBigQueryLinkedServiceTypeProperties { + pub fn new( + project: serde_json::Value, + authentication_type: google_big_query_linked_service_type_properties::AuthenticationType, + ) -> Self { + Self { + project, + additional_projects: None, + request_google_drive_scope: None, + authentication_type, + refresh_token: None, + client_id: None, + client_secret: None, + email: None, + key_file_path: None, + trusted_cert_path: None, + use_system_trust_store: None, + encrypted_credential: None, + } + } +} +pub mod google_big_query_linked_service_type_properties { + use super::*; + #[doc = "The OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + ServiceAuthentication, + UserAuthentication, + } +} +#[doc = "Google BigQuery service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleBigQueryObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Google BigQuery Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl GoogleBigQueryObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Google BigQuery service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleBigQuerySource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl GoogleBigQuerySource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Linked service for Google Cloud Storage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleCloudStorageLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Google Cloud Storage linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: GoogleCloudStorageLinkedServiceTypeProperties, +} +impl GoogleCloudStorageLinkedService { + pub fn new(linked_service: LinkedService, type_properties: GoogleCloudStorageLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Google Cloud Storage linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GoogleCloudStorageLinkedServiceTypeProperties { + #[doc = "The access key identifier of the Google Cloud Storage Identity and Access Management (IAM) user. Type: string (or Expression with resultType string)."] + #[serde(rename = "accessKeyId", default, skip_serializing_if = "Option::is_none")] + pub access_key_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "secretAccessKey", default, skip_serializing_if = "Option::is_none")] + pub secret_access_key: Option, + #[doc = "This value specifies the endpoint to access with the Google Cloud Storage Connector. This is an optional property; change it only if you want to try a different service endpoint or want to switch between https and http. Type: string (or Expression with resultType string)."] + #[serde(rename = "serviceUrl", default, skip_serializing_if = "Option::is_none")] + pub service_url: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl GoogleCloudStorageLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location of Google Cloud Storage dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleCloudStorageLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, + #[doc = "Specify the bucketName of Google Cloud Storage. Type: string (or Expression with resultType string)"] + #[serde(rename = "bucketName", default, skip_serializing_if = "Option::is_none")] + pub bucket_name: Option, + #[doc = "Specify the version of Google Cloud Storage. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} +impl GoogleCloudStorageLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { + dataset_location, + bucket_name: None, + version: None, + } + } +} +#[doc = "Google Cloud Storage read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GoogleCloudStorageReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Google Cloud Storage wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Google Cloud Storage wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "The prefix filter for the Google Cloud Storage object name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub prefix: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, +} +impl GoogleCloudStorageReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + prefix: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + } + } +} +#[doc = "Greenplum Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GreenplumDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of Greenplum. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of Greenplum. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl GreenplumDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Greenplum Database linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GreenplumLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Greenplum Database linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: GreenplumLinkedServiceTypeProperties, +} +impl GreenplumLinkedService { + pub fn new(linked_service: LinkedService, type_properties: GreenplumLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Greenplum Database linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct GreenplumLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl GreenplumLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Greenplum Database source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GreenplumSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl GreenplumSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Greenplum Database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GreenplumTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Greenplum Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl GreenplumTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "HBase server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HBaseLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "HBase server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HBaseLinkedServiceTypeProperties, +} +impl HBaseLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HBaseLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "HBase server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HBaseLinkedServiceTypeProperties { + #[doc = "The IP address or host name of the HBase server. (i.e. 192.168.222.160)"] + pub host: serde_json::Value, + #[doc = "The TCP port that the HBase instance uses to listen for client connections. The default value is 9090."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The partial URL corresponding to the HBase server. (i.e. /gateway/sandbox/hbase/version)"] + #[serde(rename = "httpPath", default, skip_serializing_if = "Option::is_none")] + pub http_path: Option, + #[doc = "The authentication mechanism to use to connect to the HBase server."] + #[serde(rename = "authenticationType")] + pub authentication_type: h_base_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used to connect to the HBase instance."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl HBaseLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, authentication_type: h_base_linked_service_type_properties::AuthenticationType) -> Self { + Self { + host, + port: None, + http_path: None, + authentication_type, + username: None, + password: None, + enable_ssl: None, + trusted_cert_path: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod h_base_linked_service_type_properties { + use super::*; + #[doc = "The authentication mechanism to use to connect to the HBase server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + Basic, + } +} +#[doc = "HBase server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HBaseObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl HBaseObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity HBase server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HBaseSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl HBaseSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The HDInsightActivityDebugInfoOption settings to use."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum HdInsightActivityDebugInfoOption { + None, + Always, + Failure, +} +#[doc = "HDInsight Hive activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightHiveActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "HDInsight Hive activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightHiveActivityTypeProperties, +} +impl HdInsightHiveActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: HdInsightHiveActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "HDInsight Hive activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HdInsightHiveActivityTypeProperties { + #[doc = "Storage linked service references."] + #[serde(rename = "storageLinkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub storage_linked_services: Vec, + #[doc = "User specified arguments to HDInsightActivity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[doc = "The HDInsightActivityDebugInfoOption settings to use."] + #[serde(rename = "getDebugInfo", default, skip_serializing_if = "Option::is_none")] + pub get_debug_info: Option, + #[doc = "Script path. Type: string (or Expression with resultType string)."] + #[serde(rename = "scriptPath", default, skip_serializing_if = "Option::is_none")] + pub script_path: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "scriptLinkedService", default, skip_serializing_if = "Option::is_none")] + pub script_linked_service: Option, + #[doc = "Allows user to specify defines for Hive job request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub defines: Option, + #[doc = "User specified arguments under hivevar namespace."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub variables: Vec, + #[doc = "Query timeout value (in minutes). Effective when the HDInsight cluster is with ESP (Enterprise Security Package)"] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, +} +impl HdInsightHiveActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "HDInsight linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "HDInsight linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightLinkedServiceTypeProperties, +} +impl HdInsightLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HdInsightLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "HDInsight linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightLinkedServiceTypeProperties { + #[doc = "HDInsight cluster URI. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterUri")] + pub cluster_uri: serde_json::Value, + #[doc = "HDInsight cluster user name. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName", default, skip_serializing_if = "Option::is_none")] + pub linked_service_name: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "hcatalogLinkedServiceName", default, skip_serializing_if = "Option::is_none")] + pub hcatalog_linked_service_name: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "Specify if the HDInsight is created with ESP (Enterprise Security Package). Type: Boolean."] + #[serde(rename = "isEspEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_esp_enabled: Option, + #[doc = "Specify the FileSystem if the main storage for the HDInsight is ADLS Gen2. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileSystem", default, skip_serializing_if = "Option::is_none")] + pub file_system: Option, +} +impl HdInsightLinkedServiceTypeProperties { + pub fn new(cluster_uri: serde_json::Value) -> Self { + Self { + cluster_uri, + user_name: None, + password: None, + linked_service_name: None, + hcatalog_linked_service_name: None, + encrypted_credential: None, + is_esp_enabled: None, + file_system: None, + } + } +} +#[doc = "HDInsight MapReduce activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightMapReduceActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "HDInsight MapReduce activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightMapReduceActivityTypeProperties, +} +impl HdInsightMapReduceActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: HdInsightMapReduceActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "HDInsight MapReduce activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightMapReduceActivityTypeProperties { + #[doc = "Storage linked service references."] + #[serde(rename = "storageLinkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub storage_linked_services: Vec, + #[doc = "User specified arguments to HDInsightActivity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[doc = "The HDInsightActivityDebugInfoOption settings to use."] + #[serde(rename = "getDebugInfo", default, skip_serializing_if = "Option::is_none")] + pub get_debug_info: Option, + #[doc = "Class name. Type: string (or Expression with resultType string)."] + #[serde(rename = "className")] + pub class_name: serde_json::Value, + #[doc = "Jar path. Type: string (or Expression with resultType string)."] + #[serde(rename = "jarFilePath")] + pub jar_file_path: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "jarLinkedService", default, skip_serializing_if = "Option::is_none")] + pub jar_linked_service: Option, + #[doc = "Jar libs."] + #[serde(rename = "jarLibs", default, skip_serializing_if = "Vec::is_empty")] + pub jar_libs: Vec, + #[doc = "Allows user to specify defines for the MapReduce job request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub defines: Option, +} +impl HdInsightMapReduceActivityTypeProperties { + pub fn new(class_name: serde_json::Value, jar_file_path: serde_json::Value) -> Self { + Self { + storage_linked_services: Vec::new(), + arguments: Vec::new(), + get_debug_info: None, + class_name, + jar_file_path, + jar_linked_service: None, + jar_libs: Vec::new(), + defines: None, + } + } +} +#[doc = "HDInsight ondemand linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightOnDemandLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "HDInsight ondemand linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightOnDemandLinkedServiceTypeProperties, +} +impl HdInsightOnDemandLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HdInsightOnDemandLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "HDInsight ondemand linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightOnDemandLinkedServiceTypeProperties { + #[doc = "Number of worker/data nodes in the cluster. Suggestion value: 4. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterSize")] + pub cluster_size: serde_json::Value, + #[doc = "The allowed idle time for the on-demand HDInsight cluster. Specifies how long the on-demand HDInsight cluster stays alive after completion of an activity run if there are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string)."] + #[serde(rename = "timeToLive")] + pub time_to_live: serde_json::Value, + #[doc = "Version of the HDInsight cluster.\u{a0} Type: string (or Expression with resultType string)."] + pub version: serde_json::Value, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "The customer’s subscription to host the cluster. Type: string (or Expression with resultType string)."] + #[serde(rename = "hostSubscriptionId")] + pub host_subscription_id: serde_json::Value, + #[doc = "The service principal id for the hostSubscriptionId. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The Tenant id/name to which the service principal belongs. Type: string (or Expression with resultType string)."] + pub tenant: serde_json::Value, + #[doc = "The resource group where the cluster belongs. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterResourceGroup")] + pub cluster_resource_group: serde_json::Value, + #[doc = "The prefix of cluster name, postfix will be distinct with timestamp. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub cluster_name_prefix: Option, + #[doc = "The username to access the cluster. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterUserName", default, skip_serializing_if = "Option::is_none")] + pub cluster_user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clusterPassword", default, skip_serializing_if = "Option::is_none")] + pub cluster_password: Option, + #[doc = "The username to SSH remotely connect to cluster’s node (for Linux). Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterSshUserName", default, skip_serializing_if = "Option::is_none")] + pub cluster_ssh_user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clusterSshPassword", default, skip_serializing_if = "Option::is_none")] + pub cluster_ssh_password: Option, + #[doc = "Specifies additional storage accounts for the HDInsight linked service so that the Data Factory service can register them on your behalf."] + #[serde(rename = "additionalLinkedServiceNames", default, skip_serializing_if = "Vec::is_empty")] + pub additional_linked_service_names: Vec, + #[doc = "Linked service reference type."] + #[serde(rename = "hcatalogLinkedServiceName", default, skip_serializing_if = "Option::is_none")] + pub hcatalog_linked_service_name: Option, + #[doc = "The cluster type. Type: string (or Expression with resultType string)."] + #[serde(rename = "clusterType", default, skip_serializing_if = "Option::is_none")] + pub cluster_type: Option, + #[doc = "The version of spark if the cluster type is 'spark'. Type: string (or Expression with resultType string)."] + #[serde(rename = "sparkVersion", default, skip_serializing_if = "Option::is_none")] + pub spark_version: Option, + #[doc = "Specifies the core configuration parameters (as in core-site.xml) for the HDInsight cluster to be created."] + #[serde(rename = "coreConfiguration", default, skip_serializing_if = "Option::is_none")] + pub core_configuration: Option, + #[doc = "Specifies the HBase configuration parameters (hbase-site.xml) for the HDInsight cluster."] + #[serde(rename = "hBaseConfiguration", default, skip_serializing_if = "Option::is_none")] + pub h_base_configuration: Option, + #[doc = "Specifies the HDFS configuration parameters (hdfs-site.xml) for the HDInsight cluster."] + #[serde(rename = "hdfsConfiguration", default, skip_serializing_if = "Option::is_none")] + pub hdfs_configuration: Option, + #[doc = "Specifies the hive configuration parameters (hive-site.xml) for the HDInsight cluster."] + #[serde(rename = "hiveConfiguration", default, skip_serializing_if = "Option::is_none")] + pub hive_configuration: Option, + #[doc = "Specifies the MapReduce configuration parameters (mapred-site.xml) for the HDInsight cluster."] + #[serde(rename = "mapReduceConfiguration", default, skip_serializing_if = "Option::is_none")] + pub map_reduce_configuration: Option, + #[doc = "Specifies the Oozie configuration parameters (oozie-site.xml) for the HDInsight cluster."] + #[serde(rename = "oozieConfiguration", default, skip_serializing_if = "Option::is_none")] + pub oozie_configuration: Option, + #[doc = "Specifies the Storm configuration parameters (storm-site.xml) for the HDInsight cluster."] + #[serde(rename = "stormConfiguration", default, skip_serializing_if = "Option::is_none")] + pub storm_configuration: Option, + #[doc = "Specifies the Yarn configuration parameters (yarn-site.xml) for the HDInsight cluster."] + #[serde(rename = "yarnConfiguration", default, skip_serializing_if = "Option::is_none")] + pub yarn_configuration: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "Specifies the size of the head node for the HDInsight cluster."] + #[serde(rename = "headNodeSize", default, skip_serializing_if = "Option::is_none")] + pub head_node_size: Option, + #[doc = "Specifies the size of the data node for the HDInsight cluster."] + #[serde(rename = "dataNodeSize", default, skip_serializing_if = "Option::is_none")] + pub data_node_size: Option, + #[doc = "Specifies the size of the Zoo Keeper node for the HDInsight cluster."] + #[serde(rename = "zookeeperNodeSize", default, skip_serializing_if = "Option::is_none")] + pub zookeeper_node_size: Option, + #[doc = "Custom script actions to run on HDI ondemand cluster once it's up. Please refer to https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-hadoop-customize-cluster-linux?toc=%2Fen-us%2Fazure%2Fhdinsight%2Fr-server%2FTOC.json&bc=%2Fen-us%2Fazure%2Fbread%2Ftoc.json#understanding-script-actions."] + #[serde(rename = "scriptActions", default, skip_serializing_if = "Vec::is_empty")] + pub script_actions: Vec, + #[doc = "The ARM resource ID for the vNet to which the cluster should be joined after creation. Type: string (or Expression with resultType string)."] + #[serde(rename = "virtualNetworkId", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_id: Option, + #[doc = "The ARM resource ID for the subnet in the vNet. If virtualNetworkId was specified, then this property is required. Type: string (or Expression with resultType string)."] + #[serde(rename = "subnetName", default, skip_serializing_if = "Option::is_none")] + pub subnet_name: Option, +} +impl HdInsightOnDemandLinkedServiceTypeProperties { + pub fn new( + cluster_size: serde_json::Value, + time_to_live: serde_json::Value, + version: serde_json::Value, + linked_service_name: LinkedServiceReference, + host_subscription_id: serde_json::Value, + tenant: serde_json::Value, + cluster_resource_group: serde_json::Value, + ) -> Self { + Self { + cluster_size, + time_to_live, + version, + linked_service_name, + host_subscription_id, + service_principal_id: None, + service_principal_key: None, + tenant, + cluster_resource_group, + cluster_name_prefix: None, + cluster_user_name: None, + cluster_password: None, + cluster_ssh_user_name: None, + cluster_ssh_password: None, + additional_linked_service_names: Vec::new(), + hcatalog_linked_service_name: None, + cluster_type: None, + spark_version: None, + core_configuration: None, + h_base_configuration: None, + hdfs_configuration: None, + hive_configuration: None, + map_reduce_configuration: None, + oozie_configuration: None, + storm_configuration: None, + yarn_configuration: None, + encrypted_credential: None, + head_node_size: None, + data_node_size: None, + zookeeper_node_size: None, + script_actions: Vec::new(), + virtual_network_id: None, + subnet_name: None, + } + } +} +#[doc = "HDInsight Pig activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightPigActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "HDInsight Pig activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightPigActivityTypeProperties, +} +impl HdInsightPigActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: HdInsightPigActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "HDInsight Pig activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HdInsightPigActivityTypeProperties { + #[doc = "Storage linked service references."] + #[serde(rename = "storageLinkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub storage_linked_services: Vec, + #[doc = "User specified arguments to HDInsightActivity. Type: array (or Expression with resultType array)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub arguments: Option, + #[doc = "The HDInsightActivityDebugInfoOption settings to use."] + #[serde(rename = "getDebugInfo", default, skip_serializing_if = "Option::is_none")] + pub get_debug_info: Option, + #[doc = "Script path. Type: string (or Expression with resultType string)."] + #[serde(rename = "scriptPath", default, skip_serializing_if = "Option::is_none")] + pub script_path: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "scriptLinkedService", default, skip_serializing_if = "Option::is_none")] + pub script_linked_service: Option, + #[doc = "Allows user to specify defines for Pig job request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub defines: Option, +} +impl HdInsightPigActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "HDInsight Spark activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightSparkActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "HDInsight spark activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightSparkActivityTypeProperties, +} +impl HdInsightSparkActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: HdInsightSparkActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "HDInsight spark activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightSparkActivityTypeProperties { + #[doc = "The root path in 'sparkJobLinkedService' for all the job’s files. Type: string (or Expression with resultType string)."] + #[serde(rename = "rootPath")] + pub root_path: serde_json::Value, + #[doc = "The relative path to the root folder of the code/package to be executed. Type: string (or Expression with resultType string)."] + #[serde(rename = "entryFilePath")] + pub entry_file_path: serde_json::Value, + #[doc = "The user-specified arguments to HDInsightSparkActivity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[doc = "The HDInsightActivityDebugInfoOption settings to use."] + #[serde(rename = "getDebugInfo", default, skip_serializing_if = "Option::is_none")] + pub get_debug_info: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "sparkJobLinkedService", default, skip_serializing_if = "Option::is_none")] + pub spark_job_linked_service: Option, + #[doc = "The application's Java/Spark main class."] + #[serde(rename = "className", default, skip_serializing_if = "Option::is_none")] + pub class_name: Option, + #[doc = "The user to impersonate that will execute the job. Type: string (or Expression with resultType string)."] + #[serde(rename = "proxyUser", default, skip_serializing_if = "Option::is_none")] + pub proxy_user: Option, + #[doc = "Spark configuration property."] + #[serde(rename = "sparkConfig", default, skip_serializing_if = "Option::is_none")] + pub spark_config: Option, +} +impl HdInsightSparkActivityTypeProperties { + pub fn new(root_path: serde_json::Value, entry_file_path: serde_json::Value) -> Self { + Self { + root_path, + entry_file_path, + arguments: Vec::new(), + get_debug_info: None, + spark_job_linked_service: None, + class_name: None, + proxy_user: None, + spark_config: None, + } + } +} +#[doc = "HDInsight streaming activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightStreamingActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "HDInsight streaming activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdInsightStreamingActivityTypeProperties, +} +impl HdInsightStreamingActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: HdInsightStreamingActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "HDInsight streaming activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdInsightStreamingActivityTypeProperties { + #[doc = "Storage linked service references."] + #[serde(rename = "storageLinkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub storage_linked_services: Vec, + #[doc = "User specified arguments to HDInsightActivity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub arguments: Vec, + #[doc = "The HDInsightActivityDebugInfoOption settings to use."] + #[serde(rename = "getDebugInfo", default, skip_serializing_if = "Option::is_none")] + pub get_debug_info: Option, + #[doc = "Mapper executable name. Type: string (or Expression with resultType string)."] + pub mapper: serde_json::Value, + #[doc = "Reducer executable name. Type: string (or Expression with resultType string)."] + pub reducer: serde_json::Value, + #[doc = "Input blob path. Type: string (or Expression with resultType string)."] + pub input: serde_json::Value, + #[doc = "Output blob path. Type: string (or Expression with resultType string)."] + pub output: serde_json::Value, + #[doc = "Paths to streaming job files. Can be directories."] + #[serde(rename = "filePaths")] + pub file_paths: Vec, + #[doc = "Linked service reference type."] + #[serde(rename = "fileLinkedService", default, skip_serializing_if = "Option::is_none")] + pub file_linked_service: Option, + #[doc = "Combiner executable name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub combiner: Option, + #[doc = "Command line environment values."] + #[serde(rename = "commandEnvironment", default, skip_serializing_if = "Vec::is_empty")] + pub command_environment: Vec, + #[doc = "Allows user to specify defines for streaming job request."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub defines: Option, +} +impl HdInsightStreamingActivityTypeProperties { + pub fn new( + mapper: serde_json::Value, + reducer: serde_json::Value, + input: serde_json::Value, + output: serde_json::Value, + file_paths: Vec, + ) -> Self { + Self { + storage_linked_services: Vec::new(), + arguments: Vec::new(), + get_debug_info: None, + mapper, + reducer, + input, + output, + file_paths, + file_linked_service: None, + combiner: None, + command_environment: Vec::new(), + defines: None, + } + } +} +#[doc = "Hadoop Distributed File System (HDFS) linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdfsLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "HDFS linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HdfsLinkedServiceTypeProperties, +} +impl HdfsLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HdfsLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "HDFS linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdfsLinkedServiceTypeProperties { + #[doc = "The URL of the HDFS service endpoint, e.g. http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "Type of authentication used to connect to the HDFS. Possible values are: Anonymous and Windows. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "User name for Windows authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, +} +impl HdfsLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + authentication_type: None, + encrypted_credential: None, + user_name: None, + password: None, + } + } +} +#[doc = "The location of HDFS."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdfsLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl HdfsLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "HDFS read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdfsReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "HDFS wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "HDFS wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "Distcp settings."] + #[serde(rename = "distcpSettings", default, skip_serializing_if = "Option::is_none")] + pub distcp_settings: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, +} +impl HdfsReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + file_list_path: None, + enable_partition_discovery: None, + partition_root_path: None, + modified_datetime_start: None, + modified_datetime_end: None, + distcp_settings: None, + delete_files_after_completion: None, + } + } +} +#[doc = "A copy activity HDFS source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HdfsSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Distcp settings."] + #[serde(rename = "distcpSettings", default, skip_serializing_if = "Option::is_none")] + pub distcp_settings: Option, +} +impl HdfsSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + recursive: None, + distcp_settings: None, + } + } +} +#[doc = "All available HdiNodeTypes values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum HdiNodeTypes { + Headnode, + Workernode, + Zookeeper, +} +#[doc = "Hive Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HiveDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Hive. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Hive. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl HiveDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Hive Server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HiveLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Hive Server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HiveLinkedServiceTypeProperties, +} +impl HiveLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HiveLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Hive Server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HiveLinkedServiceTypeProperties { + #[doc = "IP address or host name of the Hive server, separated by ';' for multiple hosts (only when serviceDiscoveryMode is enable)."] + pub host: serde_json::Value, + #[doc = "The TCP port that the Hive server uses to listen for client connections."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The type of Hive server."] + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[doc = "The transport protocol to use in the Thrift layer."] + #[serde(rename = "thriftTransportProtocol", default, skip_serializing_if = "Option::is_none")] + pub thrift_transport_protocol: Option, + #[doc = "The authentication method used to access the Hive server."] + #[serde(rename = "authenticationType")] + pub authentication_type: hive_linked_service_type_properties::AuthenticationType, + #[doc = "true to indicate using the ZooKeeper service, false not."] + #[serde(rename = "serviceDiscoveryMode", default, skip_serializing_if = "Option::is_none")] + pub service_discovery_mode: Option, + #[doc = "The namespace on ZooKeeper under which Hive Server 2 nodes are added."] + #[serde(rename = "zooKeeperNameSpace", default, skip_serializing_if = "Option::is_none")] + pub zoo_keeper_name_space: Option, + #[doc = "Specifies whether the driver uses native HiveQL queries,or converts them into an equivalent form in HiveQL."] + #[serde(rename = "useNativeQuery", default, skip_serializing_if = "Option::is_none")] + pub use_native_query: Option, + #[doc = "The user name that you use to access Hive Server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The partial URL corresponding to the Hive server."] + #[serde(rename = "httpPath", default, skip_serializing_if = "Option::is_none")] + pub http_path: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl HiveLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, authentication_type: hive_linked_service_type_properties::AuthenticationType) -> Self { + Self { + host, + port: None, + server_type: None, + thrift_transport_protocol: None, + authentication_type, + service_discovery_mode: None, + zoo_keeper_name_space: None, + use_native_query: None, + username: None, + password: None, + http_path: None, + enable_ssl: None, + trusted_cert_path: None, + use_system_trust_store: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod hive_linked_service_type_properties { + use super::*; + #[doc = "The type of Hive server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServerType { + HiveServer1, + HiveServer2, + HiveThriftServer, + } + #[doc = "The transport protocol to use in the Thrift layer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ThriftTransportProtocol { + Binary, + #[serde(rename = "SASL")] + Sasl, + #[serde(rename = "HTTP ")] + Http, + } + #[doc = "The authentication method used to access the Hive server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + Username, + UsernameAndPassword, + #[serde(rename = "WindowsAzureHDInsightService")] + WindowsAzureHdInsightService, + } +} +#[doc = "Hive Server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HiveObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Hive Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl HiveObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Hive Server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HiveSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl HiveSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "A file in an HTTP web server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl HttpDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Properties specific to this dataset type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct HttpDatasetTypeProperties { + #[doc = "The relative URL based on the URL in the HttpLinkedService refers to an HTTP file Type: string (or Expression with resultType string)."] + #[serde(rename = "relativeUrl", default, skip_serializing_if = "Option::is_none")] + pub relative_url: Option, + #[doc = "The HTTP method for the HTTP request. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestMethod", default, skip_serializing_if = "Option::is_none")] + pub request_method: Option, + #[doc = "The body for the HTTP request. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestBody", default, skip_serializing_if = "Option::is_none")] + pub request_body: Option, + #[doc = "The headers for the HTTP Request. e.g. request-header-name-1:request-header-value-1\r\n...\r\nrequest-header-name-n:request-header-value-n Type: string (or Expression with resultType string)."] + #[serde(rename = "additionalHeaders", default, skip_serializing_if = "Option::is_none")] + pub additional_headers: Option, + #[doc = "The format definition of a storage."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub format: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl HttpDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for an HTTP source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: HttpLinkedServiceTypeProperties, +} +impl HttpLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HttpLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpLinkedServiceTypeProperties { + #[doc = "The base URL of the HTTP endpoint, e.g. http://www.microsoft.com. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The authentication type to be used to connect to the HTTP server."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "User name for Basic, Digest, or Windows authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Base64 encoded certificate data for ClientCertificate authentication. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "embeddedCertData", default, skip_serializing_if = "Option::is_none")] + pub embedded_cert_data: Option, + #[doc = "Thumbprint of certificate for ClientCertificate authentication. Only valid for on-premises copy. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "certThumbprint", default, skip_serializing_if = "Option::is_none")] + pub cert_thumbprint: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "If true, validate the HTTPS server SSL certificate. Default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableServerCertificateValidation", default, skip_serializing_if = "Option::is_none")] + pub enable_server_certificate_validation: Option, +} +impl HttpLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + authentication_type: None, + user_name: None, + password: None, + embedded_cert_data: None, + cert_thumbprint: None, + encrypted_credential: None, + enable_server_certificate_validation: None, + } + } +} +pub mod http_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to be used to connect to the HTTP server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Anonymous, + Digest, + Windows, + ClientCertificate, + } +} +#[doc = "Sftp read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "The HTTP method used to call the RESTful API. The default is GET. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestMethod", default, skip_serializing_if = "Option::is_none")] + pub request_method: Option, + #[doc = "The HTTP request body to the RESTful API if requestMethod is POST. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestBody", default, skip_serializing_if = "Option::is_none")] + pub request_body: Option, + #[doc = "The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType string)."] + #[serde(rename = "additionalHeaders", default, skip_serializing_if = "Option::is_none")] + pub additional_headers: Option, + #[doc = "Specifies the timeout for a HTTP client to get HTTP response from HTTP server."] + #[serde(rename = "requestTimeout", default, skip_serializing_if = "Option::is_none")] + pub request_timeout: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, +} +impl HttpReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + request_method: None, + request_body: None, + additional_headers: None, + request_timeout: None, + enable_partition_discovery: None, + partition_root_path: None, + } + } +} +#[doc = "The location of http server."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpServerLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, + #[doc = "Specify the relativeUrl of http server. Type: string (or Expression with resultType string)"] + #[serde(rename = "relativeUrl", default, skip_serializing_if = "Option::is_none")] + pub relative_url: Option, +} +impl HttpServerLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { + dataset_location, + relative_url: None, + } + } +} +#[doc = "A copy activity source for an HTTP file."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HttpSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Specifies the timeout for a HTTP client to get HTTP response from HTTP server. The default value is equivalent to System.Net.HttpWebRequest.Timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl HttpSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + http_request_timeout: None, + } + } +} +#[doc = "Hubspot Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HubspotLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Hubspot Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: HubspotLinkedServiceTypeProperties, +} +impl HubspotLinkedService { + pub fn new(linked_service: LinkedService, type_properties: HubspotLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Hubspot Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HubspotLinkedServiceTypeProperties { + #[doc = "The client ID associated with your Hubspot application."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "refreshToken", default, skip_serializing_if = "Option::is_none")] + pub refresh_token: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl HubspotLinkedServiceTypeProperties { + pub fn new(client_id: serde_json::Value) -> Self { + Self { + client_id, + client_secret: None, + access_token: None, + refresh_token: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Hubspot Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HubspotObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl HubspotObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Hubspot Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HubspotSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl HubspotSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "This activity evaluates a boolean expression and executes either the activities under the ifTrueActivities property or the ifFalseActivities property depending on the result of the expression."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IfConditionActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "IfCondition activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: IfConditionActivityTypeProperties, +} +impl IfConditionActivity { + pub fn new(control_activity: ControlActivity, type_properties: IfConditionActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "IfCondition activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IfConditionActivityTypeProperties { + #[doc = "Azure Synapse expression definition."] + pub expression: Expression, + #[doc = "List of activities to execute if expression is evaluated to true. This is an optional property and if not provided, the activity will exit without any action."] + #[serde(rename = "ifTrueActivities", default, skip_serializing_if = "Vec::is_empty")] + pub if_true_activities: Vec, + #[doc = "List of activities to execute if expression is evaluated to false. This is an optional property and if not provided, the activity will exit without any action."] + #[serde(rename = "ifFalseActivities", default, skip_serializing_if = "Vec::is_empty")] + pub if_false_activities: Vec, +} +impl IfConditionActivityTypeProperties { + pub fn new(expression: Expression) -> Self { + Self { + expression, + if_true_activities: Vec::new(), + if_false_activities: Vec::new(), + } + } +} +#[doc = "Impala Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ImpalaDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Impala. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Impala. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl ImpalaDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Impala server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImpalaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Impala server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ImpalaLinkedServiceTypeProperties, +} +impl ImpalaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ImpalaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Impala server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImpalaLinkedServiceTypeProperties { + #[doc = "The IP address or host name of the Impala server. (i.e. 192.168.222.160)"] + pub host: serde_json::Value, + #[doc = "The TCP port that the Impala server uses to listen for client connections. The default value is 21050."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The authentication type to use."] + #[serde(rename = "authenticationType")] + pub authentication_type: impala_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used to access the Impala server. The default value is anonymous when using SASLUsername."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ImpalaLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, authentication_type: impala_linked_service_type_properties::AuthenticationType) -> Self { + Self { + host, + port: None, + authentication_type, + username: None, + password: None, + enable_ssl: None, + trusted_cert_path: None, + use_system_trust_store: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod impala_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + #[serde(rename = "SASLUsername")] + SaslUsername, + UsernameAndPassword, + } +} +#[doc = "Impala server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImpalaObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Impala Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ImpalaObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Impala server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImpalaSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ImpalaSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Import command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ImportSettings { + #[doc = "The import setting type."] + #[serde(rename = "type")] + pub type_: String, +} +impl ImportSettings { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Informix linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InformixLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Informix linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: InformixLinkedServiceTypeProperties, +} +impl InformixLinkedService { + pub fn new(linked_service: LinkedService, type_properties: InformixLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Informix linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InformixLinkedServiceTypeProperties { + #[doc = "The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Type of authentication used to connect to the Informix as ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[doc = "User name for Basic authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl InformixLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + authentication_type: None, + credential: None, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Informix sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InformixSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A query to execute before starting the copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl InformixSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity source for Informix."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InformixSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl InformixSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The Informix table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InformixTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Informix table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl InformixTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Informix table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct InformixTableDatasetTypeProperties { + #[doc = "The Informix table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl InformixTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Synapse nested object which serves as a compute resource for activities."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntegrationRuntime { + #[doc = "The type of integration runtime."] + #[serde(rename = "type")] + pub type_: IntegrationRuntimeType, + #[doc = "Integration runtime description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +impl IntegrationRuntime { + pub fn new(type_: IntegrationRuntimeType) -> Self { + Self { type_, description: None } + } +} +#[doc = "Integration runtime debug resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntegrationRuntimeDebugResource { + #[serde(flatten)] + pub sub_resource_debug_resource: SubResourceDebugResource, + #[doc = "Azure Synapse nested object which serves as a compute resource for activities."] + pub properties: IntegrationRuntime, +} +impl IntegrationRuntimeDebugResource { + pub fn new(properties: IntegrationRuntime) -> Self { + Self { + sub_resource_debug_resource: SubResourceDebugResource::default(), + properties, + } + } +} +#[doc = "A list of integration runtime resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntegrationRuntimeListResponse { + #[doc = "List of integration runtimes."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl IntegrationRuntimeListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Integration runtime reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntegrationRuntimeReference { + #[doc = "Type of integration runtime."] + #[serde(rename = "type")] + pub type_: integration_runtime_reference::Type, + #[doc = "Reference integration runtime name."] + #[serde(rename = "referenceName")] + pub reference_name: String, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl IntegrationRuntimeReference { + pub fn new(type_: integration_runtime_reference::Type, reference_name: String) -> Self { + Self { + type_, + reference_name, + parameters: None, + } + } +} +pub mod integration_runtime_reference { + use super::*; + #[doc = "Type of integration runtime."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + IntegrationRuntimeReference, + } +} +#[doc = "Integration runtime resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntegrationRuntimeResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Azure Synapse nested object which serves as a compute resource for activities."] + pub properties: IntegrationRuntime, +} +impl IntegrationRuntimeResource { + pub fn new(properties: IntegrationRuntime) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "The type of integration runtime."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IntegrationRuntimeType { + Managed, + SelfHosted, +} +#[doc = "Jira Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JiraLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Jira Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: JiraLinkedServiceTypeProperties, +} +impl JiraLinkedService { + pub fn new(linked_service: LinkedService, type_properties: JiraLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Jira Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JiraLinkedServiceTypeProperties { + #[doc = "The IP address or host name of the Jira service. (e.g. jira.example.com)"] + pub host: serde_json::Value, + #[doc = "The TCP port that the Jira server uses to listen for client connections. The default value is 443 if connecting through HTTPS, or 8080 if connecting through HTTP."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The user name that you use to access Jira Service."] + pub username: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl JiraLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, username: serde_json::Value) -> Self { + Self { + host, + port: None, + username, + password: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Jira Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JiraObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl JiraObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Jira Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JiraSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl JiraSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Json dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Json dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl JsonDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Json dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The code page name of the preferred encoding. If not specified, the default value is UTF-8, unless BOM denotes another Unicode encoding. Refer to the name column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string)."] + #[serde(rename = "encodingName", default, skip_serializing_if = "Option::is_none")] + pub encoding_name: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl JsonDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + encoding_name: None, + compression: None, + } + } +} +#[doc = "The data stored in JSON format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonFormat { + #[serde(flatten)] + pub dataset_storage_format: DatasetStorageFormat, + #[doc = "File pattern of JSON. To be more specific, the way of separating a collection of JSON objects. The default value is 'setOfObjects'. It is case-sensitive."] + #[serde(rename = "filePattern", default, skip_serializing_if = "Option::is_none")] + pub file_pattern: Option, + #[doc = "The character used to separate nesting levels. Default value is '.' (dot). Type: string (or Expression with resultType string)."] + #[serde(rename = "nestingSeparator", default, skip_serializing_if = "Option::is_none")] + pub nesting_separator: Option, + #[doc = "The code page name of the preferred encoding. If not provided, the default value is 'utf-8', unless the byte order mark (BOM) denotes another Unicode encoding. The full list of supported values can be found in the 'Name' column of the table of encodings in the following reference: https://go.microsoft.com/fwlink/?linkid=861078. Type: string (or Expression with resultType string)."] + #[serde(rename = "encodingName", default, skip_serializing_if = "Option::is_none")] + pub encoding_name: Option, + #[doc = "The JSONPath of the JSON array element to be flattened. Example: \"$.ArrayPath\". Type: string (or Expression with resultType string)."] + #[serde(rename = "jsonNodeReference", default, skip_serializing_if = "Option::is_none")] + pub json_node_reference: Option, + #[doc = "The JSONPath definition for each column mapping with a customized column name to extract data from JSON file. For fields under root object, start with \"$\"; for fields inside the array chosen by jsonNodeReference property, start from the array element. Example: {\"Column1\": \"$.Column1Path\", \"Column2\": \"Column2PathInArray\"}. Type: object (or Expression with resultType object)."] + #[serde(rename = "jsonPathDefinition", default, skip_serializing_if = "Option::is_none")] + pub json_path_definition: Option, +} +impl JsonFormat { + pub fn new(dataset_storage_format: DatasetStorageFormat) -> Self { + Self { + dataset_storage_format, + file_pattern: None, + nesting_separator: None, + encoding_name: None, + json_node_reference: None, + json_path_definition: None, + } + } +} +#[doc = "JSON format file pattern. A property of JsonFormat."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum JsonFormatFilePattern { + #[serde(rename = "setOfObjects")] + SetOfObjects, + #[serde(rename = "arrayOfObjects")] + ArrayOfObjects, +} +#[doc = "Json read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonReadSettings { + #[serde(flatten)] + pub format_read_settings: FormatReadSettings, + #[doc = "Compression read settings."] + #[serde(rename = "compressionProperties", default, skip_serializing_if = "Option::is_none")] + pub compression_properties: Option, +} +impl JsonReadSettings { + pub fn new(format_read_settings: FormatReadSettings) -> Self { + Self { + format_read_settings, + compression_properties: None, + } + } +} +#[doc = "A copy activity Json sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Json write settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl JsonSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + format_settings: None, + } + } +} +#[doc = "A copy activity Json source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Json read settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl JsonSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + format_settings: None, + additional_columns: None, + } + } +} +#[doc = "All available filePatterns."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum JsonWriteFilePattern { + #[serde(rename = "setOfObjects")] + SetOfObjects, + #[serde(rename = "arrayOfObjects")] + ArrayOfObjects, +} +#[doc = "Json write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JsonWriteSettings { + #[serde(flatten)] + pub format_write_settings: FormatWriteSettings, + #[doc = "File pattern of JSON. This setting controls the way a collection of JSON objects will be treated. The default value is 'setOfObjects'. It is case-sensitive."] + #[serde(rename = "filePattern", default, skip_serializing_if = "Option::is_none")] + pub file_pattern: Option, +} +impl JsonWriteSettings { + pub fn new(format_write_settings: FormatWriteSettings) -> Self { + Self { + format_write_settings, + file_pattern: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KqlScript { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, +} +impl KqlScript { + pub fn new() -> Self { + Self::default() + } +} +pub mod kql_script { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Content { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[serde(rename = "currentConnection", default, skip_serializing_if = "Option::is_none")] + pub current_connection: Option, + } + impl Content { + pub fn new() -> Self { + Self::default() + } + } + pub mod content { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Metadata { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + } + impl Metadata { + pub fn new() -> Self { + Self::default() + } + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct CurrentConnection { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "poolName", default, skip_serializing_if = "Option::is_none")] + pub pool_name: Option, + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + } + impl CurrentConnection { + pub fn new() -> Self { + Self::default() + } + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KqlScriptResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl KqlScriptResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct KqlScriptsResourceCollectionResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl KqlScriptsResourceCollectionResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Library/package information of a Big Data pool powered by Apache Spark"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LibraryInfo { + #[doc = "Name of the library."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Storage blob path of library."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Storage blob container name."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The last update time of the library."] + #[serde(rename = "uploadedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub uploaded_timestamp: Option, + #[doc = "Type of the library."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Provisioning status of the library/package."] + #[serde(rename = "provisioningStatus", default, skip_serializing_if = "Option::is_none")] + pub provisioning_status: Option, + #[doc = "Creator Id of the library/package."] + #[serde(rename = "creatorId", default, skip_serializing_if = "Option::is_none")] + pub creator_id: Option, +} +impl LibraryInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of Library resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LibraryListResponse { + #[doc = "List of Library."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LibraryListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Library requirements for a Big Data pool powered by Apache Spark"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LibraryRequirements { + #[doc = "The last update time of the library requirements file."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, + #[doc = "The library requirements."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[doc = "The filename of the library requirements file."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filename: Option, +} +impl LibraryRequirements { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Library response details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LibraryResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Library/package properties"] + pub properties: LibraryResourceProperties, +} +impl LibraryResource { + pub fn new(properties: LibraryResourceProperties) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Library resource info "] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LibraryResourceInfo { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "record Id of the library/package."] + #[serde(rename = "recordId", default, skip_serializing_if = "Option::is_none")] + pub record_id: Option, + #[doc = "Provisioning status of the library/package."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The creation time of the library/package."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, + #[doc = "The last updated time of the library/package."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub changed: Option, + #[doc = "The type of the resource. E.g. LibraryArtifact"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Name of the library/package."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Operation Id of the operation performed on library/package."] + #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")] + pub operation_id: Option, + #[doc = "artifact Id of the library/package."] + #[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none")] + pub artifact_id: Option, +} +impl LibraryResourceInfo { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Library/package properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LibraryResourceProperties { + #[doc = "Name of the library/package."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Location of library/package in storage account."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Container name of the library/package."] + #[serde(rename = "containerName", default, skip_serializing_if = "Option::is_none")] + pub container_name: Option, + #[doc = "The last update time of the library/package."] + #[serde(rename = "uploadedTimestamp", default, skip_serializing_if = "Option::is_none")] + pub uploaded_timestamp: Option, + #[doc = "Type of the library/package."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Provisioning status of the library/package."] + #[serde(rename = "provisioningStatus", default, skip_serializing_if = "Option::is_none")] + pub provisioning_status: Option, + #[doc = "Creator Id of the library/package."] + #[serde(rename = "creatorId", default, skip_serializing_if = "Option::is_none")] + pub creator_id: Option, +} +impl LibraryResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnection { + #[serde(rename = "sourceDatabase", default, skip_serializing_if = "Option::is_none")] + pub source_database: Option, + #[serde(rename = "targetDatabase", default, skip_serializing_if = "Option::is_none")] + pub target_database: Option, + #[serde(rename = "landingZone", default, skip_serializing_if = "Option::is_none")] + pub landing_zone: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compute: Option, +} +impl LinkConnection { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionCompute { + #[doc = "Link connection's compute core count"] + #[serde(rename = "coreCount", default, skip_serializing_if = "Option::is_none")] + pub core_count: Option, + #[doc = "Link connection's compute type"] + #[serde(rename = "computeType", default, skip_serializing_if = "Option::is_none")] + pub compute_type: Option, +} +impl LinkConnectionCompute { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionDetailedStatus { + #[doc = "Link connection id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Link connection name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Is link connection applying changes"] + #[serde(rename = "isApplyingChanges", default, skip_serializing_if = "Option::is_none")] + pub is_applying_changes: Option, + #[doc = "Is link connection partially failed"] + #[serde(rename = "isPartiallyFailed", default, skip_serializing_if = "Option::is_none")] + pub is_partially_failed: Option, + #[doc = "Link connection start time"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Link connection stop time"] + #[serde(rename = "stopTime", default, skip_serializing_if = "Option::is_none")] + pub stop_time: Option, + #[doc = "Link connection status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Link connection's corresponding continuous run id"] + #[serde(rename = "continuousRunId", default, skip_serializing_if = "Option::is_none")] + pub continuous_run_id: Option, + #[doc = "Link connection error"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl LinkConnectionDetailedStatus { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionLandingZone { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[doc = "Landing zone's file system name"] + #[serde(rename = "fileSystem", default, skip_serializing_if = "Option::is_none")] + pub file_system: Option, + #[doc = "Landing zone's folder path name"] + #[serde(rename = "folderPath", default, skip_serializing_if = "Option::is_none")] + pub folder_path: Option, + #[doc = "Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, +} +impl LinkConnectionLandingZone { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkConnectionListResponse { + #[doc = "List link connection value"] + pub value: Vec, + #[doc = "List link connections next link"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LinkConnectionListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionQueryTableStatus { + #[doc = "Link tables' status"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "Continuation token to query table status"] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, +} +impl LinkConnectionQueryTableStatus { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkConnectionResource { + #[doc = "Link connection id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Link connection name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Link connection type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + pub properties: LinkConnection, +} +impl LinkConnectionResource { + pub fn new(properties: LinkConnection) -> Self { + Self { + id: None, + name: None, + type_: None, + properties, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionSourceDatabase { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl LinkConnectionSourceDatabase { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionSourceDatabaseTypeProperties { + #[doc = "Link connection source database server's resource id"] + #[serde(rename = "resourceId", default, skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + #[doc = "Link connection source database server's principal id"] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, +} +impl LinkConnectionSourceDatabaseTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkConnectionTargetDatabase { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, +} +impl LinkConnectionTargetDatabase { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableListResponse { + #[doc = "List link table value"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl LinkTableListResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableRequest { + #[doc = "Link table id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, + #[doc = "Link table operation type"] + #[serde(rename = "operationType", default, skip_serializing_if = "Option::is_none")] + pub operation_type: Option, +} +impl LinkTableRequest { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableRequestSource { + #[doc = "Source table table name"] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "Source table schema name"] + #[serde(rename = "schemaName", default, skip_serializing_if = "Option::is_none")] + pub schema_name: Option, +} +impl LinkTableRequestSource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableRequestTarget { + #[doc = "Target table table name"] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "Target table schema name"] + #[serde(rename = "schemaName", default, skip_serializing_if = "Option::is_none")] + pub schema_name: Option, + #[serde(rename = "distributionOptions", default, skip_serializing_if = "Option::is_none")] + pub distribution_options: Option, +} +impl LinkTableRequestTarget { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableRequestTargetDistributionOptions { + #[doc = "Target table distribution type"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Target table distribution column"] + #[serde(rename = "distributionColumn", default, skip_serializing_if = "Option::is_none")] + pub distribution_column: Option, +} +impl LinkTableRequestTargetDistributionOptions { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableResource { + #[doc = "Link table id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Link table name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, +} +impl LinkTableResource { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct LinkTableStatus { + #[doc = "Link table id"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "Link table status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Link table error message"] + #[serde(rename = "errorMessage", default, skip_serializing_if = "Option::is_none")] + pub error_message: Option, + #[doc = "Link table start time"] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "Link table stop time"] + #[serde(rename = "stopTime", default, skip_serializing_if = "Option::is_none")] + pub stop_time: Option, +} +impl LinkTableStatus { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Azure Synapse nested object which contains the information and credential which can be used to connect with related store or compute resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedService { + #[doc = "Type of linked service."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Integration runtime reference type."] + #[serde(rename = "connectVia", default, skip_serializing_if = "Option::is_none")] + pub connect_via: Option, + #[doc = "Linked service description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Definition of all parameters for an entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "List of tags that can be used for describing the linked service."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, +} +impl LinkedService { + pub fn new(type_: String) -> Self { + Self { + type_, + connect_via: None, + description: None, + parameters: None, + annotations: Vec::new(), + } + } +} +#[doc = "Linked service debug resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedServiceDebugResource { + #[serde(flatten)] + pub sub_resource_debug_resource: SubResourceDebugResource, + #[doc = "The Azure Synapse nested object which contains the information and credential which can be used to connect with related store or compute resource."] + pub properties: LinkedService, +} +impl LinkedServiceDebugResource { + pub fn new(properties: LinkedService) -> Self { + Self { + sub_resource_debug_resource: SubResourceDebugResource::default(), + properties, + } + } +} +#[doc = "A list of linked service resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedServiceListResponse { + #[doc = "List of linked services."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl LinkedServiceListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Linked service reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedServiceReference { + #[doc = "Linked service reference type."] + #[serde(rename = "type")] + pub type_: linked_service_reference::Type, + #[doc = "Reference LinkedService name."] + #[serde(rename = "referenceName")] + pub reference_name: String, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl LinkedServiceReference { + pub fn new(type_: linked_service_reference::Type, reference_name: String) -> Self { + Self { + type_, + reference_name, + parameters: None, + } + } +} +pub mod linked_service_reference { + use super::*; + #[doc = "Linked service reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + LinkedServiceReference, + } +} +#[doc = "Linked service resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedServiceResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "The Azure Synapse nested object which contains the information and credential which can be used to connect with related store or compute resource."] + pub properties: LinkedService, +} +impl LinkedServiceResource { + pub fn new(properties: LinkedService) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Log location settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogLocationSettings { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl LogLocationSettings { + pub fn new(linked_service_name: LinkedServiceReference) -> Self { + Self { + linked_service_name, + path: None, + } + } +} +#[doc = "Log settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogSettings { + #[doc = "Specifies whether to enable copy activity log. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableCopyActivityLog", default, skip_serializing_if = "Option::is_none")] + pub enable_copy_activity_log: Option, + #[doc = "Settings for copy activity log."] + #[serde(rename = "copyActivityLogSettings", default, skip_serializing_if = "Option::is_none")] + pub copy_activity_log_settings: Option, + #[doc = "Log location settings."] + #[serde(rename = "logLocationSettings")] + pub log_location_settings: LogLocationSettings, +} +impl LogSettings { + pub fn new(log_location_settings: LogLocationSettings) -> Self { + Self { + enable_copy_activity_log: None, + copy_activity_log_settings: None, + log_location_settings, + } + } +} +#[doc = "(Deprecated. Please use LogSettings) Log storage settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LogStorageSettings { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string)."] + #[serde(rename = "logLevel", default, skip_serializing_if = "Option::is_none")] + pub log_level: Option, + #[doc = "Specifies whether to enable reliable logging. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableReliableLogging", default, skip_serializing_if = "Option::is_none")] + pub enable_reliable_logging: Option, +} +impl LogStorageSettings { + pub fn new(linked_service_name: LinkedServiceReference) -> Self { + Self { + linked_service_name, + path: None, + log_level: None, + enable_reliable_logging: None, + } + } +} +#[doc = "Lookup activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LookupActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Lookup activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: LookupActivityTypeProperties, +} +impl LookupActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: LookupActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Lookup activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LookupActivityTypeProperties { + #[doc = "A copy activity source."] + pub source: CopySource, + #[doc = "Dataset reference type."] + pub dataset: DatasetReference, + #[doc = "Whether to return first row or all rows. Default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "firstRowOnly", default, skip_serializing_if = "Option::is_none")] + pub first_row_only: Option, +} +impl LookupActivityTypeProperties { + pub fn new(source: CopySource, dataset: DatasetReference) -> Self { + Self { + source, + dataset, + first_row_only: None, + } + } +} +#[doc = "Magento server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MagentoLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Magento server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MagentoLinkedServiceTypeProperties, +} +impl MagentoLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MagentoLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Magento server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MagentoLinkedServiceTypeProperties { + #[doc = "The URL of the Magento instance. (i.e. 192.168.222.110/magento3)"] + pub host: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MagentoLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + access_token: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Magento server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MagentoObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MagentoObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Magento server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MagentoSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl MagentoSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The workspace managed identity"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedIdentity { + #[doc = "The principal ID of the workspace managed identity"] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The tenant ID of the workspace managed identity"] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "The type of managed identity for the workspace"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl ManagedIdentity { + pub fn new() -> Self { + Self::default() + } +} +pub mod managed_identity { + use super::*; + #[doc = "The type of managed identity for the workspace"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + None, + SystemAssigned, + } +} +#[doc = "Managed Virtual Network Settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ManagedVirtualNetworkSettings { + #[doc = "Prevent Data Exfiltration"] + #[serde(rename = "preventDataExfiltration", default, skip_serializing_if = "Option::is_none")] + pub prevent_data_exfiltration: Option, + #[doc = "Linked Access Check On Target Resource"] + #[serde(rename = "linkedAccessCheckOnTargetResource", default, skip_serializing_if = "Option::is_none")] + pub linked_access_check_on_target_resource: Option, + #[doc = "Allowed Aad Tenant Ids For Linking"] + #[serde(rename = "allowedAadTenantIdsForLinking", default, skip_serializing_if = "Vec::is_empty")] + pub allowed_aad_tenant_ids_for_linking: Vec, +} +impl ManagedVirtualNetworkSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Mapping data flow."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MappingDataFlow { + #[serde(flatten)] + pub data_flow: DataFlow, + #[doc = "Mapping data flow type properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MappingDataFlow { + pub fn new(data_flow: DataFlow) -> Self { + Self { + data_flow, + type_properties: None, + } + } +} +#[doc = "Mapping data flow type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MappingDataFlowTypeProperties { + #[doc = "List of sources in data flow."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sources: Vec, + #[doc = "List of sinks in data flow."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sinks: Vec, + #[doc = "List of transformations in data flow."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transformations: Vec, + #[doc = "DataFlow script."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub script: Option, + #[doc = "Data flow script lines."] + #[serde(rename = "scriptLines", default, skip_serializing_if = "Vec::is_empty")] + pub script_lines: Vec, +} +impl MappingDataFlowTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "MariaDB server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MariaDbLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "MariaDB server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MariaDbLinkedServiceTypeProperties, +} +impl MariaDbLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MariaDbLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "MariaDB server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MariaDbLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MariaDbLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity MariaDB server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MariaDbSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl MariaDbSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "MariaDB server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MariaDbTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MariaDbTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Marketo server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarketoLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Marketo server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MarketoLinkedServiceTypeProperties, +} +impl MarketoLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MarketoLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Marketo server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarketoLinkedServiceTypeProperties { + #[doc = "The endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com)"] + pub endpoint: serde_json::Value, + #[doc = "The client Id of your Marketo service."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MarketoLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value, client_id: serde_json::Value) -> Self { + Self { + endpoint, + client_id, + client_secret: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Marketo server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarketoObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MarketoObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Marketo server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MarketoSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl MarketoSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Microsoft Access linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MicrosoftAccessLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Microsoft Access linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MicrosoftAccessLinkedServiceTypeProperties, +} +impl MicrosoftAccessLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MicrosoftAccessLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Microsoft Access linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MicrosoftAccessLinkedServiceTypeProperties { + #[doc = "The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Type of authentication used to connect to the Microsoft Access as ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[doc = "User name for Basic authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MicrosoftAccessLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + authentication_type: None, + credential: None, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity Microsoft Access sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MicrosoftAccessSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A query to execute before starting the copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl MicrosoftAccessSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity source for Microsoft Access."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MicrosoftAccessSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl MicrosoftAccessSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[doc = "The Microsoft Access table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MicrosoftAccessTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Microsoft Access table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MicrosoftAccessTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Microsoft Access table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MicrosoftAccessTableDatasetTypeProperties { + #[doc = "The Microsoft Access table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl MicrosoftAccessTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The MongoDB Atlas database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbAtlasCollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "MongoDB Atlas database dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbAtlasCollectionDatasetTypeProperties, +} +impl MongoDbAtlasCollectionDataset { + pub fn new(dataset: Dataset, type_properties: MongoDbAtlasCollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "MongoDB Atlas database dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbAtlasCollectionDatasetTypeProperties { + #[doc = "The collection name of the MongoDB Atlas database. Type: string (or Expression with resultType string)."] + pub collection: serde_json::Value, +} +impl MongoDbAtlasCollectionDatasetTypeProperties { + pub fn new(collection: serde_json::Value) -> Self { + Self { collection } + } +} +#[doc = "Linked service for MongoDB Atlas data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbAtlasLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "MongoDB Atlas linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbAtlasLinkedServiceTypeProperties, +} +impl MongoDbAtlasLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MongoDbAtlasLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "MongoDB Atlas linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbAtlasLinkedServiceTypeProperties { + #[doc = "The MongoDB Atlas connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The name of the MongoDB Atlas database that you want to access. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, +} +impl MongoDbAtlasLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value, database: serde_json::Value) -> Self { + Self { + connection_string, + database, + } + } +} +#[doc = "A copy activity source for a MongoDB Atlas database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbAtlasSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Specifies selection filter using query operators. To return all documents in a collection, omit this parameter or pass an empty document ({}). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[doc = "Cursor methods for Mongodb query"] + #[serde(rename = "cursorMethods", default, skip_serializing_if = "Option::is_none")] + pub cursor_methods: Option, + #[doc = "Specifies the number of documents to return in each batch of the response from MongoDB Atlas instance. In most cases, modifying the batch size will not affect the user or the application. This property's main purpose is to avoid hit the limitation of response size. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "batchSize", default, skip_serializing_if = "Option::is_none")] + pub batch_size: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl MongoDbAtlasSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + filter: None, + cursor_methods: None, + batch_size: None, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "The MongoDB database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "MongoDB database dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbCollectionDatasetTypeProperties, +} +impl MongoDbCollectionDataset { + pub fn new(dataset: Dataset, type_properties: MongoDbCollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "MongoDB database dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionDatasetTypeProperties { + #[doc = "The table name of the MongoDB database. Type: string (or Expression with resultType string)."] + #[serde(rename = "collectionName")] + pub collection_name: serde_json::Value, +} +impl MongoDbCollectionDatasetTypeProperties { + pub fn new(collection_name: serde_json::Value) -> Self { + Self { collection_name } + } +} +#[doc = "Cursor methods for Mongodb query"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MongoDbCursorMethodsProperties { + #[doc = "Specifies the fields to return in the documents that match the query filter. To return all fields in the matching documents, omit this parameter. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub project: Option, + #[doc = "Specifies the order in which the query returns matching documents. Type: string (or Expression with resultType string). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sort: Option, + #[doc = "Specifies the how many documents skipped and where MongoDB begins returning results. This approach may be useful in implementing paginated results. Type: integer (or Expression with resultType integer)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip: Option, + #[doc = "Specifies the maximum number of documents the server returns. limit() is analogous to the LIMIT statement in a SQL database. Type: integer (or Expression with resultType integer)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, +} +impl MongoDbCursorMethodsProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for MongoDb data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "MongoDB linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbLinkedServiceTypeProperties, +} +impl MongoDbLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MongoDbLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "MongoDB linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbLinkedServiceTypeProperties { + #[doc = "The IP address or server name of the MongoDB server. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "The authentication type to be used to connect to the MongoDB database."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The name of the MongoDB database that you want to access. Type: string (or Expression with resultType string)."] + #[serde(rename = "databaseName")] + pub database_name: serde_json::Value, + #[doc = "Username for authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Database to verify the username and password. Type: string (or Expression with resultType string)."] + #[serde(rename = "authSource", default, skip_serializing_if = "Option::is_none")] + pub auth_source: Option, + #[doc = "The TCP port number that the MongoDB server uses to listen for client connections. The default value is 27017. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MongoDbLinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, database_name: serde_json::Value) -> Self { + Self { + server, + authentication_type: None, + database_name, + username: None, + password: None, + auth_source: None, + port: None, + enable_ssl: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod mongo_db_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to be used to connect to the MongoDB database."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Anonymous, + } +} +#[doc = "A copy activity source for a MongoDB database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Database query. Should be a SQL-92 query expression. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl MongoDbSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[doc = "The MongoDB database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbV2CollectionDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "MongoDB database dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbV2CollectionDatasetTypeProperties, +} +impl MongoDbV2CollectionDataset { + pub fn new(dataset: Dataset, type_properties: MongoDbV2CollectionDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "MongoDB database dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbV2CollectionDatasetTypeProperties { + #[doc = "The collection name of the MongoDB database. Type: string (or Expression with resultType string)."] + pub collection: serde_json::Value, +} +impl MongoDbV2CollectionDatasetTypeProperties { + pub fn new(collection: serde_json::Value) -> Self { + Self { collection } + } +} +#[doc = "Linked service for MongoDB data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbV2LinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "MongoDB linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MongoDbV2LinkedServiceTypeProperties, +} +impl MongoDbV2LinkedService { + pub fn new(linked_service: LinkedService, type_properties: MongoDbV2LinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "MongoDB linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbV2LinkedServiceTypeProperties { + #[doc = "The MongoDB connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The name of the MongoDB database that you want to access. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, +} +impl MongoDbV2LinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value, database: serde_json::Value) -> Self { + Self { + connection_string, + database, + } + } +} +#[doc = "A copy activity source for a MongoDB database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbV2Source { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Specifies selection filter using query operators. To return all documents in a collection, omit this parameter or pass an empty document ({}). Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub filter: Option, + #[doc = "Cursor methods for Mongodb query"] + #[serde(rename = "cursorMethods", default, skip_serializing_if = "Option::is_none")] + pub cursor_methods: Option, + #[doc = "Specifies the number of documents to return in each batch of the response from MongoDB instance. In most cases, modifying the batch size will not affect the user or the application. This property's main purpose is to avoid hit the limitation of response size. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "batchSize", default, skip_serializing_if = "Option::is_none")] + pub batch_size: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl MongoDbV2Source { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + filter: None, + cursor_methods: None, + batch_size: None, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "Base class for all triggers that support one to many model for trigger to pipeline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MultiplePipelineTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "Pipelines that need to be started."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pipelines: Vec, +} +impl MultiplePipelineTrigger { + pub fn new(trigger: Trigger) -> Self { + Self { + trigger, + pipelines: Vec::new(), + } + } +} +#[doc = "Linked service for MySQL data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MySqlLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "MySQL linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: MySqlLinkedServiceTypeProperties, +} +impl MySqlLinkedService { + pub fn new(linked_service: LinkedService, type_properties: MySqlLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "MySQL linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MySqlLinkedServiceTypeProperties { + #[doc = "The connection string."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl MySqlLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for MySQL databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MySqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl MySqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The MySQL table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MySqlTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "MySql table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl MySqlTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "MySql table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MySqlTableDatasetTypeProperties { + #[doc = "The MySQL table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl MySqlTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Netezza linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetezzaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Netezza linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: NetezzaLinkedServiceTypeProperties, +} +impl NetezzaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: NetezzaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Netezza linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetezzaLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl NetezzaLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The partition mechanism that will be used for Netezza read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetezzaPartitionOption { + None, + DataSlice, + DynamicRange, +} +#[doc = "The settings that will be leveraged for Netezza source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetezzaPartitionSettings { + #[doc = "The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, +} +impl NetezzaPartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Netezza source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetezzaSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The partition mechanism that will be used for Netezza read in parallel."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Netezza source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl NetezzaSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + partition_option: None, + partition_settings: None, + } + } +} +pub mod netezza_source { + use super::*; + #[doc = "The partition mechanism that will be used for Netezza read in parallel."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PartitionOption { + None, + DataSlice, + DynamicRange, + } +} +#[doc = "Netezza dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NetezzaTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Netezza dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl NetezzaTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Netezza dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NetezzaTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Netezza. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Netezza. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl NetezzaTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notebook."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Notebook { + #[doc = "The description of the notebook."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Big data pool reference."] + #[serde(rename = "bigDataPool", default, skip_serializing_if = "Option::is_none")] + pub big_data_pool: Option, + #[doc = "Session properties."] + #[serde(rename = "sessionProperties", default, skip_serializing_if = "Option::is_none")] + pub session_properties: Option, + #[doc = "Notebook root-level metadata."] + pub metadata: NotebookMetadata, + #[doc = "Notebook format (major number). Incremented between backwards incompatible changes to the notebook format."] + pub nbformat: i64, + #[doc = "Notebook format (minor number). Incremented for backward compatible changes to the notebook format."] + pub nbformat_minor: i64, + #[doc = "Array of cells of the current notebook."] + pub cells: Vec, + #[doc = "The folder that this notebook is in. If not specified, this notebook will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl Notebook { + pub fn new(metadata: NotebookMetadata, nbformat: i64, nbformat_minor: i64, cells: Vec) -> Self { + Self { + description: None, + big_data_pool: None, + session_properties: None, + metadata, + nbformat, + nbformat_minor, + cells, + folder: None, + } + } +} +pub mod notebook { + use super::*; + #[doc = "The folder that this notebook is in. If not specified, this notebook will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this notebook is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Notebook cell."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookCell { + #[doc = "String identifying the type of cell."] + pub cell_type: String, + #[doc = "Cell-level metadata."] + pub metadata: serde_json::Value, + #[doc = "Contents of the cell, represented as an array of lines."] + pub source: Vec, + #[doc = "Attachments associated with the cell."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub attachments: Option, + #[doc = "Cell-level output items."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub outputs: Vec, +} +impl NotebookCell { + pub fn new(cell_type: String, metadata: serde_json::Value, source: Vec) -> Self { + Self { + cell_type, + metadata, + source, + attachments: None, + outputs: Vec::new(), + } + } +} +#[doc = "An item of the notebook cell execution output."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookCellOutputItem { + #[doc = "For output_type=stream, determines the name of stream (stdout / stderr)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Execution sequence number."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub execution_count: Option, + #[doc = "Execution, display, or stream outputs."] + pub output_type: notebook_cell_output_item::OutputType, + #[doc = "For output_type=stream, the stream's text output, represented as a string or an array of strings."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, + #[doc = "Output data. Use MIME type as key, and content as value."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, + #[doc = "Metadata for the output item."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, +} +impl NotebookCellOutputItem { + pub fn new(output_type: notebook_cell_output_item::OutputType) -> Self { + Self { + name: None, + execution_count: None, + output_type, + text: None, + data: None, + metadata: None, + } + } +} +pub mod notebook_cell_output_item { + use super::*; + #[doc = "Execution, display, or stream outputs."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OutputType { + #[serde(rename = "execute_result")] + ExecuteResult, + #[serde(rename = "display_data")] + DisplayData, + #[serde(rename = "stream")] + Stream, + #[serde(rename = "error")] + Error, + } +} +#[doc = "Kernel information."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookKernelSpec { + #[doc = "Name of the kernel specification."] + pub name: String, + #[doc = "Name to display in UI."] + pub display_name: String, +} +impl NotebookKernelSpec { + pub fn new(name: String, display_name: String) -> Self { + Self { name, display_name } + } +} +#[doc = "Language info."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookLanguageInfo { + #[doc = "The programming language which this kernel runs."] + pub name: String, + #[doc = "The codemirror mode to use for code in this language."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub codemirror_mode: Option, +} +impl NotebookLanguageInfo { + pub fn new(name: String) -> Self { + Self { + name, + codemirror_mode: None, + } + } +} +#[doc = "A list of Notebook resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookListResponse { + #[doc = "List of Notebooks."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl NotebookListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Notebook root-level metadata."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookMetadata { + #[doc = "Kernel information."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kernelspec: Option, + #[doc = "Language info."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language_info: Option, +} +impl NotebookMetadata { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notebook parameter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct NotebookParameter { + #[doc = "Notebook parameter value. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Notebook parameter type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl NotebookParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Notebook parameter type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NotebookParameterType { + #[serde(rename = "string")] + String, + #[serde(rename = "int")] + Int, + #[serde(rename = "float")] + Float, + #[serde(rename = "bool")] + Bool, +} +#[doc = "Notebook resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookResource { + #[doc = "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + pub name: String, + #[doc = "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Etag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "Notebook."] + pub properties: Notebook, +} +impl NotebookResource { + pub fn new(name: String, properties: Notebook) -> Self { + Self { + id: None, + name, + type_: None, + etag: None, + properties, + } + } +} +#[doc = "Session properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookSessionProperties { + #[doc = "Amount of memory to use for the driver process."] + #[serde(rename = "driverMemory")] + pub driver_memory: String, + #[doc = "Number of cores to use for the driver."] + #[serde(rename = "driverCores")] + pub driver_cores: i64, + #[doc = "Amount of memory to use per executor process."] + #[serde(rename = "executorMemory")] + pub executor_memory: String, + #[doc = "Number of cores to use for each executor."] + #[serde(rename = "executorCores")] + pub executor_cores: i64, + #[doc = "Number of executors to launch for this session."] + #[serde(rename = "numExecutors")] + pub num_executors: i64, +} +impl NotebookSessionProperties { + pub fn new(driver_memory: String, driver_cores: i64, executor_memory: String, executor_cores: i64, num_executors: i64) -> Self { + Self { + driver_memory, + driver_cores, + executor_memory, + executor_cores, + num_executors, + } + } +} +#[doc = "Open Data Protocol (OData) linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ODataLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "OData linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ODataLinkedServiceTypeProperties, +} +impl ODataLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ODataLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "OData linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ODataLinkedServiceTypeProperties { + #[doc = "The URL of the OData service endpoint. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "Type of authentication used to connect to the OData service."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "User name of the OData service. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specify the tenant information (domain name or tenant ID) under which your application resides. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Specify the application id of your application registered in Azure Active Directory. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "Specify the resource you are requesting authorization to use Directory. Type: string (or Expression with resultType string)."] + #[serde(rename = "aadResourceId", default, skip_serializing_if = "Option::is_none")] + pub aad_resource_id: Option, + #[doc = "Specify the credential type (key or cert) is used for service principal."] + #[serde(rename = "aadServicePrincipalCredentialType", default, skip_serializing_if = "Option::is_none")] + pub aad_service_principal_credential_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalEmbeddedCert", default, skip_serializing_if = "Option::is_none")] + pub service_principal_embedded_cert: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalEmbeddedCertPassword", default, skip_serializing_if = "Option::is_none")] + pub service_principal_embedded_cert_password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ODataLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + authentication_type: None, + user_name: None, + password: None, + tenant: None, + service_principal_id: None, + azure_cloud_type: None, + aad_resource_id: None, + aad_service_principal_credential_type: None, + service_principal_key: None, + service_principal_embedded_cert: None, + service_principal_embedded_cert_password: None, + encrypted_credential: None, + } + } +} +pub mod o_data_linked_service_type_properties { + use super::*; + #[doc = "Type of authentication used to connect to the OData service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Anonymous, + Windows, + AadServicePrincipal, + ManagedServiceIdentity, + } + #[doc = "Specify the credential type (key or cert) is used for service principal."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AadServicePrincipalCredentialType { + ServicePrincipalKey, + ServicePrincipalCert, + } +} +#[doc = "The Open Data Protocol (OData) resource dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ODataResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "OData dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ODataResourceDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "OData dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ODataResourceDatasetTypeProperties { + #[doc = "The OData resource path. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl ODataResourceDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity source for OData source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ODataSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "OData query. For example, \"$top=1\". Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:05:00. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl ODataSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + http_request_timeout: None, + additional_columns: None, + } + } +} +#[doc = "Open Database Connectivity (ODBC) linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OdbcLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "ODBC linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: OdbcLinkedServiceTypeProperties, +} +impl OdbcLinkedService { + pub fn new(linked_service: LinkedService, type_properties: OdbcLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "ODBC linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OdbcLinkedServiceTypeProperties { + #[doc = "The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Type of authentication used to connect to the ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string)."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub credential: Option, + #[doc = "User name for Basic authentication. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl OdbcLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + authentication_type: None, + credential: None, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity ODBC sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OdbcSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "A query to execute before starting the copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl OdbcSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity source for ODBC databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OdbcSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl OdbcSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The ODBC table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OdbcTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "ODBC table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl OdbcTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "ODBC table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OdbcTableDatasetTypeProperties { + #[doc = "The ODBC table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl OdbcTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Office365 account."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Office365Dataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Office365 dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: Office365DatasetTypeProperties, +} +impl Office365Dataset { + pub fn new(dataset: Dataset, type_properties: Office365DatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Office365 dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Office365DatasetTypeProperties { + #[doc = "Name of the dataset to extract from Office 365. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName")] + pub table_name: serde_json::Value, + #[doc = "A predicate expression that can be used to filter the specific rows to extract from Office 365. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub predicate: Option, +} +impl Office365DatasetTypeProperties { + pub fn new(table_name: serde_json::Value) -> Self { + Self { + table_name, + predicate: None, + } + } +} +#[doc = "Office365 linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Office365LinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Office365 linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: Office365LinkedServiceTypeProperties, +} +impl Office365LinkedService { + pub fn new(linked_service: LinkedService, type_properties: Office365LinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Office365 linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Office365LinkedServiceTypeProperties { + #[doc = "Azure tenant ID to which the Office 365 account belongs. Type: string (or Expression with resultType string)."] + #[serde(rename = "office365TenantId")] + pub office365_tenant_id: serde_json::Value, + #[doc = "Specify the tenant information under which your Azure AD web application resides. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalTenantId")] + pub service_principal_tenant_id: serde_json::Value, + #[doc = "Specify the application's client ID. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId")] + pub service_principal_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey")] + pub service_principal_key: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl Office365LinkedServiceTypeProperties { + pub fn new( + office365_tenant_id: serde_json::Value, + service_principal_tenant_id: serde_json::Value, + service_principal_id: serde_json::Value, + service_principal_key: SecretBase, + ) -> Self { + Self { + office365_tenant_id, + service_principal_tenant_id, + service_principal_id, + service_principal_key, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for an Office 365 service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Office365Source { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "The groups containing all the users. Type: array of strings (or Expression with resultType array of strings)."] + #[serde(rename = "allowedGroups", default, skip_serializing_if = "Option::is_none")] + pub allowed_groups: Option, + #[doc = "The user scope uri. Type: string (or Expression with resultType string)."] + #[serde(rename = "userScopeFilterUri", default, skip_serializing_if = "Option::is_none")] + pub user_scope_filter_uri: Option, + #[doc = "The Column to apply the and . Type: string (or Expression with resultType string)."] + #[serde(rename = "dateFilterColumn", default, skip_serializing_if = "Option::is_none")] + pub date_filter_column: Option, + #[doc = "Start time of the requested range for this dataset. Type: string (or Expression with resultType string)."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "End time of the requested range for this dataset. Type: string (or Expression with resultType string)."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The columns to be read out from the Office 365 table. Type: array of objects (or Expression with resultType array of objects). Example: [ { \"name\": \"Id\" }, { \"name\": \"CreatedDateTime\" } ]"] + #[serde(rename = "outputColumns", default, skip_serializing_if = "Option::is_none")] + pub output_columns: Option, +} +impl Office365Source { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + allowed_groups: None, + user_scope_filter_uri: None, + date_filter_column: None, + start_time: None, + end_time: None, + output_columns: None, + } + } +} +#[doc = "Operation status for the operation"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OperationResult { + #[doc = "Operation status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The object that defines the structure of an Azure Synapse error."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl OperationResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Oracle database."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Oracle database linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: OracleLinkedServiceTypeProperties, +} +impl OracleLinkedService { + pub fn new(linked_service: LinkedService, type_properties: OracleLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Oracle database linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl OracleLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "The partition mechanism that will be used for Oracle read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OraclePartitionOption { + None, + PhysicalPartitionsOfTable, + DynamicRange, +} +#[doc = "The settings that will be leveraged for Oracle source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OraclePartitionSettings { + #[doc = "Names of the physical partitions of Oracle table. "] + #[serde(rename = "partitionNames", default, skip_serializing_if = "Option::is_none")] + pub partition_names: Option, + #[doc = "The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, +} +impl OraclePartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Oracle Service Cloud linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleServiceCloudLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Oracle Service Cloud linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: OracleServiceCloudLinkedServiceTypeProperties, +} +impl OracleServiceCloudLinkedService { + pub fn new(linked_service: LinkedService, type_properties: OracleServiceCloudLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Oracle Service Cloud linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleServiceCloudLinkedServiceTypeProperties { + #[doc = "The URL of the Oracle Service Cloud instance."] + pub host: serde_json::Value, + #[doc = "The user name that you use to access Oracle Service Cloud server."] + pub username: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl OracleServiceCloudLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, username: serde_json::Value, password: SecretBase) -> Self { + Self { + host, + username, + password, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Oracle Service Cloud dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleServiceCloudObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl OracleServiceCloudObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Oracle Service Cloud source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleServiceCloudSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl OracleServiceCloudSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "A copy activity Oracle sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, +} +impl OracleSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + } + } +} +#[doc = "A copy activity Oracle source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Oracle reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "oracleReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub oracle_reader_query: Option, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "The partition mechanism that will be used for Oracle read in parallel."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Oracle source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl OracleSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + oracle_reader_query: None, + query_timeout: None, + partition_option: None, + partition_settings: None, + additional_columns: None, + } + } +} +pub mod oracle_source { + use super::*; + #[doc = "The partition mechanism that will be used for Oracle read in parallel."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PartitionOption { + None, + PhysicalPartitionsOfTable, + DynamicRange, + } +} +#[doc = "The on-premises Oracle database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OracleTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "On-premises Oracle dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl OracleTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "On-premises Oracle dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct OracleTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The schema name of the on-premises Oracle database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the on-premises Oracle database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl OracleTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum OrcCompressionCodec { + #[serde(rename = "none")] + None, + #[serde(rename = "zlib")] + Zlib, + #[serde(rename = "snappy")] + Snappy, + #[serde(rename = "lzo")] + Lzo, +} +#[doc = "ORC dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "ORC dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl OrcDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "ORC dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The data orcCompressionCodec. Type: string (or Expression with resultType string)."] + #[serde(rename = "orcCompressionCodec", default, skip_serializing_if = "Option::is_none")] + pub orc_compression_codec: Option, +} +impl OrcDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + orc_compression_codec: None, + } + } +} +#[doc = "The data stored in Optimized Row Columnar (ORC) format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcFormat { + #[serde(flatten)] + pub dataset_storage_format: DatasetStorageFormat, +} +impl OrcFormat { + pub fn new(dataset_storage_format: DatasetStorageFormat) -> Self { + Self { dataset_storage_format } + } +} +#[doc = "A copy activity ORC sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Orc write settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl OrcSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + format_settings: None, + } + } +} +#[doc = "A copy activity ORC source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl OrcSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + additional_columns: None, + } + } +} +#[doc = "Orc write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OrcWriteSettings { + #[serde(flatten)] + pub format_write_settings: FormatWriteSettings, + #[doc = "Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxRowsPerFile", default, skip_serializing_if = "Option::is_none")] + pub max_rows_per_file: Option, + #[doc = "Specifies the file name pattern _. when copy from non-file based store without partitionOptions. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub file_name_prefix: Option, +} +impl OrcWriteSettings { + pub fn new(format_write_settings: FormatWriteSettings) -> Self { + Self { + format_write_settings, + max_rows_per_file: None, + file_name_prefix: None, + } + } +} +#[doc = "Definition of all parameters for an entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParameterDefinitionSpecification {} +impl ParameterDefinitionSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Definition of a single parameter for an entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParameterSpecification { + #[doc = "Parameter type."] + #[serde(rename = "type")] + pub type_: parameter_specification::Type, + #[doc = "Default value of parameter."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, +} +impl ParameterSpecification { + pub fn new(type_: parameter_specification::Type) -> Self { + Self { + type_, + default_value: None, + } + } +} +pub mod parameter_specification { + use super::*; + #[doc = "Parameter type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Object, + String, + Int, + Float, + Bool, + Array, + SecureString, + } +} +#[doc = "An object mapping parameter names to argument values."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ParameterValueSpecification {} +impl ParameterValueSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ParquetCompressionCodecEnum { + #[serde(rename = "none")] + None, + #[serde(rename = "gzip")] + Gzip, + #[serde(rename = "snappy")] + Snappy, + #[serde(rename = "lzo")] + Lzo, +} +#[doc = "Parquet dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Parquet dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ParquetDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Parquet dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "A string from ParquetCompressionCodecEnum or an expression"] + #[serde(rename = "compressionCodec", default, skip_serializing_if = "Option::is_none")] + pub compression_codec: Option, +} +impl ParquetDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + compression_codec: None, + } + } +} +#[doc = "The data stored in Parquet format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetFormat { + #[serde(flatten)] + pub dataset_storage_format: DatasetStorageFormat, +} +impl ParquetFormat { + pub fn new(dataset_storage_format: DatasetStorageFormat) -> Self { + Self { dataset_storage_format } + } +} +#[doc = "A copy activity Parquet sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "Connector write settings."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Parquet write settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, +} +impl ParquetSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + store_settings: None, + format_settings: None, + } + } +} +#[doc = "A copy activity Parquet source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl ParquetSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + additional_columns: None, + } + } +} +#[doc = "Parquet write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ParquetWriteSettings { + #[serde(flatten)] + pub format_write_settings: FormatWriteSettings, + #[doc = "Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxRowsPerFile", default, skip_serializing_if = "Option::is_none")] + pub max_rows_per_file: Option, + #[doc = "Specifies the file name pattern _. when copy from non-file based store without partitionOptions. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileNamePrefix", default, skip_serializing_if = "Option::is_none")] + pub file_name_prefix: Option, +} +impl ParquetWriteSettings { + pub fn new(format_write_settings: FormatWriteSettings) -> Self { + Self { + format_write_settings, + max_rows_per_file: None, + file_name_prefix: None, + } + } +} +#[doc = "Paypal Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PaypalLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Paypal Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: PaypalLinkedServiceTypeProperties, +} +impl PaypalLinkedService { + pub fn new(linked_service: LinkedService, type_properties: PaypalLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Paypal Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PaypalLinkedServiceTypeProperties { + #[doc = "The URL\u{a0}of the PayPal instance. (i.e. api.sandbox.paypal.com)"] + pub host: serde_json::Value, + #[doc = "The client ID associated with your PayPal application."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl PaypalLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, client_id: serde_json::Value) -> Self { + Self { + host, + client_id, + client_secret: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Paypal Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PaypalObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl PaypalObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Paypal Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PaypalSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl PaypalSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Phoenix Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PhoenixDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Phoenix. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Phoenix. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl PhoenixDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Phoenix server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhoenixLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Phoenix server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: PhoenixLinkedServiceTypeProperties, +} +impl PhoenixLinkedService { + pub fn new(linked_service: LinkedService, type_properties: PhoenixLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Phoenix server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhoenixLinkedServiceTypeProperties { + #[doc = "The IP address or host name of the Phoenix server. (i.e. 192.168.222.160)"] + pub host: serde_json::Value, + #[doc = "The TCP port that the Phoenix server uses to listen for client connections. The default value is 8765."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The partial URL corresponding to the Phoenix server. (i.e. /gateway/sandbox/phoenix/version). The default value is hbasephoenix if using WindowsAzureHDInsightService."] + #[serde(rename = "httpPath", default, skip_serializing_if = "Option::is_none")] + pub http_path: Option, + #[doc = "The authentication mechanism used to connect to the Phoenix server."] + #[serde(rename = "authenticationType")] + pub authentication_type: phoenix_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used to connect to the Phoenix server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl PhoenixLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, authentication_type: phoenix_linked_service_type_properties::AuthenticationType) -> Self { + Self { + host, + port: None, + http_path: None, + authentication_type, + username: None, + password: None, + enable_ssl: None, + trusted_cert_path: None, + use_system_trust_store: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod phoenix_linked_service_type_properties { + use super::*; + #[doc = "The authentication mechanism used to connect to the Phoenix server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + UsernameAndPassword, + #[serde(rename = "WindowsAzureHDInsightService")] + WindowsAzureHdInsightService, + } +} +#[doc = "Phoenix server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhoenixObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Phoenix Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl PhoenixObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Phoenix server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhoenixSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl PhoenixSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "A workspace pipeline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Pipeline { + #[doc = "The description of the pipeline."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "List of activities in pipeline."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub activities: Vec, + #[doc = "Definition of all parameters for an entity."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "Definition of variable for a Pipeline."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub variables: Option, + #[doc = "The max number of concurrent runs for the pipeline."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency: Option, + #[doc = "List of tags that can be used for describing the Pipeline."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, + #[doc = "Dimensions emitted by Pipeline."] + #[serde(rename = "runDimensions", default, skip_serializing_if = "Option::is_none")] + pub run_dimensions: Option, + #[doc = "The folder that this Pipeline is in. If not specified, Pipeline will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl Pipeline { + pub fn new() -> Self { + Self::default() + } +} +pub mod pipeline { + use super::*; + #[doc = "The folder that this Pipeline is in. If not specified, Pipeline will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this Pipeline is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "A list of pipeline resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PipelineListResponse { + #[doc = "List of pipelines."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl PipelineListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Pipeline reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PipelineReference { + #[doc = "Pipeline reference type."] + #[serde(rename = "type")] + pub type_: pipeline_reference::Type, + #[doc = "Reference pipeline name."] + #[serde(rename = "referenceName")] + pub reference_name: String, + #[doc = "Reference name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl PipelineReference { + pub fn new(type_: pipeline_reference::Type, reference_name: String) -> Self { + Self { + type_, + reference_name, + name: None, + } + } +} +pub mod pipeline_reference { + use super::*; + #[doc = "Pipeline reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + PipelineReference, + } +} +#[doc = "Pipeline resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PipelineResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "A workspace pipeline."] + pub properties: Pipeline, +} +impl PipelineResource { + pub fn new(properties: Pipeline) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Information about a pipeline run."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PipelineRun { + #[doc = "Identifier of a run."] + #[serde(rename = "runId", default, skip_serializing_if = "Option::is_none")] + pub run_id: Option, + #[doc = "Identifier that correlates all the recovery runs of a pipeline run."] + #[serde(rename = "runGroupId", default, skip_serializing_if = "Option::is_none")] + pub run_group_id: Option, + #[doc = "Indicates if the recovered pipeline run is the latest in its group."] + #[serde(rename = "isLatest", default, skip_serializing_if = "Option::is_none")] + pub is_latest: Option, + #[doc = "The pipeline name."] + #[serde(rename = "pipelineName", default, skip_serializing_if = "Option::is_none")] + pub pipeline_name: Option, + #[doc = "The full or partial list of parameter name, value pair used in the pipeline run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, + #[doc = "Provides entity name and id that started the pipeline run."] + #[serde(rename = "invokedBy", default, skip_serializing_if = "Option::is_none")] + pub invoked_by: Option, + #[doc = "The last updated timestamp for the pipeline run event in ISO8601 format."] + #[serde(rename = "lastUpdated", default, skip_serializing_if = "Option::is_none")] + pub last_updated: Option, + #[doc = "The start time of a pipeline run in ISO8601 format."] + #[serde(rename = "runStart", default, skip_serializing_if = "Option::is_none")] + pub run_start: Option, + #[doc = "The end time of a pipeline run in ISO8601 format."] + #[serde(rename = "runEnd", default, skip_serializing_if = "Option::is_none")] + pub run_end: Option, + #[doc = "The duration of a pipeline run."] + #[serde(rename = "durationInMs", default, skip_serializing_if = "Option::is_none")] + pub duration_in_ms: Option, + #[doc = "The status of a pipeline run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The message from a pipeline run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +impl PipelineRun { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Provides entity name and id that started the pipeline run."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PipelineRunInvokedBy { + #[doc = "Name of the entity that started the pipeline run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The ID of the entity that started the run."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The type of the entity that started the run."] + #[serde(rename = "invokedByType", default, skip_serializing_if = "Option::is_none")] + pub invoked_by_type: Option, +} +impl PipelineRunInvokedBy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list pipeline runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PipelineRunsQueryResponse { + #[doc = "List of pipeline runs."] + pub value: Vec, + #[doc = "The continuation token for getting the next page of results, if any remaining results exist, null otherwise."] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, +} +impl PipelineRunsQueryResponse { + pub fn new(value: Vec) -> Self { + Self { + value, + continuation_token: None, + } + } +} +#[doc = "PolyBase settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PolybaseSettings { + #[doc = "Indicates whether the RejectValue property is specified as a literal value or a percentage."] + #[serde(rename = "rejectType", default, skip_serializing_if = "Option::is_none")] + pub reject_type: Option, + #[doc = "Specifies the value or the percentage of rows that can be rejected before the query fails. Type: number (or Expression with resultType number), minimum: 0."] + #[serde(rename = "rejectValue", default, skip_serializing_if = "Option::is_none")] + pub reject_value: Option, + #[doc = "Determines the number of rows to attempt to retrieve before the PolyBase recalculates the percentage of rejected rows. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(rename = "rejectSampleValue", default, skip_serializing_if = "Option::is_none")] + pub reject_sample_value: Option, + #[doc = "Specifies how to handle missing values in delimited text files when PolyBase retrieves data from the text file. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useTypeDefault", default, skip_serializing_if = "Option::is_none")] + pub use_type_default: Option, +} +impl PolybaseSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Indicates whether the RejectValue property is specified as a literal value or a percentage."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PolybaseSettingsRejectType { + #[serde(rename = "value")] + Value, + #[serde(rename = "percentage")] + Percentage, +} +#[doc = "Linked service for PostgreSQL data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PostgreSqlLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "PostgreSQL linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: PostgreSqlLinkedServiceTypeProperties, +} +impl PostgreSqlLinkedService { + pub fn new(linked_service: LinkedService, type_properties: PostgreSqlLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "PostgreSQL linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PostgreSqlLinkedServiceTypeProperties { + #[doc = "The connection string."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl PostgreSqlLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for PostgreSQL databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PostgreSqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl PostgreSqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The PostgreSQL table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PostgreSqlTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "PostgreSQL table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl PostgreSqlTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "PostgreSQL table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PostgreSqlTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The PostgreSQL table name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The PostgreSQL schema name. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl PostgreSqlTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Presto Dataset Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrestoDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Presto. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Presto. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl PrestoDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Presto server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrestoLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Presto server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: PrestoLinkedServiceTypeProperties, +} +impl PrestoLinkedService { + pub fn new(linked_service: LinkedService, type_properties: PrestoLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Presto server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrestoLinkedServiceTypeProperties { + #[doc = "The IP address or host name of the Presto server. (i.e. 192.168.222.160)"] + pub host: serde_json::Value, + #[doc = "The version of the Presto server. (i.e. 0.148-t)"] + #[serde(rename = "serverVersion")] + pub server_version: serde_json::Value, + #[doc = "The catalog context for all request against the server."] + pub catalog: serde_json::Value, + #[doc = "The TCP port that the Presto server uses to listen for client connections. The default value is 8080."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The authentication mechanism used to connect to the Presto server."] + #[serde(rename = "authenticationType")] + pub authentication_type: presto_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used to connect to the Presto server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The local time zone used by the connection. Valid values for this option are specified in the IANA Time Zone Database. The default value is the system time zone."] + #[serde(rename = "timeZoneID", default, skip_serializing_if = "Option::is_none")] + pub time_zone_id: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl PrestoLinkedServiceTypeProperties { + pub fn new( + host: serde_json::Value, + server_version: serde_json::Value, + catalog: serde_json::Value, + authentication_type: presto_linked_service_type_properties::AuthenticationType, + ) -> Self { + Self { + host, + server_version, + catalog, + port: None, + authentication_type, + username: None, + password: None, + enable_ssl: None, + trusted_cert_path: None, + use_system_trust_store: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + time_zone_id: None, + encrypted_credential: None, + } + } +} +pub mod presto_linked_service_type_properties { + use super::*; + #[doc = "The authentication mechanism used to connect to the Presto server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + #[serde(rename = "LDAP")] + Ldap, + } +} +#[doc = "Presto server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrestoObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Presto Dataset Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl PrestoObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Presto server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrestoSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl PrestoSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Private endpoint details"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpoint { + #[doc = "Resource id of the private endpoint."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +impl PrivateEndpoint { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A private endpoint connection"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[doc = "Properties of a private endpoint connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl PrivateEndpointConnection { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Properties of a private endpoint connection."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateEndpointConnectionProperties { + #[doc = "Private endpoint details"] + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[doc = "Connection state details of the private endpoint"] + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[doc = "Provisioning state of the private endpoint connection."] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +impl PrivateEndpointConnectionProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Connection state details of the private endpoint"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PrivateLinkServiceConnectionState { + #[doc = "The private link service connection status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The private link service connection description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The actions required for private link service connection."] + #[serde(rename = "actionsRequired", default, skip_serializing_if = "Option::is_none")] + pub actions_required: Option, +} +impl PrivateLinkServiceConnectionState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +impl ProxyResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Purview Configuration"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct PurviewConfiguration { + #[doc = "Purview Resource ID"] + #[serde(rename = "purviewResourceId", default, skip_serializing_if = "Option::is_none")] + pub purview_resource_id: Option, +} +impl PurviewConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A list of active debug sessions."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryDataFlowDebugSessionsResponse { + #[doc = "Array with all active debug sessions."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl QueryDataFlowDebugSessionsResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct QueryTableStatusRequest { + #[doc = "Max segment count to query table status"] + #[serde(rename = "maxSegmentCount", default, skip_serializing_if = "Option::is_none")] + pub max_segment_count: Option, + #[doc = "Continuation token to query table status"] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, +} +impl QueryTableStatusRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "QuickBooks server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickBooksLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "QuickBooks server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: QuickBooksLinkedServiceTypeProperties, +} +impl QuickBooksLinkedService { + pub fn new(linked_service: LinkedService, type_properties: QuickBooksLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "QuickBooks server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickBooksLinkedServiceTypeProperties { + #[doc = "Properties used to connect to QuickBooks. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The endpoint of the QuickBooks server. (i.e. quickbooks.api.intuit.com)"] + pub endpoint: serde_json::Value, + #[doc = "The company ID of the QuickBooks company to authorize."] + #[serde(rename = "companyId")] + pub company_id: serde_json::Value, + #[doc = "The consumer key for OAuth 1.0 authentication."] + #[serde(rename = "consumerKey")] + pub consumer_key: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "consumerSecret")] + pub consumer_secret: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken")] + pub access_token: SecretBase, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessTokenSecret")] + pub access_token_secret: SecretBase, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl QuickBooksLinkedServiceTypeProperties { + pub fn new( + endpoint: serde_json::Value, + company_id: serde_json::Value, + consumer_key: serde_json::Value, + consumer_secret: SecretBase, + access_token: SecretBase, + access_token_secret: SecretBase, + ) -> Self { + Self { + connection_properties: None, + endpoint, + company_id, + consumer_key, + consumer_secret, + access_token, + access_token_secret, + use_encrypted_endpoints: None, + encrypted_credential: None, + } + } +} +#[doc = "QuickBooks server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickBooksObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl QuickBooksObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity QuickBooks server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickBooksSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl QuickBooksSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Linked service for Quickbase."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickbaseLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Quickbase linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: QuickbaseLinkedServiceTypeProperties, +} +impl QuickbaseLinkedService { + pub fn new(linked_service: LinkedService, type_properties: QuickbaseLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Quickbase linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct QuickbaseLinkedServiceTypeProperties { + #[doc = "The url to connect Quickbase source. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "userToken")] + pub user_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl QuickbaseLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value, user_token: SecretBase) -> Self { + Self { + url, + user_token, + encrypted_credential: None, + } + } +} +#[doc = "Enumerates possible frequency option for the schedule trigger."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RecurrenceFrequency { + NotSpecified, + Minute, + Hour, + Day, + Week, + Month, + Year, +} +#[doc = "The recurrence schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceSchedule { + #[doc = "The minutes."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub minutes: Vec, + #[doc = "The hours."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hours: Vec, + #[doc = "The days of the week."] + #[serde(rename = "weekDays", default, skip_serializing_if = "Vec::is_empty")] + pub week_days: Vec, + #[doc = "The month days."] + #[serde(rename = "monthDays", default, skip_serializing_if = "Vec::is_empty")] + pub month_days: Vec, + #[doc = "The monthly occurrences."] + #[serde(rename = "monthlyOccurrences", default, skip_serializing_if = "Vec::is_empty")] + pub monthly_occurrences: Vec, +} +impl RecurrenceSchedule { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The recurrence schedule occurrence."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RecurrenceScheduleOccurrence { + #[doc = "The days of the week."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub day: Option, + #[doc = "The occurrence."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub occurrence: Option, +} +impl RecurrenceScheduleOccurrence { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Redirect incompatible row settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedirectIncompatibleRowSettings { + #[doc = "Name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: serde_json::Value, + #[doc = "The path for storing the redirect incompatible row data. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl RedirectIncompatibleRowSettings { + pub fn new(linked_service_name: serde_json::Value) -> Self { + Self { + linked_service_name, + path: None, + } + } +} +#[doc = "The Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this, data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the interim S3."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RedshiftUnloadSettings { + #[doc = "Linked service reference type."] + #[serde(rename = "s3LinkedServiceName")] + pub s3_linked_service_name: LinkedServiceReference, + #[doc = "The bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string)."] + #[serde(rename = "bucketName")] + pub bucket_name: serde_json::Value, +} +impl RedshiftUnloadSettings { + pub fn new(s3_linked_service_name: LinkedServiceReference, bucket_name: serde_json::Value) -> Self { + Self { + s3_linked_service_name, + bucket_name, + } + } +} +#[doc = "A copy activity source for various relational databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelationalSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl RelationalSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + additional_columns: None, + } + } +} +#[doc = "The relational table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RelationalTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Relational table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl RelationalTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Relational table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RelationalTableDatasetTypeProperties { + #[doc = "The relational table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl RelationalTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enumerates possible request statuses."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RequestStatus { + Running, + Completed, + Failed, +} +#[doc = "A list of rerun triggers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RerunTriggerListResponse { + #[doc = "List of rerun triggers."] + pub value: Vec, + #[doc = "The continuation token for getting the next page of results, if any remaining results exist, null otherwise."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl RerunTriggerListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "RerunTrigger resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RerunTriggerResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Trigger that schedules pipeline reruns for all fixed time interval windows from a requested start time to requested end time."] + pub properties: RerunTumblingWindowTrigger, +} +impl RerunTriggerResource { + pub fn new(properties: RerunTumblingWindowTrigger) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Trigger that schedules pipeline reruns for all fixed time interval windows from a requested start time to requested end time."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RerunTumblingWindowTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "Rerun Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: rerun_tumbling_window_trigger::TypeProperties, +} +impl RerunTumblingWindowTrigger { + pub fn new(trigger: Trigger, type_properties: rerun_tumbling_window_trigger::TypeProperties) -> Self { + Self { trigger, type_properties } + } +} +pub mod rerun_tumbling_window_trigger { + use super::*; + #[doc = "Rerun Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "The parent trigger reference."] + #[serde(rename = "parentTrigger")] + pub parent_trigger: serde_json::Value, + #[doc = "The start time for the time period for which restatement is initiated. Only UTC time is currently supported."] + #[serde(rename = "requestedStartTime")] + pub requested_start_time: String, + #[doc = "The end time for the time period for which restatement is initiated. Only UTC time is currently supported."] + #[serde(rename = "requestedEndTime")] + pub requested_end_time: String, + #[doc = "The max number of parallel time windows (ready for execution) for which a rerun is triggered."] + #[serde(rename = "rerunConcurrency")] + pub rerun_concurrency: i64, + } + impl TypeProperties { + pub fn new( + parent_trigger: serde_json::Value, + requested_start_time: String, + requested_end_time: String, + rerun_concurrency: i64, + ) -> Self { + Self { + parent_trigger, + requested_start_time, + requested_end_time, + rerun_concurrency, + } + } + } +} +#[doc = "Rerun tumbling window trigger Parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RerunTumblingWindowTriggerActionParameters { + #[doc = "The start time for the time period for which restatement is initiated. Only UTC time is currently supported."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "The end time for the time period for which restatement is initiated. Only UTC time is currently supported."] + #[serde(rename = "endTime")] + pub end_time: String, + #[doc = "The max number of parallel time windows (ready for execution) for which a rerun is triggered."] + #[serde(rename = "maxConcurrency")] + pub max_concurrency: i64, +} +impl RerunTumblingWindowTriggerActionParameters { + pub fn new(start_time: String, end_time: String, max_concurrency: i64) -> Self { + Self { + start_time, + end_time, + max_concurrency, + } + } +} +#[doc = "Common fields that are returned in the response for all Azure Resource Manager resources"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Resource { + #[doc = "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl Resource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Enumerates possible Status of the resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ResourceStatus { + Creating, + Created, + Failed, +} +#[doc = "Responsys linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponsysLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Responsys linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ResponsysLinkedServiceTypeProperties, +} +impl ResponsysLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ResponsysLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Responsys linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponsysLinkedServiceTypeProperties { + #[doc = "The endpoint of the Responsys server."] + pub endpoint: serde_json::Value, + #[doc = "The client ID associated with the Responsys application. Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ResponsysLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value, client_id: serde_json::Value) -> Self { + Self { + endpoint, + client_id, + client_secret: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Responsys dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponsysObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ResponsysObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Responsys source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResponsysSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ResponsysSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "A Rest service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl RestResourceDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Properties specific to this dataset type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RestResourceDatasetTypeProperties { + #[doc = "The relative URL to the resource that the RESTful API provides. Type: string (or Expression with resultType string)."] + #[serde(rename = "relativeUrl", default, skip_serializing_if = "Option::is_none")] + pub relative_url: Option, + #[doc = "The HTTP method used to call the RESTful API. The default is GET. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestMethod", default, skip_serializing_if = "Option::is_none")] + pub request_method: Option, + #[doc = "The HTTP request body to the RESTful API if requestMethod is POST. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestBody", default, skip_serializing_if = "Option::is_none")] + pub request_body: Option, + #[doc = "The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType string)."] + #[serde(rename = "additionalHeaders", default, skip_serializing_if = "Option::is_none")] + pub additional_headers: Option, + #[doc = "The pagination rules to compose next page requests. Type: string (or Expression with resultType string)."] + #[serde(rename = "paginationRules", default, skip_serializing_if = "Option::is_none")] + pub pagination_rules: Option, +} +impl RestResourceDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Rest Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestServiceLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Rest Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: RestServiceLinkedServiceTypeProperties, +} +impl RestServiceLinkedService { + pub fn new(linked_service: LinkedService, type_properties: RestServiceLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Rest Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestServiceLinkedServiceTypeProperties { + #[doc = "The base URL of the REST service."] + pub url: serde_json::Value, + #[doc = "Whether to validate server side SSL certificate when connecting to the endpoint.The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableServerCertificateValidation", default, skip_serializing_if = "Option::is_none")] + pub enable_server_certificate_validation: Option, + #[doc = "Type of authentication used to connect to the REST service."] + #[serde(rename = "authenticationType")] + pub authentication_type: rest_service_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used in Basic authentication type."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The application's client ID used in AadServicePrincipal authentication type."] + #[serde(rename = "servicePrincipalId", default, skip_serializing_if = "Option::is_none")] + pub service_principal_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey", default, skip_serializing_if = "Option::is_none")] + pub service_principal_key: Option, + #[doc = "The tenant information (domain name or tenant ID) used in AadServicePrincipal authentication type under which your application resides."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tenant: Option, + #[doc = "Indicates the azure cloud type of the service principle auth. Allowed values are AzurePublic, AzureChina, AzureUsGovernment, AzureGermany. Default value is the data factory regions’ cloud type. Type: string (or Expression with resultType string)."] + #[serde(rename = "azureCloudType", default, skip_serializing_if = "Option::is_none")] + pub azure_cloud_type: Option, + #[doc = "The resource you are requesting authorization to use."] + #[serde(rename = "aadResourceId", default, skip_serializing_if = "Option::is_none")] + pub aad_resource_id: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl RestServiceLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value, authentication_type: rest_service_linked_service_type_properties::AuthenticationType) -> Self { + Self { + url, + enable_server_certificate_validation: None, + authentication_type, + user_name: None, + password: None, + service_principal_id: None, + service_principal_key: None, + tenant: None, + azure_cloud_type: None, + aad_resource_id: None, + encrypted_credential: None, + } + } +} +pub mod rest_service_linked_service_type_properties { + use super::*; + #[doc = "Type of authentication used to connect to the REST service."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + Basic, + AadServicePrincipal, + ManagedServiceIdentity, + } +} +#[doc = "A copy activity Rest service Sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The HTTP method used to call the RESTful API. The default is POST. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestMethod", default, skip_serializing_if = "Option::is_none")] + pub request_method: Option, + #[doc = "The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType string)."] + #[serde(rename = "additionalHeaders", default, skip_serializing_if = "Option::is_none")] + pub additional_headers: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:01:40. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, + #[doc = "The time to await before sending next request, in milliseconds "] + #[serde(rename = "requestInterval", default, skip_serializing_if = "Option::is_none")] + pub request_interval: Option, + #[doc = "Http Compression Type to Send data in compressed format with Optimal Compression Level, Default is None. And The Only Supported option is Gzip. "] + #[serde(rename = "httpCompressionType", default, skip_serializing_if = "Option::is_none")] + pub http_compression_type: Option, +} +impl RestSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + request_method: None, + additional_headers: None, + http_request_timeout: None, + request_interval: None, + http_compression_type: None, + } + } +} +#[doc = "A copy activity Rest service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RestSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "The HTTP method used to call the RESTful API. The default is GET. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestMethod", default, skip_serializing_if = "Option::is_none")] + pub request_method: Option, + #[doc = "The HTTP request body to the RESTful API if requestMethod is POST. Type: string (or Expression with resultType string)."] + #[serde(rename = "requestBody", default, skip_serializing_if = "Option::is_none")] + pub request_body: Option, + #[doc = "The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType string)."] + #[serde(rename = "additionalHeaders", default, skip_serializing_if = "Option::is_none")] + pub additional_headers: Option, + #[doc = "The pagination rules to compose next page requests. Type: string (or Expression with resultType string)."] + #[serde(rename = "paginationRules", default, skip_serializing_if = "Option::is_none")] + pub pagination_rules: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:01:40. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, + #[doc = "The time to await before sending next page request. "] + #[serde(rename = "requestInterval", default, skip_serializing_if = "Option::is_none")] + pub request_interval: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl RestSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + request_method: None, + request_body: None, + additional_headers: None, + pagination_rules: None, + http_request_timeout: None, + request_interval: None, + additional_columns: None, + } + } +} +#[doc = "Execution policy for an activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct RetryPolicy { + #[doc = "Maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[doc = "Interval between retries in seconds. Default is 30."] + #[serde(rename = "intervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub interval_in_seconds: Option, +} +impl RetryPolicy { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Query parameters for listing runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunFilterParameters { + #[doc = "The continuation token for getting the next page of results. Null for first page."] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, + #[doc = "The time at or after which the run event was updated in 'ISO 8601' format."] + #[serde(rename = "lastUpdatedAfter")] + pub last_updated_after: String, + #[doc = "The time at or before which the run event was updated in 'ISO 8601' format."] + #[serde(rename = "lastUpdatedBefore")] + pub last_updated_before: String, + #[doc = "List of filters."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub filters: Vec, + #[doc = "List of OrderBy option."] + #[serde(rename = "orderBy", default, skip_serializing_if = "Vec::is_empty")] + pub order_by: Vec, +} +impl RunFilterParameters { + pub fn new(last_updated_after: String, last_updated_before: String) -> Self { + Self { + continuation_token: None, + last_updated_after, + last_updated_before, + filters: Vec::new(), + order_by: Vec::new(), + } + } +} +#[doc = "Query filter option for listing runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunQueryFilter { + #[doc = "Parameter name to be used for filter. The allowed operands to query pipeline runs are PipelineName, RunStart, RunEnd and Status; to query activity runs are ActivityName, ActivityRunStart, ActivityRunEnd, ActivityType and Status, and to query trigger runs are TriggerName, TriggerRunTimestamp and Status."] + pub operand: run_query_filter::Operand, + #[doc = "Operator to be used for filter."] + pub operator: run_query_filter::Operator, + #[doc = "List of filter values."] + pub values: Vec, +} +impl RunQueryFilter { + pub fn new(operand: run_query_filter::Operand, operator: run_query_filter::Operator, values: Vec) -> Self { + Self { operand, operator, values } + } +} +pub mod run_query_filter { + use super::*; + #[doc = "Parameter name to be used for filter. The allowed operands to query pipeline runs are PipelineName, RunStart, RunEnd and Status; to query activity runs are ActivityName, ActivityRunStart, ActivityRunEnd, ActivityType and Status, and to query trigger runs are TriggerName, TriggerRunTimestamp and Status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operand { + PipelineName, + Status, + RunStart, + RunEnd, + ActivityName, + ActivityRunStart, + ActivityRunEnd, + ActivityType, + TriggerName, + TriggerRunTimestamp, + RunGroupId, + LatestOnly, + } + #[doc = "Operator to be used for filter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Operator { + Equals, + NotEquals, + In, + NotIn, + } +} +#[doc = "An object to provide order by options for listing runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RunQueryOrderBy { + #[doc = "Parameter name to be used for order by. The allowed parameters to order by for pipeline runs are PipelineName, RunStart, RunEnd and Status; for activity runs are ActivityName, ActivityRunStart, ActivityRunEnd and Status; for trigger runs are TriggerName, TriggerRunTimestamp and Status."] + #[serde(rename = "orderBy")] + pub order_by: run_query_order_by::OrderBy, + #[doc = "Sorting order of the parameter."] + pub order: run_query_order_by::Order, +} +impl RunQueryOrderBy { + pub fn new(order_by: run_query_order_by::OrderBy, order: run_query_order_by::Order) -> Self { + Self { order_by, order } + } +} +pub mod run_query_order_by { + use super::*; + #[doc = "Parameter name to be used for order by. The allowed parameters to order by for pipeline runs are PipelineName, RunStart, RunEnd and Status; for activity runs are ActivityName, ActivityRunStart, ActivityRunEnd and Status; for trigger runs are TriggerName, TriggerRunTimestamp and Status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum OrderBy { + RunStart, + RunEnd, + PipelineName, + Status, + ActivityName, + ActivityRunStart, + ActivityRunEnd, + TriggerName, + TriggerRunTimestamp, + } + #[doc = "Sorting order of the parameter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Order { + #[serde(rename = "ASC")] + Asc, + #[serde(rename = "DESC")] + Desc, + } +} +#[doc = "SSIS access credential."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisAccessCredential { + #[doc = "Domain for windows authentication."] + pub domain: serde_json::Value, + #[doc = "UseName for windows authentication."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl SsisAccessCredential { + pub fn new(domain: serde_json::Value, user_name: serde_json::Value, password: SecretBase) -> Self { + Self { + domain, + user_name, + password, + } + } +} +#[doc = "SSIS embedded child package."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisChildPackage { + #[doc = "Path for embedded child package. Type: string (or Expression with resultType string)."] + #[serde(rename = "packagePath")] + pub package_path: serde_json::Value, + #[doc = "Name for embedded child package."] + #[serde(rename = "packageName", default, skip_serializing_if = "Option::is_none")] + pub package_name: Option, + #[doc = "Content for embedded child package. Type: string (or Expression with resultType string)."] + #[serde(rename = "packageContent")] + pub package_content: serde_json::Value, + #[doc = "Last modified date for embedded child package."] + #[serde(rename = "packageLastModifiedDate", default, skip_serializing_if = "Option::is_none")] + pub package_last_modified_date: Option, +} +impl SsisChildPackage { + pub fn new(package_path: serde_json::Value, package_content: serde_json::Value) -> Self { + Self { + package_path, + package_name: None, + package_content, + package_last_modified_date: None, + } + } +} +#[doc = "SSIS Connection Manager."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SsisConnectionManager {} +impl SsisConnectionManager { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SSIS package execution credential."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisExecutionCredential { + #[doc = "Domain for windows authentication."] + pub domain: serde_json::Value, + #[doc = "UseName for windows authentication."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls."] + pub password: SecureString, +} +impl SsisExecutionCredential { + pub fn new(domain: serde_json::Value, user_name: serde_json::Value, password: SecureString) -> Self { + Self { + domain, + user_name, + password, + } + } +} +#[doc = "SSIS execution parameter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisExecutionParameter { + #[doc = "SSIS package execution parameter value. Type: string (or Expression with resultType string)."] + pub value: serde_json::Value, +} +impl SsisExecutionParameter { + pub fn new(value: serde_json::Value) -> Self { + Self { value } + } +} +#[doc = "SSIS package execution log location"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisLogLocation { + #[doc = "The SSIS package execution log path. Type: string (or Expression with resultType string)."] + #[serde(rename = "logPath")] + pub log_path: serde_json::Value, + #[doc = "The type of SSIS log location."] + #[serde(rename = "type")] + pub type_: ssis_log_location::Type, + #[doc = "SSIS package execution log location properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SsisLogLocationTypeProperties, +} +impl SsisLogLocation { + pub fn new(log_path: serde_json::Value, type_: ssis_log_location::Type, type_properties: SsisLogLocationTypeProperties) -> Self { + Self { + log_path, + type_, + type_properties, + } + } +} +pub mod ssis_log_location { + use super::*; + #[doc = "The type of SSIS log location."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + File, + } +} +#[doc = "SSIS package execution log location properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SsisLogLocationTypeProperties { + #[doc = "SSIS access credential."] + #[serde(rename = "accessCredential", default, skip_serializing_if = "Option::is_none")] + pub access_credential: Option, + #[doc = "Specifies the interval to refresh log. The default interval is 5 minutes. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "logRefreshInterval", default, skip_serializing_if = "Option::is_none")] + pub log_refresh_interval: Option, +} +impl SsisLogLocationTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SSIS package location."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SsisPackageLocation { + #[doc = "The SSIS package path. Type: string (or Expression with resultType string)."] + #[serde(rename = "packagePath", default, skip_serializing_if = "Option::is_none")] + pub package_path: Option, + #[doc = "The type of SSIS package location."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "SSIS package location properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SsisPackageLocation { + pub fn new() -> Self { + Self::default() + } +} +pub mod ssis_package_location { + use super::*; + #[doc = "The type of SSIS package location."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + #[serde(rename = "SSISDB")] + Ssisdb, + File, + InlinePackage, + PackageStore, + } +} +#[doc = "SSIS package location properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SsisPackageLocationTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "packagePassword", default, skip_serializing_if = "Option::is_none")] + pub package_password: Option, + #[doc = "SSIS access credential."] + #[serde(rename = "accessCredential", default, skip_serializing_if = "Option::is_none")] + pub access_credential: Option, + #[doc = "The configuration file of the package execution. Type: string (or Expression with resultType string)."] + #[serde(rename = "configurationPath", default, skip_serializing_if = "Option::is_none")] + pub configuration_path: Option, + #[doc = "SSIS access credential."] + #[serde(rename = "configurationAccessCredential", default, skip_serializing_if = "Option::is_none")] + pub configuration_access_credential: Option, + #[doc = "The package name."] + #[serde(rename = "packageName", default, skip_serializing_if = "Option::is_none")] + pub package_name: Option, + #[doc = "The embedded package content. Type: string (or Expression with resultType string)."] + #[serde(rename = "packageContent", default, skip_serializing_if = "Option::is_none")] + pub package_content: Option, + #[doc = "The embedded package last modified date."] + #[serde(rename = "packageLastModifiedDate", default, skip_serializing_if = "Option::is_none")] + pub package_last_modified_date: Option, + #[doc = "The embedded child package list."] + #[serde(rename = "childPackages", default, skip_serializing_if = "Vec::is_empty")] + pub child_packages: Vec, +} +impl SsisPackageLocationTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SSIS property override."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SsisPropertyOverride { + #[doc = "SSIS package property override value. Type: string (or Expression with resultType string)."] + pub value: serde_json::Value, + #[doc = "Whether SSIS package property override value is sensitive data. Value will be encrypted in SSISDB if it is true"] + #[serde(rename = "isSensitive", default, skip_serializing_if = "Option::is_none")] + pub is_sensitive: Option, +} +impl SsisPropertyOverride { + pub fn new(value: serde_json::Value) -> Self { + Self { value, is_sensitive: None } + } +} +#[doc = "Linked service for Salesforce."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Salesforce linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SalesforceLinkedServiceTypeProperties, +} +impl SalesforceLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SalesforceLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Salesforce linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SalesforceLinkedServiceTypeProperties { + #[doc = "The URL of Salesforce instance. Default is 'https://login.salesforce.com'. To copy data from sandbox, specify 'https://test.salesforce.com'. To copy data from custom domain, specify, for example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string)."] + #[serde(rename = "environmentUrl", default, skip_serializing_if = "Option::is_none")] + pub environment_url: Option, + #[doc = "The username for Basic authentication of the Salesforce instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "securityToken", default, skip_serializing_if = "Option::is_none")] + pub security_token: Option, + #[doc = "The Salesforce API version used in ADF. Type: string (or Expression with resultType string)."] + #[serde(rename = "apiVersion", default, skip_serializing_if = "Option::is_none")] + pub api_version: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SalesforceLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Salesforce Marketing Cloud linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceMarketingCloudLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Salesforce Marketing Cloud linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SalesforceMarketingCloudLinkedServiceTypeProperties, +} +impl SalesforceMarketingCloudLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SalesforceMarketingCloudLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Salesforce Marketing Cloud linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceMarketingCloudLinkedServiceTypeProperties { + #[doc = "Properties used to connect to Salesforce Marketing Cloud. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The client ID associated with the Salesforce Marketing Cloud application. Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SalesforceMarketingCloudLinkedServiceTypeProperties { + pub fn new(client_id: serde_json::Value) -> Self { + Self { + connection_properties: None, + client_id, + client_secret: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Salesforce Marketing Cloud dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceMarketingCloudObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SalesforceMarketingCloudObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Salesforce Marketing Cloud source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceMarketingCloudSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SalesforceMarketingCloudSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The Salesforce object dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Salesforce object dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SalesforceObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Salesforce object dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SalesforceObjectDatasetTypeProperties { + #[doc = "The Salesforce object API name. Type: string (or Expression with resultType string)."] + #[serde(rename = "objectApiName", default, skip_serializing_if = "Option::is_none")] + pub object_api_name: Option, +} +impl SalesforceObjectDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for Salesforce Service Cloud."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceServiceCloudLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Salesforce Service Cloud linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SalesforceServiceCloudLinkedServiceTypeProperties, +} +impl SalesforceServiceCloudLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SalesforceServiceCloudLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Salesforce Service Cloud linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SalesforceServiceCloudLinkedServiceTypeProperties { + #[doc = "The URL of Salesforce Service Cloud instance. Default is 'https://login.salesforce.com'. To copy data from sandbox, specify 'https://test.salesforce.com'. To copy data from custom domain, specify, for example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string)."] + #[serde(rename = "environmentUrl", default, skip_serializing_if = "Option::is_none")] + pub environment_url: Option, + #[doc = "The username for Basic authentication of the Salesforce instance. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "securityToken", default, skip_serializing_if = "Option::is_none")] + pub security_token: Option, + #[doc = "The Salesforce API version used in ADF. Type: string (or Expression with resultType string)."] + #[serde(rename = "apiVersion", default, skip_serializing_if = "Option::is_none")] + pub api_version: Option, + #[doc = "Extended properties appended to the connection string. Type: string (or Expression with resultType string)."] + #[serde(rename = "extendedProperties", default, skip_serializing_if = "Option::is_none")] + pub extended_properties: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SalesforceServiceCloudLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The Salesforce Service Cloud object dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceServiceCloudObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Salesforce Service Cloud object dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SalesforceServiceCloudObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Salesforce Service Cloud object dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SalesforceServiceCloudObjectDatasetTypeProperties { + #[doc = "The Salesforce Service Cloud object API name. Type: string (or Expression with resultType string)."] + #[serde(rename = "objectApiName", default, skip_serializing_if = "Option::is_none")] + pub object_api_name: Option, +} +impl SalesforceServiceCloudObjectDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Salesforce Service Cloud sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceServiceCloudSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The write behavior for the operation. Default is Insert."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, + #[doc = "The name of the external ID field for upsert operation. Default value is 'Id' column. Type: string (or Expression with resultType string)."] + #[serde(rename = "externalIdFieldName", default, skip_serializing_if = "Option::is_none")] + pub external_id_field_name: Option, + #[doc = "The flag indicating whether or not to ignore null values from input dataset (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave the data in the destination object unchanged when doing upsert/update operation and insert defined default value when doing insert operation, versus ADF will update the data in the destination object to NULL when doing upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "ignoreNullValues", default, skip_serializing_if = "Option::is_none")] + pub ignore_null_values: Option, +} +impl SalesforceServiceCloudSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + external_id_field_name: None, + ignore_null_values: None, + } + } +} +pub mod salesforce_service_cloud_sink { + use super::*; + #[doc = "The write behavior for the operation. Default is Insert."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WriteBehavior { + Insert, + Upsert, + } +} +#[doc = "A copy activity Salesforce Service Cloud source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceServiceCloudSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The read behavior for the operation. Default is Query."] + #[serde(rename = "readBehavior", default, skip_serializing_if = "Option::is_none")] + pub read_behavior: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl SalesforceServiceCloudSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + read_behavior: None, + additional_columns: None, + } + } +} +pub mod salesforce_service_cloud_source { + use super::*; + #[doc = "The read behavior for the operation. Default is Query."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReadBehavior { + Query, + QueryAll, + } +} +#[doc = "A copy activity Salesforce sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The write behavior for the operation. Default is Insert."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, + #[doc = "The name of the external ID field for upsert operation. Default value is 'Id' column. Type: string (or Expression with resultType string)."] + #[serde(rename = "externalIdFieldName", default, skip_serializing_if = "Option::is_none")] + pub external_id_field_name: Option, + #[doc = "The flag indicating whether or not to ignore null values from input dataset (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave the data in the destination object unchanged when doing upsert/update operation and insert defined default value when doing insert operation, versus ADF will update the data in the destination object to NULL when doing upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "ignoreNullValues", default, skip_serializing_if = "Option::is_none")] + pub ignore_null_values: Option, +} +impl SalesforceSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + external_id_field_name: None, + ignore_null_values: None, + } + } +} +pub mod salesforce_sink { + use super::*; + #[doc = "The write behavior for the operation. Default is Insert."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WriteBehavior { + Insert, + Upsert, + } +} +#[doc = "A copy activity Salesforce source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SalesforceSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The read behavior for the operation. Default is Query."] + #[serde(rename = "readBehavior", default, skip_serializing_if = "Option::is_none")] + pub read_behavior: Option, +} +impl SalesforceSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + read_behavior: None, + } + } +} +pub mod salesforce_source { + use super::*; + #[doc = "The read behavior for the operation. Default is Query."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ReadBehavior { + Query, + QueryAll, + } +} +#[doc = "SAP Business Warehouse Linked Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapBwLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: SapBwLinkedServiceTypeProperties, +} +impl SapBwLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapBwLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapBwLinkedServiceTypeProperties { + #[doc = "Host name of the SAP BW instance. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "System number of the BW system. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string)."] + #[serde(rename = "systemNumber")] + pub system_number: serde_json::Value, + #[doc = "Client ID of the client on the BW system. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "Username to access the SAP BW server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapBwLinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, system_number: serde_json::Value, client_id: serde_json::Value) -> Self { + Self { + server, + system_number, + client_id, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "The SAP BW cube dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapBwCubeDataset { + #[serde(flatten)] + pub dataset: Dataset, +} +impl SapBwCubeDataset { + pub fn new(dataset: Dataset) -> Self { + Self { dataset } + } +} +#[doc = "A copy activity source for SapBW server via MDX."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapBwSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "MDX query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SapBwSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Linked service for SAP Cloud for Customer."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "SAP Cloud for Customer linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapCloudForCustomerLinkedServiceTypeProperties, +} +impl SapCloudForCustomerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapCloudForCustomerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "SAP Cloud for Customer linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerLinkedServiceTypeProperties { + #[doc = "The URL of SAP Cloud for Customer OData API. For example, '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The username for Basic authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapCloudForCustomerLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value) -> Self { + Self { + url, + username: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "The path of the SAP Cloud for Customer OData entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Sap Cloud For Customer OData resource dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapCloudForCustomerResourceDatasetTypeProperties, +} +impl SapCloudForCustomerResourceDataset { + pub fn new(dataset: Dataset, type_properties: SapCloudForCustomerResourceDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Sap Cloud For Customer OData resource dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerResourceDatasetTypeProperties { + #[doc = "The path of the SAP Cloud for Customer OData entity. Type: string (or Expression with resultType string)."] + pub path: serde_json::Value, +} +impl SapCloudForCustomerResourceDatasetTypeProperties { + pub fn new(path: serde_json::Value) -> Self { + Self { path } + } +} +#[doc = "A copy activity SAP Cloud for Customer sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "The write behavior for the operation. Default is 'Insert'."] + #[serde(rename = "writeBehavior", default, skip_serializing_if = "Option::is_none")] + pub write_behavior: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:05:00. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl SapCloudForCustomerSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + write_behavior: None, + http_request_timeout: None, + } + } +} +pub mod sap_cloud_for_customer_sink { + use super::*; + #[doc = "The write behavior for the operation. Default is 'Insert'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum WriteBehavior { + Insert, + Update, + } +} +#[doc = "A copy activity source for SAP Cloud for Customer source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapCloudForCustomerSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SAP Cloud for Customer OData query. For example, \"$top=1\". Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:05:00. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl SapCloudForCustomerSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + http_request_timeout: None, + } + } +} +#[doc = "Linked service for SAP ERP Central Component(SAP ECC)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "SAP ECC linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapEccLinkedServiceTypeProperties, +} +impl SapEccLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapEccLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "SAP ECC linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccLinkedServiceTypeProperties { + #[doc = "The URL of SAP ECC OData API. For example, '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string (or Expression with resultType string)."] + pub url: String, + #[doc = "The username for Basic authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapEccLinkedServiceTypeProperties { + pub fn new(url: String) -> Self { + Self { + url, + username: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "The path of the SAP ECC OData entity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Sap ECC OData resource dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapEccResourceDatasetTypeProperties, +} +impl SapEccResourceDataset { + pub fn new(dataset: Dataset, type_properties: SapEccResourceDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Sap ECC OData resource dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccResourceDatasetTypeProperties { + #[doc = "The path of the SAP ECC OData entity. Type: string (or Expression with resultType string)."] + pub path: serde_json::Value, +} +impl SapEccResourceDatasetTypeProperties { + pub fn new(path: serde_json::Value) -> Self { + Self { path } + } +} +#[doc = "A copy activity source for SAP ECC source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapEccSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SAP ECC OData query. For example, \"$top=1\". Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The timeout (TimeSpan) to get an HTTP response. It is the timeout to get a response, not the timeout to read response data. Default value: 00:05:00. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl SapEccSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + http_request_timeout: None, + } + } +} +#[doc = "SAP HANA Linked Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapHanaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: SapHanaLinkedServiceProperties, +} +impl SapHanaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapHanaLinkedServiceProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapHanaLinkedServiceProperties { + #[doc = "SAP HANA ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Host name of the SAP HANA server. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "The authentication type to be used to connect to the SAP HANA server."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "Username to access the SAP HANA server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapHanaLinkedServiceProperties { + pub fn new(server: serde_json::Value) -> Self { + Self { + connection_string: None, + server, + authentication_type: None, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +pub mod sap_hana_linked_service_properties { + use super::*; + #[doc = "The authentication type to be used to connect to the SAP HANA server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Windows, + } +} +#[doc = "The partition mechanism that will be used for SAP HANA read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SapHanaPartitionOption { + None, + PhysicalPartitionsOfTable, + SapHanaDynamicRange, +} +#[doc = "The settings that will be leveraged for SAP HANA source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapHanaPartitionSettings { + #[doc = "The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, +} +impl SapHanaPartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity source for SAP HANA source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapHanaSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SAP HANA Sql query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The packet size of data read from SAP HANA. Type: integer(or Expression with resultType integer)."] + #[serde(rename = "packetSize", default, skip_serializing_if = "Option::is_none")] + pub packet_size: Option, + #[doc = "The partition mechanism that will be used for SAP HANA read in parallel."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for SAP HANA source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SapHanaSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + packet_size: None, + partition_option: None, + partition_settings: None, + } + } +} +pub mod sap_hana_source { + use super::*; + #[doc = "The partition mechanism that will be used for SAP HANA read in parallel."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PartitionOption { + None, + PhysicalPartitionsOfTable, + SapHanaDynamicRange, + } +} +#[doc = "SAP HANA Table properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapHanaTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "SAP HANA Table properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SapHanaTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "SAP HANA Table properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapHanaTableDatasetTypeProperties { + #[doc = "The schema name of SAP HANA. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of SAP HANA. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl SapHanaTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SAP Business Warehouse Open Hub Destination Linked Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapOpenHubLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to SAP Business Warehouse Open Hub Destination linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: SapOpenHubLinkedServiceTypeProperties, +} +impl SapOpenHubLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapOpenHubLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to SAP Business Warehouse Open Hub Destination linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapOpenHubLinkedServiceTypeProperties { + #[doc = "Host name of the SAP BW instance where the open hub destination is located. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "System number of the BW system where the open hub destination is located. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string)."] + #[serde(rename = "systemNumber")] + pub system_number: serde_json::Value, + #[doc = "Client ID of the client on the BW system where the open hub destination is located. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "Language of the BW system where the open hub destination is located. The default value is EN. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + #[doc = "SystemID of the SAP system where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "systemId", default, skip_serializing_if = "Option::is_none")] + pub system_id: Option, + #[doc = "Username to access the SAP BW server where the open hub destination is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The hostname of the SAP Message Server. Type: string (or Expression with resultType string)."] + #[serde(rename = "messageServer", default, skip_serializing_if = "Option::is_none")] + pub message_server: Option, + #[doc = "The service name or port number of the Message Server. Type: string (or Expression with resultType string)."] + #[serde(rename = "messageServerService", default, skip_serializing_if = "Option::is_none")] + pub message_server_service: Option, + #[doc = "The Logon Group for the SAP System. Type: string (or Expression with resultType string)."] + #[serde(rename = "logonGroup", default, skip_serializing_if = "Option::is_none")] + pub logon_group: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapOpenHubLinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, system_number: serde_json::Value, client_id: serde_json::Value) -> Self { + Self { + server, + system_number, + client_id, + language: None, + system_id: None, + user_name: None, + password: None, + message_server: None, + message_server_service: None, + logon_group: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity source for SAP Business Warehouse Open Hub Destination source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapOpenHubSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Whether to exclude the records of the last request. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "excludeLastRequest", default, skip_serializing_if = "Option::is_none")] + pub exclude_last_request: Option, + #[doc = "The ID of request for delta loading. Once it is set, only data with requestId larger than the value of this property will be retrieved. The default value is 0. Type: integer (or Expression with resultType integer )."] + #[serde(rename = "baseRequestId", default, skip_serializing_if = "Option::is_none")] + pub base_request_id: Option, + #[doc = "Specifies the custom RFC function module that will be used to read data from SAP Table. Type: string (or Expression with resultType string)."] + #[serde(rename = "customRfcReadTableFunctionModule", default, skip_serializing_if = "Option::is_none")] + pub custom_rfc_read_table_function_module: Option, + #[doc = "The single character that will be used as delimiter passed to SAP RFC as well as splitting the output data retrieved. Type: string (or Expression with resultType string)."] + #[serde(rename = "sapDataColumnDelimiter", default, skip_serializing_if = "Option::is_none")] + pub sap_data_column_delimiter: Option, +} +impl SapOpenHubSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + exclude_last_request: None, + base_request_id: None, + custom_rfc_read_table_function_module: None, + sap_data_column_delimiter: None, + } + } +} +#[doc = "Sap Business Warehouse Open Hub Destination Table properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapOpenHubTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Sap Business Warehouse Open Hub Destination Table properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapOpenHubTableDatasetTypeProperties, +} +impl SapOpenHubTableDataset { + pub fn new(dataset: Dataset, type_properties: SapOpenHubTableDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Sap Business Warehouse Open Hub Destination Table properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapOpenHubTableDatasetTypeProperties { + #[doc = "The name of the Open Hub Destination with destination type as Database Table. Type: string (or Expression with resultType string)."] + #[serde(rename = "openHubDestinationName")] + pub open_hub_destination_name: serde_json::Value, + #[doc = "Whether to exclude the records of the last request. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "excludeLastRequest", default, skip_serializing_if = "Option::is_none")] + pub exclude_last_request: Option, + #[doc = "The ID of request for delta loading. Once it is set, only data with requestId larger than the value of this property will be retrieved. The default value is 0. Type: integer (or Expression with resultType integer )."] + #[serde(rename = "baseRequestId", default, skip_serializing_if = "Option::is_none")] + pub base_request_id: Option, +} +impl SapOpenHubTableDatasetTypeProperties { + pub fn new(open_hub_destination_name: serde_json::Value) -> Self { + Self { + open_hub_destination_name, + exclude_last_request: None, + base_request_id: None, + } + } +} +#[doc = "SAP Table Linked Service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapTableLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: SapTableLinkedServiceTypeProperties, +} +impl SapTableLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SapTableLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapTableLinkedServiceTypeProperties { + #[doc = "Host name of the SAP instance where the table is located. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub server: Option, + #[doc = "System number of the SAP system where the table is located. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string)."] + #[serde(rename = "systemNumber", default, skip_serializing_if = "Option::is_none")] + pub system_number: Option, + #[doc = "Client ID of the client on the SAP system where the table is located. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string)."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Language of the SAP system where the table is located. The default value is EN. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + #[doc = "SystemID of the SAP system where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "systemId", default, skip_serializing_if = "Option::is_none")] + pub system_id: Option, + #[doc = "Username to access the SAP server where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The hostname of the SAP Message Server. Type: string (or Expression with resultType string)."] + #[serde(rename = "messageServer", default, skip_serializing_if = "Option::is_none")] + pub message_server: Option, + #[doc = "The service name or port number of the Message Server. Type: string (or Expression with resultType string)."] + #[serde(rename = "messageServerService", default, skip_serializing_if = "Option::is_none")] + pub message_server_service: Option, + #[doc = "SNC activation indicator to access the SAP server where the table is located. Must be either 0 (off) or 1 (on). Type: string (or Expression with resultType string)."] + #[serde(rename = "sncMode", default, skip_serializing_if = "Option::is_none")] + pub snc_mode: Option, + #[doc = "Initiator's SNC name to access the SAP server where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "sncMyName", default, skip_serializing_if = "Option::is_none")] + pub snc_my_name: Option, + #[doc = "Communication partner's SNC name to access the SAP server where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "sncPartnerName", default, skip_serializing_if = "Option::is_none")] + pub snc_partner_name: Option, + #[doc = "External security product's library to access the SAP server where the table is located. Type: string (or Expression with resultType string)."] + #[serde(rename = "sncLibraryPath", default, skip_serializing_if = "Option::is_none")] + pub snc_library_path: Option, + #[doc = "SNC Quality of Protection. Allowed value include: 1, 2, 3, 8, 9. Type: string (or Expression with resultType string)."] + #[serde(rename = "sncQop", default, skip_serializing_if = "Option::is_none")] + pub snc_qop: Option, + #[doc = "The Logon Group for the SAP System. Type: string (or Expression with resultType string)."] + #[serde(rename = "logonGroup", default, skip_serializing_if = "Option::is_none")] + pub logon_group: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SapTableLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The partition mechanism that will be used for SAP table read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SapTablePartitionOption { + None, + PartitionOnInt, + PartitionOnCalendarYear, + PartitionOnCalendarMonth, + PartitionOnCalendarDate, + PartitionOnTime, +} +#[doc = "The settings that will be leveraged for SAP table source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SapTablePartitionSettings { + #[doc = "The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, + #[doc = "The maximum value of partitions the table will be split into. Type: integer (or Expression with resultType string)."] + #[serde(rename = "maxPartitionsNumber", default, skip_serializing_if = "Option::is_none")] + pub max_partitions_number: Option, +} +impl SapTablePartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SAP Table Resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapTableResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "SAP Table Resource properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SapTableResourceDatasetTypeProperties, +} +impl SapTableResourceDataset { + pub fn new(dataset: Dataset, type_properties: SapTableResourceDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "SAP Table Resource properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapTableResourceDatasetTypeProperties { + #[doc = "The name of the SAP Table. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName")] + pub table_name: serde_json::Value, +} +impl SapTableResourceDatasetTypeProperties { + pub fn new(table_name: serde_json::Value) -> Self { + Self { table_name } + } +} +#[doc = "A copy activity source for SAP Table source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SapTableSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "The number of rows to be retrieved. Type: integer(or Expression with resultType integer)."] + #[serde(rename = "rowCount", default, skip_serializing_if = "Option::is_none")] + pub row_count: Option, + #[doc = "The number of rows that will be skipped. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "rowSkips", default, skip_serializing_if = "Option::is_none")] + pub row_skips: Option, + #[doc = "The fields of the SAP table that will be retrieved. For example, column0, column1. Type: string (or Expression with resultType string)."] + #[serde(rename = "rfcTableFields", default, skip_serializing_if = "Option::is_none")] + pub rfc_table_fields: Option, + #[doc = "The options for the filtering of the SAP Table. For example, COLUMN0 EQ SOME VALUE. Type: string (or Expression with resultType string)."] + #[serde(rename = "rfcTableOptions", default, skip_serializing_if = "Option::is_none")] + pub rfc_table_options: Option, + #[doc = "Specifies the maximum number of rows that will be retrieved at a time when retrieving data from SAP Table. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "batchSize", default, skip_serializing_if = "Option::is_none")] + pub batch_size: Option, + #[doc = "Specifies the custom RFC function module that will be used to read data from SAP Table. Type: string (or Expression with resultType string)."] + #[serde(rename = "customRfcReadTableFunctionModule", default, skip_serializing_if = "Option::is_none")] + pub custom_rfc_read_table_function_module: Option, + #[doc = "The single character that will be used as delimiter passed to SAP RFC as well as splitting the output data retrieved. Type: string (or Expression with resultType string)."] + #[serde(rename = "sapDataColumnDelimiter", default, skip_serializing_if = "Option::is_none")] + pub sap_data_column_delimiter: Option, + #[doc = "The partition mechanism that will be used for SAP table read in parallel."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for SAP table source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SapTableSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + row_count: None, + row_skips: None, + rfc_table_fields: None, + rfc_table_options: None, + batch_size: None, + custom_rfc_read_table_function_module: None, + sap_data_column_delimiter: None, + partition_option: None, + partition_settings: None, + } + } +} +pub mod sap_table_source { + use super::*; + #[doc = "The partition mechanism that will be used for SAP table read in parallel."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PartitionOption { + None, + PartitionOnInt, + PartitionOnCalendarYear, + PartitionOnCalendarMonth, + PartitionOnCalendarDate, + PartitionOnTime, + } +} +#[doc = "Trigger that creates pipeline runs periodically, on schedule."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScheduleTrigger { + #[serde(flatten)] + pub multiple_pipeline_trigger: MultiplePipelineTrigger, + #[doc = "Schedule Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: schedule_trigger::TypeProperties, +} +impl ScheduleTrigger { + pub fn new(multiple_pipeline_trigger: MultiplePipelineTrigger, type_properties: schedule_trigger::TypeProperties) -> Self { + Self { + multiple_pipeline_trigger, + type_properties, + } + } +} +pub mod schedule_trigger { + use super::*; + #[doc = "Schedule Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "The workflow trigger recurrence."] + pub recurrence: ScheduleTriggerRecurrence, + } + impl TypeProperties { + pub fn new(recurrence: ScheduleTriggerRecurrence) -> Self { + Self { recurrence } + } + } +} +#[doc = "The workflow trigger recurrence."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScheduleTriggerRecurrence { + #[doc = "Enumerates possible frequency option for the schedule trigger."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub frequency: Option, + #[doc = "The interval."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub interval: Option, + #[doc = "The start time."] + #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")] + pub start_time: Option, + #[doc = "The end time."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "The time zone."] + #[serde(rename = "timeZone", default, skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + #[doc = "The recurrence schedule."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schedule: Option, +} +impl ScheduleTriggerRecurrence { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Custom script action to run on HDI ondemand cluster once it's up."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScriptAction { + #[doc = "The user provided name of the script action."] + pub name: String, + #[doc = "The URI for the script action."] + pub uri: String, + #[doc = "The node types on which the script action should be executed."] + pub roles: serde_json::Value, + #[doc = "The parameters for the script action."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl ScriptAction { + pub fn new(name: String, uri: String, roles: serde_json::Value) -> Self { + Self { + name, + uri, + roles, + parameters: None, + } + } +} +#[doc = "Script activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScriptActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Script activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ScriptActivityTypeProperties, +} +impl ScriptActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: ScriptActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Parameters of a script block."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScriptActivityParameter { + #[doc = "The name of the parameter. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The type of the parameter."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The value of the parameter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "The direction of the parameter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub direction: Option, + #[doc = "The size of the output direction parameter."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, +} +impl ScriptActivityParameter { + pub fn new() -> Self { + Self::default() + } +} +pub mod script_activity_parameter { + use super::*; + #[doc = "The type of the parameter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Boolean, + DateTime, + DateTimeOffset, + Decimal, + Double, + Guid, + Int16, + Int32, + Int64, + Single, + String, + Timespan, + } + #[doc = "The direction of the parameter."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Direction { + Input, + Output, + InputOutput, + } +} +#[doc = "Script block of scripts."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ScriptActivityScriptBlock { + #[doc = "The query text. Type: string (or Expression with resultType string)."] + pub text: serde_json::Value, + #[doc = "The type of the query. Type: string."] + #[serde(rename = "type")] + pub type_: script_activity_script_block::Type, + #[doc = "Array of script parameters. Type: array."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub parameters: Vec, +} +impl ScriptActivityScriptBlock { + pub fn new(text: serde_json::Value, type_: script_activity_script_block::Type) -> Self { + Self { + text, + type_, + parameters: Vec::new(), + } + } +} +pub mod script_activity_script_block { + use super::*; + #[doc = "The type of the query. Type: string."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + Query, + NonQuery, + } +} +#[doc = "Script activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct ScriptActivityTypeProperties { + #[doc = "Array of script blocks. Type: array."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub scripts: Vec, + #[doc = "Log settings of script activity."] + #[serde(rename = "logSettings", default, skip_serializing_if = "Option::is_none")] + pub log_settings: Option, +} +impl ScriptActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod script_activity_type_properties { + use super::*; + #[doc = "Log settings of script activity."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct LogSettings { + #[doc = "The destination of logs. Type: string."] + #[serde(rename = "logDestination")] + pub log_destination: log_settings::LogDestination, + #[doc = "Log location settings."] + #[serde(rename = "logLocationSettings", default, skip_serializing_if = "Option::is_none")] + pub log_location_settings: Option, + } + impl LogSettings { + pub fn new(log_destination: log_settings::LogDestination) -> Self { + Self { + log_destination, + log_location_settings: None, + } + } + } + pub mod log_settings { + use super::*; + #[doc = "The destination of logs. Type: string."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LogDestination { + ActivityOutput, + ExternalStore, + } + } +} +#[doc = "The base definition of a secret type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecretBase { + #[doc = "Type of the secret."] + #[serde(rename = "type")] + pub type_: String, +} +impl SecretBase { + pub fn new(type_: String) -> Self { + Self { type_ } + } +} +#[doc = "Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SecureString { + #[serde(flatten)] + pub secret_base: SecretBase, + #[doc = "Value of secure string."] + pub value: String, +} +impl SecureString { + pub fn new(secret_base: SecretBase, value: String) -> Self { + Self { secret_base, value } + } +} +#[doc = "Self referenced tumbling window trigger dependency."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SelfDependencyTumblingWindowTriggerReference { + #[serde(flatten)] + pub dependency_reference: DependencyReference, + #[doc = "Timespan applied to the start time of a tumbling window when evaluating dependency."] + pub offset: String, + #[doc = "The size of the window when evaluating the dependency. If undefined the frequency of the tumbling window will be used."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, +} +impl SelfDependencyTumblingWindowTriggerReference { + pub fn new(dependency_reference: DependencyReference, offset: String) -> Self { + Self { + dependency_reference, + offset, + size: None, + } + } +} +#[doc = "ServiceNow server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceNowLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "ServiceNow server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ServiceNowLinkedServiceTypeProperties, +} +impl ServiceNowLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ServiceNowLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "ServiceNow server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceNowLinkedServiceTypeProperties { + #[doc = "The endpoint of the ServiceNow server. (i.e. .service-now.com)"] + pub endpoint: serde_json::Value, + #[doc = "The authentication type to use."] + #[serde(rename = "authenticationType")] + pub authentication_type: service_now_linked_service_type_properties::AuthenticationType, + #[doc = "The user name used to connect to the ServiceNow server for Basic and OAuth2 authentication."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The client id for OAuth2 authentication."] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ServiceNowLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value, authentication_type: service_now_linked_service_type_properties::AuthenticationType) -> Self { + Self { + endpoint, + authentication_type, + username: None, + password: None, + client_id: None, + client_secret: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +pub mod service_now_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + OAuth2, + } +} +#[doc = "ServiceNow server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceNowObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ServiceNowObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity ServiceNow server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServiceNowSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ServiceNowSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The service principal credential type to use in Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or Expression with resultType string)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ServicePrincipalCredentialEnum { + ServicePrincipalKey, + ServicePrincipalCert, +} +#[doc = "Set value for a Variable."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SetVariableActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "SetVariable activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SetVariableActivityTypeProperties, +} +impl SetVariableActivity { + pub fn new(control_activity: ControlActivity, type_properties: SetVariableActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "SetVariable activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SetVariableActivityTypeProperties { + #[doc = "Name of the variable whose value needs to be set."] + #[serde(rename = "variableName", default, skip_serializing_if = "Option::is_none")] + pub variable_name: Option, + #[doc = "Value to be set. Could be a static value or Expression"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, +} +impl SetVariableActivityTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The location of SFTP dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SftpLocation { + #[serde(flatten)] + pub dataset_location: DatasetLocation, +} +impl SftpLocation { + pub fn new(dataset_location: DatasetLocation) -> Self { + Self { dataset_location } + } +} +#[doc = "Sftp read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SftpReadSettings { + #[serde(flatten)] + pub store_read_settings: StoreReadSettings, + #[doc = "If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub recursive: Option, + #[doc = "Sftp wildcardFolderPath. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFolderPath", default, skip_serializing_if = "Option::is_none")] + pub wildcard_folder_path: Option, + #[doc = "Sftp wildcardFileName. Type: string (or Expression with resultType string)."] + #[serde(rename = "wildcardFileName", default, skip_serializing_if = "Option::is_none")] + pub wildcard_file_name: Option, + #[doc = "Indicates whether to enable partition discovery."] + #[serde(rename = "enablePartitionDiscovery", default, skip_serializing_if = "Option::is_none")] + pub enable_partition_discovery: Option, + #[doc = "Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionRootPath", default, skip_serializing_if = "Option::is_none")] + pub partition_root_path: Option, + #[doc = "Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string)."] + #[serde(rename = "fileListPath", default, skip_serializing_if = "Option::is_none")] + pub file_list_path: Option, + #[doc = "Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "deleteFilesAfterCompletion", default, skip_serializing_if = "Option::is_none")] + pub delete_files_after_completion: Option, + #[doc = "The start of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeStart", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_start: Option, + #[doc = "The end of file's modified datetime. Type: string (or Expression with resultType string)."] + #[serde(rename = "modifiedDatetimeEnd", default, skip_serializing_if = "Option::is_none")] + pub modified_datetime_end: Option, + #[doc = "If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "disableChunking", default, skip_serializing_if = "Option::is_none")] + pub disable_chunking: Option, +} +impl SftpReadSettings { + pub fn new(store_read_settings: StoreReadSettings) -> Self { + Self { + store_read_settings, + recursive: None, + wildcard_folder_path: None, + wildcard_file_name: None, + enable_partition_discovery: None, + partition_root_path: None, + file_list_path: None, + delete_files_after_completion: None, + modified_datetime_start: None, + modified_datetime_end: None, + disable_chunking: None, + } + } +} +#[doc = "A linked service for an SSH File Transfer Protocol (SFTP) server. "] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SftpServerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Properties specific to this linked service type."] + #[serde(rename = "typeProperties")] + pub type_properties: SftpServerLinkedServiceTypeProperties, +} +impl SftpServerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SftpServerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Properties specific to this linked service type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SftpServerLinkedServiceTypeProperties { + #[doc = "The SFTP server host name. Type: string (or Expression with resultType string)."] + pub host: serde_json::Value, + #[doc = "The TCP port number that the SFTP server uses to listen for client connections. Default value is 22. Type: integer (or Expression with resultType integer), minimum: 0."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[doc = "The authentication type to be used to connect to the FTP server."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "The username used to log on to the SFTP server. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, + #[doc = "The SSH private key file path for SshPublicKey authentication. Only valid for on-premises copy. For on-premises copy with SshPublicKey authentication, either PrivateKeyPath or PrivateKeyContent should be specified. SSH private key should be OpenSSH format. Type: string (or Expression with resultType string)."] + #[serde(rename = "privateKeyPath", default, skip_serializing_if = "Option::is_none")] + pub private_key_path: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "privateKeyContent", default, skip_serializing_if = "Option::is_none")] + pub private_key_content: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "passPhrase", default, skip_serializing_if = "Option::is_none")] + pub pass_phrase: Option, + #[doc = "If true, skip the SSH host key validation. Default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "skipHostKeyValidation", default, skip_serializing_if = "Option::is_none")] + pub skip_host_key_validation: Option, + #[doc = "The host key finger-print of the SFTP server. When SkipHostKeyValidation is false, HostKeyFingerprint should be specified. Type: string (or Expression with resultType string)."] + #[serde(rename = "hostKeyFingerprint", default, skip_serializing_if = "Option::is_none")] + pub host_key_fingerprint: Option, +} +impl SftpServerLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + port: None, + authentication_type: None, + user_name: None, + password: None, + encrypted_credential: None, + private_key_path: None, + private_key_content: None, + pass_phrase: None, + skip_host_key_validation: None, + host_key_fingerprint: None, + } + } +} +pub mod sftp_server_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to be used to connect to the FTP server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + SshPublicKey, + } +} +#[doc = "Sftp write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SftpWriteSettings { + #[serde(flatten)] + pub store_write_settings: StoreWriteSettings, + #[doc = "Specifies the timeout for writing each chunk to SFTP server. Default value: 01:00:00 (one hour). Type: string (or Expression with resultType string)."] + #[serde(rename = "operationTimeout", default, skip_serializing_if = "Option::is_none")] + pub operation_timeout: Option, + #[doc = "Upload to temporary file(s) and rename. Disable this option if your SFTP server doesn't support rename operation. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "useTempFileRename", default, skip_serializing_if = "Option::is_none")] + pub use_temp_file_rename: Option, +} +impl SftpWriteSettings { + pub fn new(store_write_settings: StoreWriteSettings) -> Self { + Self { + store_write_settings, + operation_timeout: None, + use_temp_file_rename: None, + } + } +} +#[doc = "Sharepoint online list dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SharePointOnlineListDatasetTypeProperties { + #[doc = "The name of the SharePoint Online list. Type: string (or Expression with resultType string)."] + #[serde(rename = "listName", default, skip_serializing_if = "Option::is_none")] + pub list_name: Option, +} +impl SharePointOnlineListDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SharePoint Online List linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharePointOnlineListLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "SharePoint Online List linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SharePointOnlineListLinkedServiceTypeProperties, +} +impl SharePointOnlineListLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SharePointOnlineListLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "SharePoint Online List linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharePointOnlineListLinkedServiceTypeProperties { + #[doc = "The URL of the SharePoint Online site. For example, https://contoso.sharepoint.com/sites/siteName. Type: string (or Expression with resultType string)."] + #[serde(rename = "siteUrl")] + pub site_url: serde_json::Value, + #[doc = "The tenant ID under which your application resides. You can find it from Azure portal Active Directory overview page. Type: string (or Expression with resultType string)."] + #[serde(rename = "tenantId")] + pub tenant_id: serde_json::Value, + #[doc = "The application (client) ID of your application registered in Azure Active Directory. Make sure to grant SharePoint site permission to this application. Type: string (or Expression with resultType string)."] + #[serde(rename = "servicePrincipalId")] + pub service_principal_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "servicePrincipalKey")] + pub service_principal_key: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SharePointOnlineListLinkedServiceTypeProperties { + pub fn new( + site_url: serde_json::Value, + tenant_id: serde_json::Value, + service_principal_id: serde_json::Value, + service_principal_key: SecretBase, + ) -> Self { + Self { + site_url, + tenant_id, + service_principal_id, + service_principal_key, + encrypted_credential: None, + } + } +} +#[doc = "The sharepoint online list resource dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharePointOnlineListResourceDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Sharepoint online list dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SharePointOnlineListResourceDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity source for sharePoint online list source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SharePointOnlineListSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "The OData query to filter the data in SharePoint Online list. For example, \"$top=1\". Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The wait time to get a response from SharePoint Online. Default value is 5 minutes (00:05:00). Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "httpRequestTimeout", default, skip_serializing_if = "Option::is_none")] + pub http_request_timeout: Option, +} +impl SharePointOnlineListSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + http_request_timeout: None, + } + } +} +#[doc = "Shopify Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShopifyLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Shopify Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ShopifyLinkedServiceTypeProperties, +} +impl ShopifyLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ShopifyLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Shopify Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShopifyLinkedServiceTypeProperties { + #[doc = "The endpoint of the Shopify server. (i.e. mystore.myshopify.com)"] + pub host: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ShopifyLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + host, + access_token: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Shopify Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShopifyObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ShopifyObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Shopify Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShopifySource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ShopifySource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Skip error file."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SkipErrorFile { + #[doc = "Skip if file is deleted by other client during copy. Default is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "fileMissing", default, skip_serializing_if = "Option::is_none")] + pub file_missing: Option, + #[doc = "Skip if source/sink file changed by other concurrent write. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "dataInconsistency", default, skip_serializing_if = "Option::is_none")] + pub data_inconsistency: Option, +} +impl SkipErrorFile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SQL pool SKU"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct Sku { + #[doc = "The service tier"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tier: Option, + #[doc = "The SKU name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capacity: Option, +} +impl Sku { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for Smartsheet."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartsheetLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Smartsheet linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SmartsheetLinkedServiceTypeProperties, +} +impl SmartsheetLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SmartsheetLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Smartsheet linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SmartsheetLinkedServiceTypeProperties { + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken")] + pub api_token: SecretBase, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SmartsheetLinkedServiceTypeProperties { + pub fn new(api_token: SecretBase) -> Self { + Self { + api_token, + encrypted_credential: None, + } + } +} +#[doc = "The snowflake dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Snowflake dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SnowflakeDatasetTypeProperties, +} +impl SnowflakeDataset { + pub fn new(dataset: Dataset, type_properties: SnowflakeDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Snowflake dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SnowflakeDatasetTypeProperties { + #[doc = "The schema name of the Snowflake database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the Snowflake database. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl SnowflakeDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Snowflake export command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeExportCopyCommand { + #[serde(flatten)] + pub export_settings: ExportSettings, + #[doc = "Additional copy options directly passed to snowflake Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: \"additionalCopyOptions\": { \"DATE_FORMAT\": \"MM/DD/YYYY\", \"TIME_FORMAT\": \"'HH24:MI:SS.FF'\" }"] + #[serde(rename = "additionalCopyOptions", default, skip_serializing_if = "Option::is_none")] + pub additional_copy_options: Option, + #[doc = "Additional format options directly passed to snowflake Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: \"additionalFormatOptions\": { \"OVERWRITE\": \"TRUE\", \"MAX_FILE_SIZE\": \"'FALSE'\" }"] + #[serde(rename = "additionalFormatOptions", default, skip_serializing_if = "Option::is_none")] + pub additional_format_options: Option, +} +impl SnowflakeExportCopyCommand { + pub fn new(export_settings: ExportSettings) -> Self { + Self { + export_settings, + additional_copy_options: None, + additional_format_options: None, + } + } +} +#[doc = "Snowflake import command settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeImportCopyCommand { + #[serde(flatten)] + pub import_settings: ImportSettings, + #[doc = "Additional copy options directly passed to snowflake Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: \"additionalCopyOptions\": { \"DATE_FORMAT\": \"MM/DD/YYYY\", \"TIME_FORMAT\": \"'HH24:MI:SS.FF'\" }"] + #[serde(rename = "additionalCopyOptions", default, skip_serializing_if = "Option::is_none")] + pub additional_copy_options: Option, + #[doc = "Additional format options directly passed to snowflake Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: \"additionalFormatOptions\": { \"FORCE\": \"TRUE\", \"LOAD_UNCERTAIN_FILES\": \"'FALSE'\" }"] + #[serde(rename = "additionalFormatOptions", default, skip_serializing_if = "Option::is_none")] + pub additional_format_options: Option, +} +impl SnowflakeImportCopyCommand { + pub fn new(import_settings: ImportSettings) -> Self { + Self { + import_settings, + additional_copy_options: None, + additional_format_options: None, + } + } +} +#[doc = "Snowflake linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Snowflake linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SnowflakeLinkedServiceTypeProperties, +} +impl SnowflakeLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SnowflakeLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Snowflake linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeLinkedServiceTypeProperties { + #[doc = "The connection string of snowflake. Type: string, SecureString."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SnowflakeLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity snowflake sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "Snowflake import command settings."] + #[serde(rename = "importSettings", default, skip_serializing_if = "Option::is_none")] + pub import_settings: Option, +} +impl SnowflakeSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + import_settings: None, + } + } +} +#[doc = "A copy activity snowflake source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SnowflakeSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Snowflake Sql query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "Snowflake export command settings."] + #[serde(rename = "exportSettings", default, skip_serializing_if = "Option::is_none")] + pub export_settings: Option, +} +impl SnowflakeSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query: None, + export_settings: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkBatchJob { + #[serde(rename = "livyInfo", default, skip_serializing_if = "Option::is_none")] + pub livy_info: Option, + #[doc = "The batch name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The workspace name."] + #[serde(rename = "workspaceName", default, skip_serializing_if = "Option::is_none")] + pub workspace_name: Option, + #[doc = "The Spark pool name."] + #[serde(rename = "sparkPoolName", default, skip_serializing_if = "Option::is_none")] + pub spark_pool_name: Option, + #[doc = "The submitter name."] + #[serde(rename = "submitterName", default, skip_serializing_if = "Option::is_none")] + pub submitter_name: Option, + #[doc = "The submitter identifier."] + #[serde(rename = "submitterId", default, skip_serializing_if = "Option::is_none")] + pub submitter_id: Option, + #[doc = "The artifact identifier."] + #[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none")] + pub artifact_id: Option, + #[doc = "The job type."] + #[serde(rename = "jobType", default, skip_serializing_if = "Option::is_none")] + pub job_type: Option, + #[doc = "The Spark batch job result."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub result: Option, + #[serde(rename = "schedulerInfo", default, skip_serializing_if = "Option::is_none")] + pub scheduler_info: Option, + #[serde(rename = "pluginInfo", default, skip_serializing_if = "Option::is_none")] + pub plugin_info: Option, + #[doc = "The error information."] + #[serde(rename = "errorInfo", default, skip_serializing_if = "Vec::is_empty")] + pub error_info: Vec, + #[doc = "The tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The session Id."] + pub id: i32, + #[doc = "The application id of this session"] + #[serde(rename = "appId", default, skip_serializing_if = "Option::is_none")] + pub app_id: Option, + #[doc = "The detailed application info."] + #[serde(rename = "appInfo", default, skip_serializing_if = "Option::is_none")] + pub app_info: Option, + #[doc = "The batch state"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub state: Option, + #[doc = "The log lines."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub log: Vec, +} +impl SparkBatchJob { + pub fn new(id: i32) -> Self { + Self { + livy_info: None, + name: None, + workspace_name: None, + spark_pool_name: None, + submitter_name: None, + submitter_id: None, + artifact_id: None, + job_type: None, + result: None, + scheduler_info: None, + plugin_info: None, + error_info: Vec::new(), + tags: None, + id, + app_id: None, + app_info: None, + state: None, + log: Vec::new(), + } + } +} +pub mod spark_batch_job { + use super::*; + #[doc = "The job type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum JobType { + SparkBatch, + SparkSession, + } + #[doc = "The Spark batch job result."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Result { + Uncertain, + Succeeded, + Failed, + Cancelled, + } + #[doc = "The batch state"] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum State { + #[serde(rename = "not_started")] + NotStarted, + #[serde(rename = "starting")] + Starting, + #[serde(rename = "idle")] + Idle, + #[serde(rename = "busy")] + Busy, + #[serde(rename = "shutting_down")] + ShuttingDown, + #[serde(rename = "error")] + Error, + #[serde(rename = "dead")] + Dead, + #[serde(rename = "killed")] + Killed, + #[serde(rename = "success")] + Success, + #[serde(rename = "running")] + Running, + #[serde(rename = "recovering")] + Recovering, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkBatchJobState { + #[doc = "the time that at which \"not_started\" livy state was first seen."] + #[serde(rename = "notStartedAt", default, skip_serializing_if = "Option::is_none")] + pub not_started_at: Option, + #[doc = "the time that at which \"starting\" livy state was first seen."] + #[serde(rename = "startingAt", default, skip_serializing_if = "Option::is_none")] + pub starting_at: Option, + #[doc = "the time that at which \"running\" livy state was first seen."] + #[serde(rename = "runningAt", default, skip_serializing_if = "Option::is_none")] + pub running_at: Option, + #[doc = "time that at which \"dead\" livy state was first seen."] + #[serde(rename = "deadAt", default, skip_serializing_if = "Option::is_none")] + pub dead_at: Option, + #[doc = "the time that at which \"success\" livy state was first seen."] + #[serde(rename = "successAt", default, skip_serializing_if = "Option::is_none")] + pub success_at: Option, + #[doc = "the time that at which \"killed\" livy state was first seen."] + #[serde(rename = "killedAt", default, skip_serializing_if = "Option::is_none")] + pub killed_at: Option, + #[doc = "the time that at which \"recovering\" livy state was first seen."] + #[serde(rename = "recoveringAt", default, skip_serializing_if = "Option::is_none")] + pub recovering_at: Option, + #[doc = "the Spark job state."] + #[serde(rename = "currentState", default, skip_serializing_if = "Option::is_none")] + pub current_state: Option, + #[serde(rename = "jobCreationRequest", default, skip_serializing_if = "Option::is_none")] + pub job_creation_request: Option, +} +impl SparkBatchJobState { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SparkConfiguration Artifact information"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkConfiguration { + #[doc = "Description about the SparkConfiguration."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "SparkConfiguration configs."] + pub configs: serde_json::Value, + #[doc = "Annotations for SparkConfiguration."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, + #[doc = "additional Notes."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub notes: Option, + #[doc = "The identity that created the resource."] + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[doc = "The timestamp of resource creation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub created: Option, + #[doc = "SparkConfiguration configMergeRule."] + #[serde(rename = "configMergeRule", default, skip_serializing_if = "Option::is_none")] + pub config_merge_rule: Option, +} +impl SparkConfiguration { + pub fn new(configs: serde_json::Value) -> Self { + Self { + description: None, + configs, + annotations: Vec::new(), + notes: None, + created_by: None, + created: None, + config_merge_rule: None, + } + } +} +#[doc = "A list of sparkconfiguration resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkConfigurationListResponse { + #[doc = "List of sparkconfigurations."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SparkConfigurationListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Spark Configuration resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkConfigurationResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "SparkConfiguration Artifact information"] + pub properties: SparkConfiguration, +} +impl SparkConfigurationResource { + pub fn new(properties: SparkConfiguration) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Spark Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Spark. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Spark. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl SparkDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Spark job definition."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkJobDefinition { + #[doc = "The description of the Spark job definition."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Big data pool reference."] + #[serde(rename = "targetBigDataPool")] + pub target_big_data_pool: BigDataPoolReference, + #[doc = "The required Spark version of the application."] + #[serde(rename = "requiredSparkVersion", default, skip_serializing_if = "Option::is_none")] + pub required_spark_version: Option, + #[doc = "The language of the Spark application."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, + #[doc = "The properties of the Spark job."] + #[serde(rename = "jobProperties")] + pub job_properties: SparkJobProperties, + #[doc = "The folder that this Spark job definition is in. If not specified, this Spark job definition will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl SparkJobDefinition { + pub fn new(target_big_data_pool: BigDataPoolReference, job_properties: SparkJobProperties) -> Self { + Self { + description: None, + target_big_data_pool, + required_spark_version: None, + language: None, + job_properties, + folder: None, + } + } +} +pub mod spark_job_definition { + use super::*; + #[doc = "The folder that this Spark job definition is in. If not specified, this Spark job definition will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this Spark job definition is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "Spark job definition resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkJobDefinitionResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Spark job definition."] + pub properties: SparkJobDefinition, +} +impl SparkJobDefinitionResource { + pub fn new(properties: SparkJobDefinition) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "A list of spark job definitions resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkJobDefinitionsListResponse { + #[doc = "List of spark job definitions."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SparkJobDefinitionsListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "The properties of the Spark job."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkJobProperties { + #[doc = "The name of the job."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "File containing the application to execute."] + pub file: String, + #[doc = "Main class for Java/Scala application."] + #[serde(rename = "className", default, skip_serializing_if = "Option::is_none")] + pub class_name: Option, + #[doc = "Spark configuration properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conf: Option, + #[doc = "Command line arguments for the application."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[doc = "Jars to be used in this job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub jars: Vec, + #[doc = "files to be used in this job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub files: Vec, + #[doc = "Archives to be used in this job."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub archives: Vec, + #[doc = "Amount of memory to use for the driver process."] + #[serde(rename = "driverMemory")] + pub driver_memory: String, + #[doc = "Number of cores to use for the driver."] + #[serde(rename = "driverCores")] + pub driver_cores: i64, + #[doc = "Amount of memory to use per executor process."] + #[serde(rename = "executorMemory")] + pub executor_memory: String, + #[doc = "Number of cores to use for each executor."] + #[serde(rename = "executorCores")] + pub executor_cores: i64, + #[doc = "Number of executors to launch for this job."] + #[serde(rename = "numExecutors")] + pub num_executors: i64, +} +impl SparkJobProperties { + pub fn new( + file: String, + driver_memory: String, + driver_cores: i64, + executor_memory: String, + executor_cores: i64, + num_executors: i64, + ) -> Self { + Self { + name: None, + file, + class_name: None, + conf: None, + args: Vec::new(), + jars: Vec::new(), + files: Vec::new(), + archives: Vec::new(), + driver_memory, + driver_cores, + executor_memory, + executor_cores, + num_executors, + } + } +} +#[doc = "Spark Server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Spark Server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SparkLinkedServiceTypeProperties, +} +impl SparkLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SparkLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Spark Server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkLinkedServiceTypeProperties { + #[doc = "IP address or host name of the Spark server"] + pub host: serde_json::Value, + #[doc = "The TCP port that the Spark server uses to listen for client connections."] + pub port: serde_json::Value, + #[doc = "The type of Spark server."] + #[serde(rename = "serverType", default, skip_serializing_if = "Option::is_none")] + pub server_type: Option, + #[doc = "The transport protocol to use in the Thrift layer."] + #[serde(rename = "thriftTransportProtocol", default, skip_serializing_if = "Option::is_none")] + pub thrift_transport_protocol: Option, + #[doc = "The authentication method used to access the Spark server."] + #[serde(rename = "authenticationType")] + pub authentication_type: spark_linked_service_type_properties::AuthenticationType, + #[doc = "The user name that you use to access Spark Server."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The partial URL corresponding to the Spark server."] + #[serde(rename = "httpPath", default, skip_serializing_if = "Option::is_none")] + pub http_path: Option, + #[doc = "Specifies whether the connections to the server are encrypted using SSL. The default value is false."] + #[serde(rename = "enableSsl", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + #[doc = "The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR."] + #[serde(rename = "trustedCertPath", default, skip_serializing_if = "Option::is_none")] + pub trusted_cert_path: Option, + #[doc = "Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false."] + #[serde(rename = "useSystemTrustStore", default, skip_serializing_if = "Option::is_none")] + pub use_system_trust_store: Option, + #[doc = "Specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false."] + #[serde(rename = "allowHostNameCNMismatch", default, skip_serializing_if = "Option::is_none")] + pub allow_host_name_cn_mismatch: Option, + #[doc = "Specifies whether to allow self-signed certificates from the server. The default value is false."] + #[serde(rename = "allowSelfSignedServerCert", default, skip_serializing_if = "Option::is_none")] + pub allow_self_signed_server_cert: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SparkLinkedServiceTypeProperties { + pub fn new( + host: serde_json::Value, + port: serde_json::Value, + authentication_type: spark_linked_service_type_properties::AuthenticationType, + ) -> Self { + Self { + host, + port, + server_type: None, + thrift_transport_protocol: None, + authentication_type, + username: None, + password: None, + http_path: None, + enable_ssl: None, + trusted_cert_path: None, + use_system_trust_store: None, + allow_host_name_cn_mismatch: None, + allow_self_signed_server_cert: None, + encrypted_credential: None, + } + } +} +pub mod spark_linked_service_type_properties { + use super::*; + #[doc = "The type of Spark server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServerType { + SharkServer, + SharkServer2, + SparkThriftServer, + } + #[doc = "The transport protocol to use in the Thrift layer."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ThriftTransportProtocol { + Binary, + #[serde(rename = "SASL")] + Sasl, + #[serde(rename = "HTTP ")] + Http, + } + #[doc = "The authentication method used to access the Spark server."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Anonymous, + Username, + UsernameAndPassword, + #[serde(rename = "WindowsAzureHDInsightService")] + WindowsAzureHdInsightService, + } +} +#[doc = "Spark Server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Spark Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SparkObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkRequest { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub file: Option, + #[serde(rename = "className", default, skip_serializing_if = "Option::is_none")] + pub class_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub jars: Vec, + #[serde(rename = "pyFiles", default, skip_serializing_if = "Vec::is_empty")] + pub py_files: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub files: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub archives: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conf: Option, + #[serde(rename = "driverMemory", default, skip_serializing_if = "Option::is_none")] + pub driver_memory: Option, + #[serde(rename = "driverCores", default, skip_serializing_if = "Option::is_none")] + pub driver_cores: Option, + #[serde(rename = "executorMemory", default, skip_serializing_if = "Option::is_none")] + pub executor_memory: Option, + #[serde(rename = "executorCores", default, skip_serializing_if = "Option::is_none")] + pub executor_cores: Option, + #[serde(rename = "numExecutors", default, skip_serializing_if = "Option::is_none")] + pub num_executors: Option, +} +impl SparkRequest { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkScheduler { + #[serde(rename = "submittedAt", default, skip_serializing_if = "Option::is_none")] + pub submitted_at: Option, + #[serde(rename = "scheduledAt", default, skip_serializing_if = "Option::is_none")] + pub scheduled_at: Option, + #[serde(rename = "endedAt", default, skip_serializing_if = "Option::is_none")] + pub ended_at: Option, + #[serde(rename = "cancellationRequestedAt", default, skip_serializing_if = "Option::is_none")] + pub cancellation_requested_at: Option, + #[serde(rename = "currentState", default, skip_serializing_if = "Option::is_none")] + pub current_state: Option, +} +impl SparkScheduler { + pub fn new() -> Self { + Self::default() + } +} +pub mod spark_scheduler { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentState { + Queued, + Scheduled, + Ended, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkServiceError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(rename = "errorCode", default, skip_serializing_if = "Option::is_none")] + pub error_code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub source: Option, +} +impl SparkServiceError { + pub fn new() -> Self { + Self::default() + } +} +pub mod spark_service_error { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Source { + System, + User, + Unknown, + Dependency, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SparkServicePlugin { + #[serde(rename = "preparationStartedAt", default, skip_serializing_if = "Option::is_none")] + pub preparation_started_at: Option, + #[serde(rename = "resourceAcquisitionStartedAt", default, skip_serializing_if = "Option::is_none")] + pub resource_acquisition_started_at: Option, + #[serde(rename = "submissionStartedAt", default, skip_serializing_if = "Option::is_none")] + pub submission_started_at: Option, + #[serde(rename = "monitoringStartedAt", default, skip_serializing_if = "Option::is_none")] + pub monitoring_started_at: Option, + #[serde(rename = "cleanupStartedAt", default, skip_serializing_if = "Option::is_none")] + pub cleanup_started_at: Option, + #[serde(rename = "currentState", default, skip_serializing_if = "Option::is_none")] + pub current_state: Option, +} +impl SparkServicePlugin { + pub fn new() -> Self { + Self::default() + } +} +pub mod spark_service_plugin { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CurrentState { + Preparation, + ResourceAcquisition, + Queued, + Submission, + Monitoring, + Cleanup, + Ended, + } +} +#[doc = "A copy activity Spark Server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SparkSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SparkSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The connection used to execute the SQL script."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlConnection { + #[doc = "The type of the connection."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The identifier of the connection."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The associated SQL pool name (supported by SQL pool v3)"] + #[serde(rename = "poolName", default, skip_serializing_if = "Option::is_none")] + pub pool_name: Option, + #[doc = "The associated database name (supported by SQL pool v3)"] + #[serde(rename = "databaseName", default, skip_serializing_if = "Option::is_none")] + pub database_name: Option, +} +impl SqlConnection { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_connection { + use super::*; + #[doc = "The type of the connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SqlOnDemand, + SqlPool, + } +} +#[doc = "A copy activity SQL Data Warehouse sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDwSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "Indicates to use PolyBase to copy data into SQL Data Warehouse when applicable. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "allowPolyBase", default, skip_serializing_if = "Option::is_none")] + pub allow_poly_base: Option, + #[doc = "PolyBase settings."] + #[serde(rename = "polyBaseSettings", default, skip_serializing_if = "Option::is_none")] + pub poly_base_settings: Option, + #[doc = "Indicates to use Copy Command to copy data into SQL Data Warehouse. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "allowCopyCommand", default, skip_serializing_if = "Option::is_none")] + pub allow_copy_command: Option, + #[doc = "DW Copy Command settings."] + #[serde(rename = "copyCommandSettings", default, skip_serializing_if = "Option::is_none")] + pub copy_command_settings: Option, + #[doc = "The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableOption", default, skip_serializing_if = "Option::is_none")] + pub table_option: Option, +} +impl SqlDwSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + pre_copy_script: None, + allow_poly_base: None, + poly_base_settings: None, + allow_copy_command: None, + copy_command_settings: None, + table_option: None, + } + } +} +#[doc = "A copy activity SQL Data Warehouse source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDwSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL Data Warehouse reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a SQL Data Warehouse source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\". Type: object (or Expression with resultType object), itemType: StoredProcedureParameter."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SqlDwSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "A copy activity Azure SQL Managed Instance sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlMiSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL writer stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_stored_procedure_name: Option, + #[doc = "SQL writer table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterTableType", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_table_type: Option, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "SQL stored procedure parameters."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "The stored procedure parameter name of the table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureTableTypeParameterName", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_table_type_parameter_name: Option, + #[doc = "The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableOption", default, skip_serializing_if = "Option::is_none")] + pub table_option: Option, +} +impl SqlMiSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + sql_writer_stored_procedure_name: None, + sql_writer_table_type: None, + pre_copy_script: None, + stored_procedure_parameters: None, + stored_procedure_table_type_parameter_name: None, + table_option: None, + } + } +} +#[doc = "A copy activity Azure SQL Managed Instance source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlMiSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a Azure SQL Managed Instance source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "Which additional types to produce."] + #[serde(rename = "produceAdditionalTypes", default, skip_serializing_if = "Option::is_none")] + pub produce_additional_types: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SqlMiSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + produce_additional_types: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "The partition mechanism that will be used for Sql read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SqlPartitionOption { + None, + PhysicalPartitionsOfTable, + DynamicRange, +} +#[doc = "The settings that will be leveraged for Sql source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlPartitionSettings { + #[doc = "The name of the column in integer or datetime type that will be used for proceeding partitioning. If not specified, the primary key of the table is auto-detected and used as the partition column. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of the partition column for partition range splitting. This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or query result will be partitioned and copied. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of the partition column for partition range splitting. This value is used to decide the partition stride, not for filtering the rows in table. All rows in the table or query result will be partitioned and copied. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, +} +impl SqlPartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A SQL Analytics pool"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlPool { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "SQL pool SKU"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[doc = "Properties of a SQL Analytics pool"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +impl SqlPool { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + sku: None, + properties: None, + } + } +} +#[doc = "List of SQL pools"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlPoolInfoListResult { + #[doc = "Link to the next page of results"] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[doc = "List of SQL pools"] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +impl SqlPoolInfoListResult { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "SQL pool reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlPoolReference { + #[doc = "SQL pool reference type."] + #[serde(rename = "type")] + pub type_: sql_pool_reference::Type, + #[doc = "Reference SQL pool name."] + #[serde(rename = "referenceName")] + pub reference_name: String, +} +impl SqlPoolReference { + pub fn new(type_: sql_pool_reference::Type, reference_name: String) -> Self { + Self { type_, reference_name } + } +} +pub mod sql_pool_reference { + use super::*; + #[doc = "SQL pool reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SqlPoolReference, + } +} +#[doc = "Properties of a SQL Analytics pool"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlPoolResourceProperties { + #[doc = "Maximum size in bytes"] + #[serde(rename = "maxSizeBytes", default, skip_serializing_if = "Option::is_none")] + pub max_size_bytes: Option, + #[doc = "Collation mode"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub collation: Option, + #[doc = "Source database to create from"] + #[serde(rename = "sourceDatabaseId", default, skip_serializing_if = "Option::is_none")] + pub source_database_id: Option, + #[doc = "Backup database to restore from"] + #[serde(rename = "recoverableDatabaseId", default, skip_serializing_if = "Option::is_none")] + pub recoverable_database_id: Option, + #[doc = "Resource state"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Resource status"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Snapshot time to restore"] + #[serde(rename = "restorePointInTime", default, skip_serializing_if = "Option::is_none")] + pub restore_point_in_time: Option, + #[doc = "Specifies the mode of sql pool creation.\n\nDefault: regular sql pool creation.\n\nPointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and restorePointInTime must be specified.\n\nRecovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified as the recoverableDatabaseId to restore.\n\nRestore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate must be specified."] + #[serde(rename = "createMode", default, skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[doc = "Date the SQL pool was created"] + #[serde(rename = "creationDate", default, skip_serializing_if = "Option::is_none")] + pub creation_date: Option, +} +impl SqlPoolResourceProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod sql_pool_resource_properties { + use super::*; + #[doc = "Specifies the mode of sql pool creation.\n\nDefault: regular sql pool creation.\n\nPointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and restorePointInTime must be specified.\n\nRecovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified as the recoverableDatabaseId to restore.\n\nRestore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate must be specified."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreateMode { + Default, + PointInTimeRestore, + Recovery, + Restore, + } +} +#[doc = "Execute SQL pool stored procedure activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlPoolStoredProcedureActivity { + #[serde(flatten)] + pub activity: Activity, + #[doc = "SQL pool reference type."] + #[serde(rename = "sqlPool")] + pub sql_pool: SqlPoolReference, + #[doc = "SQL stored procedure activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SqlPoolStoredProcedureActivityTypeProperties, +} +impl SqlPoolStoredProcedureActivity { + pub fn new(activity: Activity, sql_pool: SqlPoolReference, type_properties: SqlPoolStoredProcedureActivityTypeProperties) -> Self { + Self { + activity, + sql_pool, + type_properties, + } + } +} +#[doc = "SQL stored procedure activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlPoolStoredProcedureActivityTypeProperties { + #[doc = "Stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureName")] + pub stored_procedure_name: serde_json::Value, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, +} +impl SqlPoolStoredProcedureActivityTypeProperties { + pub fn new(stored_procedure_name: serde_json::Value) -> Self { + Self { + stored_procedure_name, + stored_procedure_parameters: None, + } + } +} +#[doc = "SQL script."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlScript { + #[doc = "The description of the SQL script."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "The type of the SQL script."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "The content of the SQL script."] + pub content: SqlScriptContent, + #[doc = "The folder that this SQL script is in. If not specified, this SQL script will appear at the root level."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub folder: Option, +} +impl SqlScript { + pub fn new(content: SqlScriptContent) -> Self { + Self { + description: None, + type_: None, + content, + folder: None, + } + } +} +pub mod sql_script { + use super::*; + #[doc = "The type of the SQL script."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SqlQuery, + } + #[doc = "The folder that this SQL script is in. If not specified, this SQL script will appear at the root level."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] + pub struct Folder { + #[doc = "The name of the folder that this SQL script is in."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl Folder { + pub fn new() -> Self { + Self::default() + } + } +} +#[doc = "The content of the SQL script."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlScriptContent { + #[doc = "SQL query to execute."] + pub query: String, + #[doc = "The connection used to execute the SQL script."] + #[serde(rename = "currentConnection", default, skip_serializing_if = "Option::is_none")] + pub current_connection: Option, + #[doc = "Limit of results, '-1' for no limit."] + #[serde(rename = "resultLimit", default, skip_serializing_if = "Option::is_none")] + pub result_limit: Option, + #[doc = "The metadata of the SQL script."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, +} +impl SqlScriptContent { + pub fn new(query: String) -> Self { + Self { + query, + current_connection: None, + result_limit: None, + metadata: None, + } + } +} +#[doc = "The metadata of the SQL script."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlScriptMetadata { + #[doc = "The language of the SQL script."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub language: Option, +} +impl SqlScriptMetadata { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Sql Script resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlScriptResource { + #[doc = "Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[doc = "The name of the resource"] + pub name: String, + #[doc = "The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "Resource Etag."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[doc = "SQL script."] + pub properties: SqlScript, +} +impl SqlScriptResource { + pub fn new(name: String, properties: SqlScript) -> Self { + Self { + id: None, + name, + type_: None, + etag: None, + properties, + } + } +} +#[doc = "A list of sql scripts resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlScriptsListResponse { + #[doc = "List of sql scripts."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl SqlScriptsListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "SQL Server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "SQL Server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SqlServerLinkedServiceTypeProperties, +} +impl SqlServerLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SqlServerLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "SQL Server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerLinkedServiceTypeProperties { + #[doc = "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString")] + pub connection_string: serde_json::Value, + #[doc = "The on-premises Windows authentication user name. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SqlServerLinkedServiceTypeProperties { + pub fn new(connection_string: serde_json::Value) -> Self { + Self { + connection_string, + user_name: None, + password: None, + encrypted_credential: None, + } + } +} +#[doc = "A copy activity SQL server sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL writer stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_stored_procedure_name: Option, + #[doc = "SQL writer table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterTableType", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_table_type: Option, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "SQL stored procedure parameters."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "The stored procedure parameter name of the table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureTableTypeParameterName", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_table_type_parameter_name: Option, + #[doc = "The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableOption", default, skip_serializing_if = "Option::is_none")] + pub table_option: Option, +} +impl SqlServerSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + sql_writer_stored_procedure_name: None, + sql_writer_table_type: None, + pre_copy_script: None, + stored_procedure_parameters: None, + stored_procedure_table_type_parameter_name: None, + table_option: None, + } + } +} +#[doc = "A copy activity SQL server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "Which additional types to produce."] + #[serde(rename = "produceAdditionalTypes", default, skip_serializing_if = "Option::is_none")] + pub produce_additional_types: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SqlServerSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + produce_additional_types: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "SQL stored procedure activity type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerStoredProcedureActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "SQL stored procedure activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SqlServerStoredProcedureActivityTypeProperties, +} +impl SqlServerStoredProcedureActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: SqlServerStoredProcedureActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "SQL stored procedure activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerStoredProcedureActivityTypeProperties { + #[doc = "Stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureName")] + pub stored_procedure_name: serde_json::Value, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, +} +impl SqlServerStoredProcedureActivityTypeProperties { + pub fn new(stored_procedure_name: serde_json::Value) -> Self { + Self { + stored_procedure_name, + stored_procedure_parameters: None, + } + } +} +#[doc = "The on-premises SQL Server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlServerTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "On-premises SQL Server dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SqlServerTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "On-premises SQL Server dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SqlServerTableDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The schema name of the SQL Server dataset. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "The table name of the SQL Server dataset. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl SqlServerTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity SQL sink."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlSink { + #[serde(flatten)] + pub copy_sink: CopySink, + #[doc = "SQL writer stored procedure name. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_stored_procedure_name: Option, + #[doc = "SQL writer table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlWriterTableType", default, skip_serializing_if = "Option::is_none")] + pub sql_writer_table_type: Option, + #[doc = "SQL pre-copy script. Type: string (or Expression with resultType string)."] + #[serde(rename = "preCopyScript", default, skip_serializing_if = "Option::is_none")] + pub pre_copy_script: Option, + #[doc = "SQL stored procedure parameters."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "The stored procedure parameter name of the table type. Type: string (or Expression with resultType string)."] + #[serde(rename = "storedProcedureTableTypeParameterName", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_table_type_parameter_name: Option, + #[doc = "The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableOption", default, skip_serializing_if = "Option::is_none")] + pub table_option: Option, +} +impl SqlSink { + pub fn new(copy_sink: CopySink) -> Self { + Self { + copy_sink, + sql_writer_stored_procedure_name: None, + sql_writer_table_type: None, + pre_copy_script: None, + stored_procedure_parameters: None, + stored_procedure_table_type_parameter_name: None, + table_option: None, + } + } +} +#[doc = "A copy activity SQL source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "SQL reader query. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderQuery", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_query: Option, + #[doc = "Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string)."] + #[serde(rename = "sqlReaderStoredProcedureName", default, skip_serializing_if = "Option::is_none")] + pub sql_reader_stored_procedure_name: Option, + #[doc = "Value and type setting for stored procedure parameters. Example: \"{Parameter1: {value: \"1\", type: \"int\"}}\"."] + #[serde(rename = "storedProcedureParameters", default, skip_serializing_if = "Option::is_none")] + pub stored_procedure_parameters: Option, + #[doc = "Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string)."] + #[serde(rename = "isolationLevel", default, skip_serializing_if = "Option::is_none")] + pub isolation_level: Option, + #[doc = "The partition mechanism that will be used for Sql read in parallel. Possible values include: \"None\", \"PhysicalPartitionsOfTable\", \"DynamicRange\"."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for Sql source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl SqlSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + sql_reader_query: None, + sql_reader_stored_procedure_name: None, + stored_procedure_parameters: None, + isolation_level: None, + partition_option: None, + partition_settings: None, + } + } +} +#[doc = "Square Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SquareLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Square Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SquareLinkedServiceTypeProperties, +} +impl SquareLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SquareLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Square Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SquareLinkedServiceTypeProperties { + #[doc = "Properties used to connect to Square. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The URL\u{a0}of the Square instance. (i.e. mystore.mysquare.com)"] + pub host: serde_json::Value, + #[doc = "The client ID associated with your Square application."] + #[serde(rename = "clientId")] + pub client_id: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + #[doc = "The redirect URL assigned in the Square application dashboard. (i.e. http://localhost:2500)"] + #[serde(rename = "redirectUri")] + pub redirect_uri: serde_json::Value, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SquareLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value, client_id: serde_json::Value, redirect_uri: serde_json::Value) -> Self { + Self { + connection_properties: None, + host, + client_id, + client_secret: None, + redirect_uri, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Square Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SquareObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SquareObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Square Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SquareSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SquareSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The status of the operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SsisObjectMetadataStatusResponse { + #[doc = "The status of the operation."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "The operation name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "The operation properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The operation error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +impl SsisObjectMetadataStatusResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Staging settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StagingSettings { + #[doc = "Linked service reference type."] + #[serde(rename = "linkedServiceName")] + pub linked_service_name: LinkedServiceReference, + #[doc = "The path to storage for storing the interim data. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[doc = "Specifies whether to use compression when copying data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "enableCompression", default, skip_serializing_if = "Option::is_none")] + pub enable_compression: Option, +} +impl StagingSettings { + pub fn new(linked_service_name: LinkedServiceReference) -> Self { + Self { + linked_service_name, + path: None, + enable_compression: None, + } + } +} +#[doc = "Request body structure for starting data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StartDataFlowDebugSessionRequest { + #[doc = "The ID of data flow debug session."] + #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")] + pub session_id: Option, + #[doc = "Data flow resource type."] + #[serde(rename = "dataFlow", default, skip_serializing_if = "Option::is_none")] + pub data_flow: Option, + #[doc = "List of Data flows"] + #[serde(rename = "dataFlows", default, skip_serializing_if = "Vec::is_empty")] + pub data_flows: Vec, + #[doc = "List of datasets."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datasets: Vec, + #[doc = "List of linked services."] + #[serde(rename = "linkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub linked_services: Vec, + #[doc = "Staging info for debug session."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub staging: Option, + #[doc = "Data flow debug settings."] + #[serde(rename = "debugSettings", default, skip_serializing_if = "Option::is_none")] + pub debug_settings: Option, + #[doc = "The type of new Databricks cluster."] + #[serde(rename = "incrementalDebug", default, skip_serializing_if = "Option::is_none")] + pub incremental_debug: Option, +} +impl StartDataFlowDebugSessionRequest { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Response body structure for starting data flow debug session."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StartDataFlowDebugSessionResponse { + #[doc = "The ID of data flow debug job version."] + #[serde(rename = "jobVersion", default, skip_serializing_if = "Option::is_none")] + pub job_version: Option, +} +impl StartDataFlowDebugSessionResponse { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Connector read setting."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StoreReadSettings { + #[doc = "The read setting type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxConcurrentConnections", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_connections: Option, +} +impl StoreReadSettings { + pub fn new(type_: String) -> Self { + Self { + type_, + max_concurrent_connections: None, + } + } +} +#[doc = "Connector write settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct StoreWriteSettings { + #[doc = "The write setting type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "maxConcurrentConnections", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_connections: Option, + #[doc = "The type of copy behavior for copy sink."] + #[serde(rename = "copyBehavior", default, skip_serializing_if = "Option::is_none")] + pub copy_behavior: Option, +} +impl StoreWriteSettings { + pub fn new(type_: String) -> Self { + Self { + type_, + max_concurrent_connections: None, + copy_behavior: None, + } + } +} +#[doc = "SQL stored procedure parameter."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct StoredProcedureParameter { + #[doc = "Stored procedure parameter value. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "Stored procedure parameter type."] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +impl StoredProcedureParameter { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Stored procedure parameter type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum StoredProcedureParameterType { + String, + Int, + Int64, + Decimal, + Guid, + Boolean, + Date, +} +#[doc = "Azure Synapse nested resource, which belongs to a workspace."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubResource { + #[serde(flatten)] + pub azure_entity_resource: AzureEntityResource, +} +impl SubResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Azure Synapse nested debug resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SubResourceDebugResource { + #[doc = "The resource name."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +impl SubResourceDebugResource { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This activity evaluates an expression and executes activities under the cases property that correspond to the expression evaluation expected in the equals property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Switch activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SwitchActivityTypeProperties, +} +impl SwitchActivity { + pub fn new(control_activity: ControlActivity, type_properties: SwitchActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Switch activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SwitchActivityTypeProperties { + #[doc = "Azure Synapse expression definition."] + pub on: Expression, + #[doc = "List of cases that correspond to expected values of the 'on' property. This is an optional property and if not provided, the activity will execute activities provided in defaultActivities."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cases: Vec, + #[doc = "List of activities to execute if no case condition is satisfied. This is an optional property and if not provided, the activity will exit without any action."] + #[serde(rename = "defaultActivities", default, skip_serializing_if = "Vec::is_empty")] + pub default_activities: Vec, +} +impl SwitchActivityTypeProperties { + pub fn new(on: Expression) -> Self { + Self { + on, + cases: Vec::new(), + default_activities: Vec::new(), + } + } +} +#[doc = "Switch cases with have a value and corresponding activities."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SwitchCase { + #[doc = "Expected value that satisfies the expression result of the 'on' property."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub value: Option, + #[doc = "List of activities to execute for satisfied case condition."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub activities: Vec, +} +impl SwitchCase { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Linked service for Sybase data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SybaseLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Sybase linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SybaseLinkedServiceTypeProperties, +} +impl SybaseLinkedService { + pub fn new(linked_service: LinkedService, type_properties: SybaseLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Sybase linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SybaseLinkedServiceTypeProperties { + #[doc = "Server name for connection. Type: string (or Expression with resultType string)."] + pub server: serde_json::Value, + #[doc = "Database name for connection. Type: string (or Expression with resultType string)."] + pub database: serde_json::Value, + #[doc = "Schema name for connection. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[doc = "AuthenticationType to be used for connection."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "Username for authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl SybaseLinkedServiceTypeProperties { + pub fn new(server: serde_json::Value, database: serde_json::Value) -> Self { + Self { + server, + database, + schema: None, + authentication_type: None, + username: None, + password: None, + encrypted_credential: None, + } + } +} +pub mod sybase_linked_service_type_properties { + use super::*; + #[doc = "AuthenticationType to be used for connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Windows, + } +} +#[doc = "A copy activity source for Sybase databases."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SybaseSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Database query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl SybaseSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "The Sybase table dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SybaseTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Sybase table dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl SybaseTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Sybase table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct SybaseTableDatasetTypeProperties { + #[doc = "The Sybase table name. Type: string (or Expression with resultType string)."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, +} +impl SybaseTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Execute Synapse notebook activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseNotebookActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Execute Synapse notebook activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SynapseNotebookActivityTypeProperties, +} +impl SynapseNotebookActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: SynapseNotebookActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Execute Synapse notebook activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseNotebookActivityTypeProperties { + #[doc = "Synapse notebook reference type."] + pub notebook: SynapseNotebookReference, + #[doc = "Big data pool reference type."] + #[serde(rename = "sparkPool", default, skip_serializing_if = "Option::is_none")] + pub spark_pool: Option, + #[doc = "Notebook parameters."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl SynapseNotebookActivityTypeProperties { + pub fn new(notebook: SynapseNotebookReference) -> Self { + Self { + notebook, + spark_pool: None, + parameters: None, + } + } +} +#[doc = "Synapse notebook reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseNotebookReference { + #[doc = "Synapse notebook reference type."] + #[serde(rename = "type")] + pub type_: synapse_notebook_reference::Type, + #[doc = "Reference notebook name. Type: string (or Expression with resultType string)."] + #[serde(rename = "referenceName")] + pub reference_name: serde_json::Value, +} +impl SynapseNotebookReference { + pub fn new(type_: synapse_notebook_reference::Type, reference_name: serde_json::Value) -> Self { + Self { type_, reference_name } + } +} +pub mod synapse_notebook_reference { + use super::*; + #[doc = "Synapse notebook reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + NotebookReference, + } +} +#[doc = "Execute spark job activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseSparkJobActivityTypeProperties { + #[doc = "Synapse spark job reference type."] + #[serde(rename = "sparkJob")] + pub spark_job: SynapseSparkJobReference, + #[doc = "User specified arguments to SynapseSparkJobDefinitionActivity."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[doc = "The main file used for the job, which will override the 'file' of the spark job definition you provide. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub file: Option, + #[doc = "The fully-qualified identifier or the main class that is in the main definition file, which will override the 'className' of the spark job definition you provide. Type: string (or Expression with resultType string)."] + #[serde(rename = "className", default, skip_serializing_if = "Option::is_none")] + pub class_name: Option, + #[doc = "Additional files used for reference in the main definition file, which will override the 'files' of the spark job definition you provide."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub files: Vec, + #[doc = "Big data pool reference type."] + #[serde(rename = "targetBigDataPool", default, skip_serializing_if = "Option::is_none")] + pub target_big_data_pool: Option, + #[doc = "Number of core and memory to be used for executors allocated in the specified Spark pool for the job, which will be used for overriding 'executorCores' and 'executorMemory' of the spark job definition you provide. Type: string (or Expression with resultType string)."] + #[serde(rename = "executorSize", default, skip_serializing_if = "Option::is_none")] + pub executor_size: Option, + #[doc = "Spark configuration properties, which will override the 'conf' of the spark job definition you provide."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conf: Option, + #[doc = "Number of core and memory to be used for driver allocated in the specified Spark pool for the job, which will be used for overriding 'driverCores' and 'driverMemory' of the spark job definition you provide. Type: string (or Expression with resultType string)."] + #[serde(rename = "driverSize", default, skip_serializing_if = "Option::is_none")] + pub driver_size: Option, + #[doc = "Number of executors to launch for this job, which will override the 'numExecutors' of the spark job definition you provide."] + #[serde(rename = "numExecutors", default, skip_serializing_if = "Option::is_none")] + pub num_executors: Option, +} +impl SynapseSparkJobActivityTypeProperties { + pub fn new(spark_job: SynapseSparkJobReference) -> Self { + Self { + spark_job, + args: Vec::new(), + file: None, + class_name: None, + files: Vec::new(), + target_big_data_pool: None, + executor_size: None, + conf: None, + driver_size: None, + num_executors: None, + } + } +} +#[doc = "Execute spark job activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseSparkJobDefinitionActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Execute spark job activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: SynapseSparkJobActivityTypeProperties, +} +impl SynapseSparkJobDefinitionActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: SynapseSparkJobActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Synapse spark job reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SynapseSparkJobReference { + #[doc = "Synapse spark job reference type."] + #[serde(rename = "type")] + pub type_: synapse_spark_job_reference::Type, + #[doc = "Reference spark job name."] + #[serde(rename = "referenceName")] + pub reference_name: String, +} +impl SynapseSparkJobReference { + pub fn new(type_: synapse_spark_job_reference::Type, reference_name: String) -> Self { + Self { type_, reference_name } + } +} +pub mod synapse_spark_job_reference { + use super::*; + #[doc = "Synapse spark job reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SparkJobDefinitionReference, + } +} +#[doc = "Copy activity sources of tabular type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TabularSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Query timeout. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(rename = "queryTimeout", default, skip_serializing_if = "Option::is_none")] + pub query_timeout: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl TabularSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + query_timeout: None, + additional_columns: None, + } + } +} +#[doc = "A copy activity tabular translator."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TabularTranslator { + #[serde(flatten)] + pub copy_translator: CopyTranslator, + #[doc = "Column mappings. Example: \"UserId: MyUserId, Group: MyGroup, Name: MyName\" Type: string (or Expression with resultType string). This property will be retired. Please use mappings property."] + #[serde(rename = "columnMappings", default, skip_serializing_if = "Option::is_none")] + pub column_mappings: Option, + #[doc = "The schema mapping to map between tabular data and hierarchical data. Example: {\"Column1\": \"$.Column1\", \"Column2\": \"$.Column2.Property1\", \"Column3\": \"$.Column2.Property2\"}. Type: object (or Expression with resultType object). This property will be retired. Please use mappings property."] + #[serde(rename = "schemaMapping", default, skip_serializing_if = "Option::is_none")] + pub schema_mapping: Option, + #[doc = "The JSON Path of the Nested Array that is going to do cross-apply. Type: object (or Expression with resultType object)."] + #[serde(rename = "collectionReference", default, skip_serializing_if = "Option::is_none")] + pub collection_reference: Option, + #[doc = "Whether to map complex (array and object) values to simple strings in json format. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "mapComplexValuesToString", default, skip_serializing_if = "Option::is_none")] + pub map_complex_values_to_string: Option, + #[doc = "Column mappings with logical types. Tabular->tabular example: [{\"source\":{\"name\":\"CustomerName\",\"type\":\"String\"},\"sink\":{\"name\":\"ClientName\",\"type\":\"String\"}},{\"source\":{\"name\":\"CustomerAddress\",\"type\":\"String\"},\"sink\":{\"name\":\"ClientAddress\",\"type\":\"String\"}}]. Hierarchical->tabular example: [{\"source\":{\"path\":\"$.CustomerName\",\"type\":\"String\"},\"sink\":{\"name\":\"ClientName\",\"type\":\"String\"}},{\"source\":{\"path\":\"$.CustomerAddress\",\"type\":\"String\"},\"sink\":{\"name\":\"ClientAddress\",\"type\":\"String\"}}]. Type: object (or Expression with resultType object)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mappings: Option, + #[doc = "Whether to enable the advanced type conversion feature in the Copy activity. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "typeConversion", default, skip_serializing_if = "Option::is_none")] + pub type_conversion: Option, + #[doc = "Type conversion settings"] + #[serde(rename = "typeConversionSettings", default, skip_serializing_if = "Option::is_none")] + pub type_conversion_settings: Option, +} +impl TabularTranslator { + pub fn new(copy_translator: CopyTranslator) -> Self { + Self { + copy_translator, + column_mappings: None, + schema_mapping: None, + collection_reference: None, + map_complex_values_to_string: None, + mappings: None, + type_conversion: None, + type_conversion_settings: None, + } + } +} +#[doc = "The TarGZip compression read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TarGZipReadSettings { + #[serde(flatten)] + pub compression_read_settings: CompressionReadSettings, + #[doc = "Preserve the compression file name as folder path. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "preserveCompressionFileNameAsFolder", default, skip_serializing_if = "Option::is_none")] + pub preserve_compression_file_name_as_folder: Option, +} +impl TarGZipReadSettings { + pub fn new(compression_read_settings: CompressionReadSettings) -> Self { + Self { + compression_read_settings, + preserve_compression_file_name_as_folder: None, + } + } +} +#[doc = "The Tar compression read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TarReadSettings { + #[serde(flatten)] + pub compression_read_settings: CompressionReadSettings, + #[doc = "Preserve the compression file name as folder path. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "preserveCompressionFileNameAsFolder", default, skip_serializing_if = "Option::is_none")] + pub preserve_compression_file_name_as_folder: Option, +} +impl TarReadSettings { + pub fn new(compression_read_settings: CompressionReadSettings) -> Self { + Self { + compression_read_settings, + preserve_compression_file_name_as_folder: None, + } + } +} +#[doc = "Linked service for TeamDesk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeamDeskLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "TeamDesk linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TeamDeskLinkedServiceTypeProperties, +} +impl TeamDeskLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TeamDeskLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "TeamDesk linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeamDeskLinkedServiceTypeProperties { + #[doc = "The authentication type to use."] + #[serde(rename = "authenticationType")] + pub authentication_type: team_desk_linked_service_type_properties::AuthenticationType, + #[doc = "The url to connect TeamDesk source. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The username of the TeamDesk source. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken", default, skip_serializing_if = "Option::is_none")] + pub api_token: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl TeamDeskLinkedServiceTypeProperties { + pub fn new(authentication_type: team_desk_linked_service_type_properties::AuthenticationType, url: serde_json::Value) -> Self { + Self { + authentication_type, + url, + user_name: None, + password: None, + api_token: None, + encrypted_credential: None, + } + } +} +pub mod team_desk_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Token, + } +} +#[doc = "Linked service for Teradata data source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Teradata linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TeradataLinkedServiceTypeProperties, +} +impl TeradataLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TeradataLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Teradata linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataLinkedServiceTypeProperties { + #[doc = "Teradata ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Server name for connection. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub server: Option, + #[doc = "AuthenticationType to be used for connection."] + #[serde(rename = "authenticationType", default, skip_serializing_if = "Option::is_none")] + pub authentication_type: Option, + #[doc = "Username for authentication. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl TeradataLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +pub mod teradata_linked_service_type_properties { + use super::*; + #[doc = "AuthenticationType to be used for connection."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Windows, + } +} +#[doc = "The partition mechanism that will be used for teradata read in parallel."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TeradataPartitionOption { + None, + Hash, + DynamicRange, +} +#[doc = "The settings that will be leveraged for teradata source partitioning."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataPartitionSettings { + #[doc = "The name of the column that will be used for proceeding range or hash partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionColumnName", default, skip_serializing_if = "Option::is_none")] + pub partition_column_name: Option, + #[doc = "The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionUpperBound", default, skip_serializing_if = "Option::is_none")] + pub partition_upper_bound: Option, + #[doc = "The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string)."] + #[serde(rename = "partitionLowerBound", default, skip_serializing_if = "Option::is_none")] + pub partition_lower_bound: Option, +} +impl TeradataPartitionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Teradata source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "Teradata query. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + #[doc = "The partition mechanism that will be used for teradata read in parallel."] + #[serde(rename = "partitionOption", default, skip_serializing_if = "Option::is_none")] + pub partition_option: Option, + #[doc = "The settings that will be leveraged for teradata source partitioning."] + #[serde(rename = "partitionSettings", default, skip_serializing_if = "Option::is_none")] + pub partition_settings: Option, +} +impl TeradataSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + partition_option: None, + partition_settings: None, + } + } +} +pub mod teradata_source { + use super::*; + #[doc = "The partition mechanism that will be used for teradata read in parallel."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PartitionOption { + None, + Hash, + DynamicRange, + } +} +#[doc = "The Teradata database dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TeradataTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Teradata dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl TeradataTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Teradata dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TeradataTableDatasetTypeProperties { + #[doc = "The database name of Teradata. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub database: Option, + #[doc = "The table name of Teradata. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, +} +impl TeradataTableDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "The data stored in text format."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TextFormat { + #[serde(flatten)] + pub dataset_storage_format: DatasetStorageFormat, + #[doc = "The column delimiter. Type: string (or Expression with resultType string)."] + #[serde(rename = "columnDelimiter", default, skip_serializing_if = "Option::is_none")] + pub column_delimiter: Option, + #[doc = "The row delimiter. Type: string (or Expression with resultType string)."] + #[serde(rename = "rowDelimiter", default, skip_serializing_if = "Option::is_none")] + pub row_delimiter: Option, + #[doc = "The escape character. Type: string (or Expression with resultType string)."] + #[serde(rename = "escapeChar", default, skip_serializing_if = "Option::is_none")] + pub escape_char: Option, + #[doc = "The quote character. Type: string (or Expression with resultType string)."] + #[serde(rename = "quoteChar", default, skip_serializing_if = "Option::is_none")] + pub quote_char: Option, + #[doc = "The null value string. Type: string (or Expression with resultType string)."] + #[serde(rename = "nullValue", default, skip_serializing_if = "Option::is_none")] + pub null_value: Option, + #[doc = "The code page name of the preferred encoding. If miss, the default value is ΓÇ£utf-8ΓÇ¥, unless BOM denotes another Unicode encoding. Refer to the ΓÇ£NameΓÇ¥ column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string)."] + #[serde(rename = "encodingName", default, skip_serializing_if = "Option::is_none")] + pub encoding_name: Option, + #[doc = "Treat empty column values in the text file as null. The default value is true. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "treatEmptyAsNull", default, skip_serializing_if = "Option::is_none")] + pub treat_empty_as_null: Option, + #[doc = "The number of lines/rows to be skipped when parsing text files. The default value is 0. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "skipLineCount", default, skip_serializing_if = "Option::is_none")] + pub skip_line_count: Option, + #[doc = "When used as input, treat the first row of data as headers. When used as output,write the headers into the output as the first row of data. The default value is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "firstRowAsHeader", default, skip_serializing_if = "Option::is_none")] + pub first_row_as_header: Option, +} +impl TextFormat { + pub fn new(dataset_storage_format: DatasetStorageFormat) -> Self { + Self { + dataset_storage_format, + column_delimiter: None, + row_delimiter: None, + escape_char: None, + quote_char: None, + null_value: None, + encoding_name: None, + treat_empty_as_null: None, + skip_line_count: None, + first_row_as_header: None, + } + } +} +#[doc = "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[doc = "Resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "The geo-location where the resource lives"] + pub location: String, +} +impl TrackedResource { + pub fn new(location: String) -> Self { + Self { + resource: Resource::default(), + tags: None, + location, + } + } +} +#[doc = "A data flow transformation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Transformation { + #[doc = "Transformation name."] + pub name: String, + #[doc = "Transformation description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Dataset reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dataset: Option, + #[doc = "Linked service reference type."] + #[serde(rename = "linkedService", default, skip_serializing_if = "Option::is_none")] + pub linked_service: Option, + #[doc = "Data flow reference type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub flowlet: Option, +} +impl Transformation { + pub fn new(name: String) -> Self { + Self { + name, + description: None, + dataset: None, + linked_service: None, + flowlet: None, + } + } +} +#[doc = "Azure Synapse nested object which contains information about creating pipeline run"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Trigger { + #[doc = "Trigger type."] + #[serde(rename = "type")] + pub type_: String, + #[doc = "Trigger description."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[doc = "Enumerates possible state of Triggers."] + #[serde(rename = "runtimeState", default, skip_serializing_if = "Option::is_none")] + pub runtime_state: Option, + #[doc = "List of tags that can be used for describing the trigger."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub annotations: Vec, +} +impl Trigger { + pub fn new(type_: String) -> Self { + Self { + type_, + description: None, + runtime_state: None, + annotations: Vec::new(), + } + } +} +#[doc = "Defines the response of a provision trigger dependency operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerDependencyProvisioningStatus { + #[doc = "Trigger name."] + #[serde(rename = "triggerName")] + pub trigger_name: String, + #[doc = "Provisioning status."] + #[serde(rename = "provisioningStatus")] + pub provisioning_status: String, +} +impl TriggerDependencyProvisioningStatus { + pub fn new(trigger_name: String, provisioning_status: String) -> Self { + Self { + trigger_name, + provisioning_status, + } + } +} +#[doc = "Trigger referenced dependency."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerDependencyReference { + #[serde(flatten)] + pub dependency_reference: DependencyReference, + #[doc = "Trigger reference type."] + #[serde(rename = "referenceTrigger")] + pub reference_trigger: TriggerReference, +} +impl TriggerDependencyReference { + pub fn new(dependency_reference: DependencyReference, reference_trigger: TriggerReference) -> Self { + Self { + dependency_reference, + reference_trigger, + } + } +} +#[doc = "A list of trigger resources."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerListResponse { + #[doc = "List of triggers."] + pub value: Vec, + #[doc = "The link to the next page of results, if any remaining results exist."] + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +impl TriggerListResponse { + pub fn new(value: Vec) -> Self { + Self { value, next_link: None } + } +} +#[doc = "Pipeline that needs to be triggered with the given parameters."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerPipelineReference { + #[doc = "Pipeline reference type."] + #[serde(rename = "pipelineReference", default, skip_serializing_if = "Option::is_none")] + pub pipeline_reference: Option, + #[doc = "An object mapping parameter names to argument values."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parameters: Option, +} +impl TriggerPipelineReference { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Trigger reference type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerReference { + #[doc = "Trigger reference type."] + #[serde(rename = "type")] + pub type_: trigger_reference::Type, + #[doc = "Reference trigger name."] + #[serde(rename = "referenceName")] + pub reference_name: String, +} +impl TriggerReference { + pub fn new(type_: trigger_reference::Type, reference_name: String) -> Self { + Self { type_, reference_name } + } +} +pub mod trigger_reference { + use super::*; + #[doc = "Trigger reference type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + TriggerReference, + } +} +#[doc = "Trigger resource type."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerResource { + #[serde(flatten)] + pub sub_resource: SubResource, + #[doc = "Azure Synapse nested object which contains information about creating pipeline run"] + pub properties: Trigger, +} +impl TriggerResource { + pub fn new(properties: Trigger) -> Self { + Self { + sub_resource: SubResource::default(), + properties, + } + } +} +#[doc = "Trigger runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerRun { + #[doc = "Trigger run id."] + #[serde(rename = "triggerRunId", default, skip_serializing_if = "Option::is_none")] + pub trigger_run_id: Option, + #[doc = "Trigger name."] + #[serde(rename = "triggerName", default, skip_serializing_if = "Option::is_none")] + pub trigger_name: Option, + #[doc = "Trigger type."] + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[doc = "Trigger run start time."] + #[serde(rename = "triggerRunTimestamp", default, skip_serializing_if = "Option::is_none")] + pub trigger_run_timestamp: Option, + #[doc = "Trigger run status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[doc = "Trigger error message."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "List of property name and value related to trigger run. Name, value pair depends on type of trigger."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "List of pipeline name and run Id triggered by the trigger run."] + #[serde(rename = "triggeredPipelines", default, skip_serializing_if = "Option::is_none")] + pub triggered_pipelines: Option, +} +impl TriggerRun { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_run { + use super::*; + #[doc = "Trigger run status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Succeeded, + Failed, + Inprogress, + } +} +#[doc = "A list of trigger runs."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TriggerRunsQueryResponse { + #[doc = "List of trigger runs."] + pub value: Vec, + #[doc = "The continuation token for getting the next page of results, if any remaining results exist, null otherwise."] + #[serde(rename = "continuationToken", default, skip_serializing_if = "Option::is_none")] + pub continuation_token: Option, +} +impl TriggerRunsQueryResponse { + pub fn new(value: Vec) -> Self { + Self { + value, + continuation_token: None, + } + } +} +#[doc = "Enumerates possible state of Triggers."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TriggerRuntimeState { + Started, + Stopped, + Disabled, +} +#[doc = "Defines the response of a trigger subscription operation."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TriggerSubscriptionOperationStatus { + #[doc = "Trigger name."] + #[serde(rename = "triggerName", default, skip_serializing_if = "Option::is_none")] + pub trigger_name: Option, + #[doc = "Event Subscription Status."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl TriggerSubscriptionOperationStatus { + pub fn new() -> Self { + Self::default() + } +} +pub mod trigger_subscription_operation_status { + use super::*; + #[doc = "Event Subscription Status."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Enabled, + Provisioning, + Deprovisioning, + Disabled, + Unknown, + } +} +#[doc = "Enumerates possible frequency option for the tumbling window trigger."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum TumblingWindowFrequency { + Minute, + Hour, + Month, +} +#[doc = "Trigger that schedules pipeline runs for all fixed time interval windows from a start time without gaps and also supports backfill scenarios (when start time is in the past)."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TumblingWindowTrigger { + #[serde(flatten)] + pub trigger: Trigger, + #[doc = "Pipeline that needs to be triggered with the given parameters."] + pub pipeline: TriggerPipelineReference, + #[doc = "Tumbling Window Trigger properties."] + #[serde(rename = "typeProperties")] + pub type_properties: tumbling_window_trigger::TypeProperties, +} +impl TumblingWindowTrigger { + pub fn new(trigger: Trigger, pipeline: TriggerPipelineReference, type_properties: tumbling_window_trigger::TypeProperties) -> Self { + Self { + trigger, + pipeline, + type_properties, + } + } +} +pub mod tumbling_window_trigger { + use super::*; + #[doc = "Tumbling Window Trigger properties."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct TypeProperties { + #[doc = "Enumerates possible frequency option for the tumbling window trigger."] + pub frequency: TumblingWindowFrequency, + #[doc = "The interval of the time windows. The minimum interval allowed is 15 Minutes."] + pub interval: i32, + #[doc = "The start time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported."] + #[serde(rename = "startTime")] + pub start_time: String, + #[doc = "The end time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported."] + #[serde(rename = "endTime", default, skip_serializing_if = "Option::is_none")] + pub end_time: Option, + #[doc = "Specifies how long the trigger waits past due time before triggering new run. It doesn't alter window start and end time. The default is 0. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub delay: Option, + #[doc = "The max number of parallel time windows (ready for execution) for which a new run is triggered."] + #[serde(rename = "maxConcurrency")] + pub max_concurrency: i64, + #[doc = "Execution policy for an activity."] + #[serde(rename = "retryPolicy", default, skip_serializing_if = "Option::is_none")] + pub retry_policy: Option, + #[doc = "Triggers that this trigger depends on. Only tumbling window triggers are supported."] + #[serde(rename = "dependsOn", default, skip_serializing_if = "Vec::is_empty")] + pub depends_on: Vec, + } + impl TypeProperties { + pub fn new(frequency: TumblingWindowFrequency, interval: i32, start_time: String, max_concurrency: i64) -> Self { + Self { + frequency, + interval, + start_time, + end_time: None, + delay: None, + max_concurrency, + retry_policy: None, + depends_on: Vec::new(), + } + } + } +} +#[doc = "Referenced tumbling window trigger dependency."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TumblingWindowTriggerDependencyReference { + #[serde(flatten)] + pub trigger_dependency_reference: TriggerDependencyReference, + #[doc = "Timespan applied to the start time of a tumbling window when evaluating dependency."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub offset: Option, + #[doc = "The size of the window when evaluating the dependency. If undefined the frequency of the tumbling window will be used."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub size: Option, +} +impl TumblingWindowTriggerDependencyReference { + pub fn new(trigger_dependency_reference: TriggerDependencyReference) -> Self { + Self { + trigger_dependency_reference, + offset: None, + size: None, + } + } +} +#[doc = "Linked service for Twilio."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Twilio linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: TwilioLinkedServiceTypeProperties, +} +impl TwilioLinkedService { + pub fn new(linked_service: LinkedService, type_properties: TwilioLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Twilio linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwilioLinkedServiceTypeProperties { + #[doc = "The Account SID of Twilio service."] + #[serde(rename = "userName")] + pub user_name: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl TwilioLinkedServiceTypeProperties { + pub fn new(user_name: serde_json::Value, password: SecretBase) -> Self { + Self { user_name, password } + } +} +#[doc = "Type conversion settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct TypeConversionSettings { + #[doc = "Whether to allow data truncation when converting the data. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "allowDataTruncation", default, skip_serializing_if = "Option::is_none")] + pub allow_data_truncation: Option, + #[doc = "Whether to treat boolean values as numbers. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "treatBooleanAsNumber", default, skip_serializing_if = "Option::is_none")] + pub treat_boolean_as_number: Option, + #[doc = "The format for DateTime values. Type: string (or Expression with resultType string)."] + #[serde(rename = "dateTimeFormat", default, skip_serializing_if = "Option::is_none")] + pub date_time_format: Option, + #[doc = "The format for DateTimeOffset values. Type: string (or Expression with resultType string)."] + #[serde(rename = "dateTimeOffsetFormat", default, skip_serializing_if = "Option::is_none")] + pub date_time_offset_format: Option, + #[doc = "The format for TimeSpan values. Type: string (or Expression with resultType string)."] + #[serde(rename = "timeSpanFormat", default, skip_serializing_if = "Option::is_none")] + pub time_span_format: Option, + #[doc = "The culture used to convert data from/to string. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub culture: Option, +} +impl TypeConversionSettings { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This activity executes inner activities until the specified boolean expression results to true or timeout is reached, whichever is earlier."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UntilActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Until activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: UntilActivityTypeProperties, +} +impl UntilActivity { + pub fn new(control_activity: ControlActivity, type_properties: UntilActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Until activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UntilActivityTypeProperties { + #[doc = "Azure Synapse expression definition."] + pub expression: Expression, + #[doc = "Specifies the timeout for the activity to run. If there is no value specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "List of activities to execute."] + pub activities: Vec, +} +impl UntilActivityTypeProperties { + pub fn new(expression: Expression, activities: Vec) -> Self { + Self { + expression, + timeout: None, + activities, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct UpdateLandingZoneCredential { + #[doc = "Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls."] + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, +} +impl UpdateLandingZoneCredential { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "User property."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserProperty { + #[doc = "User property name."] + pub name: String, + #[doc = "User property value. Type: string (or Expression with resultType string)."] + pub value: serde_json::Value, +} +impl UserProperty { + pub fn new(name: String, value: serde_json::Value) -> Self { + Self { name, value } + } +} +#[doc = "This activity verifies that an external resource exists."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Validation activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ValidationActivityTypeProperties, +} +impl ValidationActivity { + pub fn new(control_activity: ControlActivity, type_properties: ValidationActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Validation activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ValidationActivityTypeProperties { + #[doc = "Specifies the timeout for the activity to run. If there is no value specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType string), pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "A delay in seconds between validation attempts. If no value is specified, 10 seconds will be used as the default. Type: integer (or Expression with resultType integer)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sleep: Option, + #[doc = "Can be used if dataset points to a file. The file must be greater than or equal in size to the value specified. Type: integer (or Expression with resultType integer)."] + #[serde(rename = "minimumSize", default, skip_serializing_if = "Option::is_none")] + pub minimum_size: Option, + #[doc = "Can be used if dataset points to a folder. If set to true, the folder must have at least one file. If set to false, the folder must be empty. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "childItems", default, skip_serializing_if = "Option::is_none")] + pub child_items: Option, + #[doc = "Dataset reference type."] + pub dataset: DatasetReference, +} +impl ValidationActivityTypeProperties { + pub fn new(dataset: DatasetReference) -> Self { + Self { + timeout: None, + sleep: None, + minimum_size: None, + child_items: None, + dataset, + } + } +} +#[doc = "Definition of variable for a Pipeline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VariableDefinitionSpecification {} +impl VariableDefinitionSpecification { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Definition of a single variable for a Pipeline."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VariableSpecification { + #[doc = "Variable type."] + #[serde(rename = "type")] + pub type_: variable_specification::Type, + #[doc = "Default value of variable."] + #[serde(rename = "defaultValue", default, skip_serializing_if = "Option::is_none")] + pub default_value: Option, +} +impl VariableSpecification { + pub fn new(type_: variable_specification::Type) -> Self { + Self { + type_, + default_value: None, + } + } +} +pub mod variable_specification { + use super::*; + #[doc = "Variable type."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + String, + Bool, + Boolean, + Array, + } +} +#[doc = "Vertica Properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VerticaDatasetTypeProperties { + #[doc = "This property will be retired. Please consider using schema + table properties instead."] + #[serde(rename = "tableName", default, skip_serializing_if = "Option::is_none")] + pub table_name: Option, + #[doc = "The table name of the Vertica. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub table: Option, + #[doc = "The schema name of the Vertica. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, +} +impl VerticaDatasetTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Vertica linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VerticaLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Vertica linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: VerticaLinkedServiceTypeProperties, +} +impl VerticaLinkedService { + pub fn new(linked_service: LinkedService, type_properties: VerticaLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Vertica linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VerticaLinkedServiceTypeProperties { + #[doc = "An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference."] + #[serde(rename = "connectionString", default, skip_serializing_if = "Option::is_none")] + pub connection_string: Option, + #[doc = "Azure Key Vault secret reference."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pwd: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl VerticaLinkedServiceTypeProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "A copy activity Vertica source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VerticaSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl VerticaSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Vertica dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VerticaTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Vertica Properties"] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl VerticaTableDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Virtual Network Profile"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct VirtualNetworkProfile { + #[doc = "Subnet ID used for computes in workspace"] + #[serde(rename = "computeSubnetId", default, skip_serializing_if = "Option::is_none")] + pub compute_subnet_id: Option, +} +impl VirtualNetworkProfile { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "This activity suspends pipeline execution for the specified interval."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WaitActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "Wait activity properties."] + #[serde(rename = "typeProperties")] + pub type_properties: WaitActivityTypeProperties, +} +impl WaitActivity { + pub fn new(control_activity: ControlActivity, type_properties: WaitActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "Wait activity properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WaitActivityTypeProperties { + #[doc = "Duration in seconds."] + #[serde(rename = "waitTimeInSeconds")] + pub wait_time_in_seconds: serde_json::Value, +} +impl WaitActivityTypeProperties { + pub fn new(wait_time_in_seconds: serde_json::Value) -> Self { + Self { wait_time_in_seconds } + } +} +#[doc = "Web activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebActivity { + #[serde(flatten)] + pub execution_activity: ExecutionActivity, + #[doc = "Web activity type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: WebActivityTypeProperties, +} +impl WebActivity { + pub fn new(execution_activity: ExecutionActivity, type_properties: WebActivityTypeProperties) -> Self { + Self { + execution_activity, + type_properties, + } + } +} +#[doc = "Web activity authentication properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebActivityAuthentication { + #[doc = "Web activity authentication (Basic/ClientCertificate/MSI)"] + #[serde(rename = "type")] + pub type_: String, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pfx: Option, + #[doc = "Web activity authentication user name for basic authentication."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub username: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "Resource for which Azure Auth token will be requested when using MSI Authentication."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +impl WebActivityAuthentication { + pub fn new(type_: String) -> Self { + Self { + type_, + pfx: None, + username: None, + password: None, + resource: None, + } + } +} +#[doc = "The list of HTTP methods supported by a WebActivity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WebActivityMethod { + #[serde(rename = "GET")] + Get, + #[serde(rename = "POST")] + Post, + #[serde(rename = "PUT")] + Put, + #[serde(rename = "DELETE")] + Delete, +} +#[doc = "Web activity type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebActivityTypeProperties { + #[doc = "The list of HTTP methods supported by a WebActivity."] + pub method: WebActivityMethod, + #[doc = "Web activity target endpoint and path. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "Represents the headers that will be sent to the request. For example, to set the language and type on a request: \"headers\" : { \"Accept-Language\": \"en-us\", \"Content-Type\": \"application/json\" }. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[doc = "Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[doc = "Web activity authentication properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authentication: Option, + #[doc = "List of datasets passed to web endpoint."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub datasets: Vec, + #[doc = "List of linked services passed to web endpoint."] + #[serde(rename = "linkedServices", default, skip_serializing_if = "Vec::is_empty")] + pub linked_services: Vec, + #[doc = "Integration runtime reference type."] + #[serde(rename = "connectVia", default, skip_serializing_if = "Option::is_none")] + pub connect_via: Option, +} +impl WebActivityTypeProperties { + pub fn new(method: WebActivityMethod, url: serde_json::Value) -> Self { + Self { + method, + url, + headers: None, + body: None, + authentication: None, + datasets: Vec::new(), + linked_services: Vec::new(), + connect_via: None, + } + } +} +#[doc = "A WebLinkedService that uses anonymous authentication to communicate with an HTTP endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebAnonymousAuthentication { + #[serde(flatten)] + pub web_linked_service_type_properties: WebLinkedServiceTypeProperties, +} +impl WebAnonymousAuthentication { + pub fn new(web_linked_service_type_properties: WebLinkedServiceTypeProperties) -> Self { + Self { + web_linked_service_type_properties, + } + } +} +#[doc = "A WebLinkedService that uses basic authentication to communicate with an HTTP endpoint."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebBasicAuthentication { + #[serde(flatten)] + pub web_linked_service_type_properties: WebLinkedServiceTypeProperties, + #[doc = "User name for Basic authentication. Type: string (or Expression with resultType string)."] + pub username: serde_json::Value, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl WebBasicAuthentication { + pub fn new( + web_linked_service_type_properties: WebLinkedServiceTypeProperties, + username: serde_json::Value, + password: SecretBase, + ) -> Self { + Self { + web_linked_service_type_properties, + username, + password, + } + } +} +#[doc = "A WebLinkedService that uses client certificate based authentication to communicate with an HTTP endpoint. This scheme follows mutual authentication; the server must also provide valid credentials to the client."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebClientCertificateAuthentication { + #[serde(flatten)] + pub web_linked_service_type_properties: WebLinkedServiceTypeProperties, + #[doc = "The base definition of a secret type."] + pub pfx: SecretBase, + #[doc = "The base definition of a secret type."] + pub password: SecretBase, +} +impl WebClientCertificateAuthentication { + pub fn new(web_linked_service_type_properties: WebLinkedServiceTypeProperties, pfx: SecretBase, password: SecretBase) -> Self { + Self { + web_linked_service_type_properties, + pfx, + password, + } + } +} +#[doc = "WebHook activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebHookActivity { + #[serde(flatten)] + pub control_activity: ControlActivity, + #[doc = "WebHook activity type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: WebHookActivityTypeProperties, +} +impl WebHookActivity { + pub fn new(control_activity: ControlActivity, type_properties: WebHookActivityTypeProperties) -> Self { + Self { + control_activity, + type_properties, + } + } +} +#[doc = "The list of HTTP methods supported by a WebHook activity."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum WebHookActivityMethod { + #[serde(rename = "POST")] + Post, +} +#[doc = "WebHook activity type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebHookActivityTypeProperties { + #[doc = "The list of HTTP methods supported by a WebHook activity."] + pub method: WebHookActivityMethod, + #[doc = "WebHook activity target endpoint and path. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The timeout within which the webhook should be called back. If there is no value specified, it defaults to 10 minutes. Type: string. Pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9]))."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[doc = "Represents the headers that will be sent to the request. For example, to set the language and type on a request: \"headers\" : { \"Accept-Language\": \"en-us\", \"Content-Type\": \"application/json\" }. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub headers: Option, + #[doc = "Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[doc = "Web activity authentication properties."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub authentication: Option, + #[doc = "When set to true, statusCode, output and error in callback request body will be consumed by activity. The activity can be marked as failed by setting statusCode >= 400 in callback request. Default is false. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "reportStatusOnCallBack", default, skip_serializing_if = "Option::is_none")] + pub report_status_on_call_back: Option, +} +impl WebHookActivityTypeProperties { + pub fn new(method: WebHookActivityMethod, url: serde_json::Value) -> Self { + Self { + method, + url, + timeout: None, + headers: None, + body: None, + authentication: None, + report_status_on_call_back: None, + } + } +} +#[doc = "Web linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Base definition of WebLinkedServiceTypeProperties, this typeProperties is polymorphic based on authenticationType, so not flattened in SDK models."] + #[serde(rename = "typeProperties")] + pub type_properties: WebLinkedServiceTypeProperties, +} +impl WebLinkedService { + pub fn new(linked_service: LinkedService, type_properties: WebLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Base definition of WebLinkedServiceTypeProperties, this typeProperties is polymorphic based on authenticationType, so not flattened in SDK models."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebLinkedServiceTypeProperties { + #[doc = "The URL of the web service endpoint, e.g. http://www.microsoft.com . Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "Type of authentication used to connect to the web table source."] + #[serde(rename = "authenticationType")] + pub authentication_type: web_linked_service_type_properties::AuthenticationType, +} +impl WebLinkedServiceTypeProperties { + pub fn new(url: serde_json::Value, authentication_type: web_linked_service_type_properties::AuthenticationType) -> Self { + Self { url, authentication_type } + } +} +pub mod web_linked_service_type_properties { + use super::*; + #[doc = "Type of authentication used to connect to the web table source."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Anonymous, + ClientCertificate, + } +} +#[doc = "A copy activity source for web page table."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl WebSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + additional_columns: None, + } + } +} +#[doc = "The dataset points to a HTML table in the web page."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebTableDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Web table dataset properties."] + #[serde(rename = "typeProperties")] + pub type_properties: WebTableDatasetTypeProperties, +} +impl WebTableDataset { + pub fn new(dataset: Dataset, type_properties: WebTableDatasetTypeProperties) -> Self { + Self { dataset, type_properties } + } +} +#[doc = "Web table dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WebTableDatasetTypeProperties { + #[doc = "The zero-based index of the table in the web page. Type: integer (or Expression with resultType integer), minimum: 0."] + pub index: serde_json::Value, + #[doc = "The relative URL to the web page from the linked service URL. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +impl WebTableDatasetTypeProperties { + pub fn new(index: serde_json::Value) -> Self { + Self { index, path: None } + } +} +#[doc = "A workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Workspace { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[doc = "Workspace properties"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[doc = "The workspace managed identity"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl Workspace { + pub fn new(tracked_resource: TrackedResource) -> Self { + Self { + tracked_resource, + properties: None, + identity: None, + } + } +} +#[doc = "Identity properties of the workspace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct WorkspaceIdentity { + #[doc = "The identity type. Currently the only supported type is 'SystemAssigned'."] + #[serde(rename = "type")] + pub type_: workspace_identity::Type, + #[doc = "The principal id of the identity."] + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, + #[doc = "The client tenant id of the identity."] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} +impl WorkspaceIdentity { + pub fn new(type_: workspace_identity::Type) -> Self { + Self { + type_, + principal_id: None, + tenant_id: None, + } + } +} +pub mod workspace_identity { + use super::*; + #[doc = "The identity type. Currently the only supported type is 'SystemAssigned'."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } +} +#[doc = "Details of the customer managed key associated with the workspace"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceKeyDetails { + #[doc = "Workspace Key sub-resource name"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[doc = "Workspace Key sub-resource key vault url"] + #[serde(rename = "keyVaultUrl", default, skip_serializing_if = "Option::is_none")] + pub key_vault_url: Option, +} +impl WorkspaceKeyDetails { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Workspace properties"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceProperties { + #[doc = "Details of the data lake storage account associated with the workspace"] + #[serde(rename = "defaultDataLakeStorage", default, skip_serializing_if = "Option::is_none")] + pub default_data_lake_storage: Option, + #[doc = "SQL administrator login password"] + #[serde(rename = "sqlAdministratorLoginPassword", default, skip_serializing_if = "Option::is_none")] + pub sql_administrator_login_password: Option, + #[doc = "Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.'"] + #[serde(rename = "managedResourceGroupName", default, skip_serializing_if = "Option::is_none")] + pub managed_resource_group_name: Option, + #[doc = "Resource provisioning state"] + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[doc = "Login for workspace SQL active directory administrator"] + #[serde(rename = "sqlAdministratorLogin", default, skip_serializing_if = "Option::is_none")] + pub sql_administrator_login: Option, + #[doc = "Virtual Network Profile"] + #[serde(rename = "virtualNetworkProfile", default, skip_serializing_if = "Option::is_none")] + pub virtual_network_profile: Option, + #[doc = "Connectivity endpoints"] + #[serde(rename = "connectivityEndpoints", default, skip_serializing_if = "Option::is_none")] + pub connectivity_endpoints: Option, + #[doc = "Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user."] + #[serde(rename = "managedVirtualNetwork", default, skip_serializing_if = "Option::is_none")] + pub managed_virtual_network: Option, + #[doc = "Private endpoint connections to the workspace"] + #[serde(rename = "privateEndpointConnections", default, skip_serializing_if = "Vec::is_empty")] + pub private_endpoint_connections: Vec, + #[doc = "Details of the encryption associated with the workspace"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub encryption: Option, + #[doc = "The workspace unique identifier"] + #[serde(rename = "workspaceUID", default, skip_serializing_if = "Option::is_none")] + pub workspace_uid: Option, + #[doc = "Workspace level configs and feature flags"] + #[serde(rename = "extraProperties", default, skip_serializing_if = "Option::is_none")] + pub extra_properties: Option, + #[doc = "Managed Virtual Network Settings"] + #[serde(rename = "managedVirtualNetworkSettings", default, skip_serializing_if = "Option::is_none")] + pub managed_virtual_network_settings: Option, + #[doc = "Git integration settings"] + #[serde(rename = "workspaceRepositoryConfiguration", default, skip_serializing_if = "Option::is_none")] + pub workspace_repository_configuration: Option, + #[doc = "Purview Configuration"] + #[serde(rename = "purviewConfiguration", default, skip_serializing_if = "Option::is_none")] + pub purview_configuration: Option, + #[doc = "The ADLA resource ID."] + #[serde(rename = "adlaResourceId", default, skip_serializing_if = "Option::is_none")] + pub adla_resource_id: Option, +} +impl WorkspaceProperties { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Git integration settings"] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceRepositoryConfiguration { + #[doc = "Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration"] + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[doc = "GitHub Enterprise host name. For example: https://github.mydomain.com"] + #[serde(rename = "hostName", default, skip_serializing_if = "Option::is_none")] + pub host_name: Option, + #[doc = "Account name"] + #[serde(rename = "accountName", default, skip_serializing_if = "Option::is_none")] + pub account_name: Option, + #[doc = "VSTS project name"] + #[serde(rename = "projectName", default, skip_serializing_if = "Option::is_none")] + pub project_name: Option, + #[doc = "Repository name"] + #[serde(rename = "repositoryName", default, skip_serializing_if = "Option::is_none")] + pub repository_name: Option, + #[doc = "Collaboration branch"] + #[serde(rename = "collaborationBranch", default, skip_serializing_if = "Option::is_none")] + pub collaboration_branch: Option, + #[doc = "Root folder to use in the repository"] + #[serde(rename = "rootFolder", default, skip_serializing_if = "Option::is_none")] + pub root_folder: Option, + #[doc = "The last commit ID"] + #[serde(rename = "lastCommitId", default, skip_serializing_if = "Option::is_none")] + pub last_commit_id: Option, + #[doc = "The VSTS tenant ID"] + #[serde(rename = "tenantId", default, skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[doc = "GitHub bring your own app client id"] + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[doc = "Client secret information for factory's bring your own app repository configuration"] + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, +} +impl WorkspaceRepositoryConfiguration { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Parameters for updating a workspace resource."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct WorkspaceUpdateParameters { + #[doc = "The resource tags."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[doc = "Identity properties of the workspace resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, +} +impl WorkspaceUpdateParameters { + pub fn new() -> Self { + Self::default() + } +} +#[doc = "Xero Service linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XeroLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Xero Service linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: XeroLinkedServiceTypeProperties, +} +impl XeroLinkedService { + pub fn new(linked_service: LinkedService, type_properties: XeroLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Xero Service linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XeroLinkedServiceTypeProperties { + #[doc = "Properties used to connect to Xero. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The endpoint of the Xero server. (i.e. api.xero.com)"] + pub host: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "consumerKey", default, skip_serializing_if = "Option::is_none")] + pub consumer_key: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "privateKey", default, skip_serializing_if = "Option::is_none")] + pub private_key: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl XeroLinkedServiceTypeProperties { + pub fn new(host: serde_json::Value) -> Self { + Self { + connection_properties: None, + host, + consumer_key: None, + private_key: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Xero Service dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XeroObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl XeroObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Xero Service source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XeroSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl XeroSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[doc = "Xml dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XmlDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Xml dataset properties."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl XmlDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "Xml dataset properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XmlDatasetTypeProperties { + #[doc = "Dataset location."] + pub location: DatasetLocation, + #[doc = "The code page name of the preferred encoding. If not specified, the default value is UTF-8, unless BOM denotes another Unicode encoding. Refer to the name column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string)."] + #[serde(rename = "encodingName", default, skip_serializing_if = "Option::is_none")] + pub encoding_name: Option, + #[doc = "The null value string. Type: string (or Expression with resultType string)."] + #[serde(rename = "nullValue", default, skip_serializing_if = "Option::is_none")] + pub null_value: Option, + #[doc = "The compression method used on a dataset."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub compression: Option, +} +impl XmlDatasetTypeProperties { + pub fn new(location: DatasetLocation) -> Self { + Self { + location, + encoding_name: None, + null_value: None, + compression: None, + } + } +} +#[doc = "Xml read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XmlReadSettings { + #[serde(flatten)] + pub format_read_settings: FormatReadSettings, + #[doc = "Compression read settings."] + #[serde(rename = "compressionProperties", default, skip_serializing_if = "Option::is_none")] + pub compression_properties: Option, + #[doc = "Indicates what validation method is used when reading the xml files. Allowed values: 'none', 'xsd', or 'dtd'. Type: string (or Expression with resultType string)."] + #[serde(rename = "validationMode", default, skip_serializing_if = "Option::is_none")] + pub validation_mode: Option, + #[doc = "Indicates whether type detection is enabled when reading the xml files. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "detectDataType", default, skip_serializing_if = "Option::is_none")] + pub detect_data_type: Option, + #[doc = "Indicates whether namespace is enabled when reading the xml files. Type: boolean (or Expression with resultType boolean)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespaces: Option, + #[doc = "Namespace uri to prefix mappings to override the prefixes in column names when namespace is enabled, if no prefix is defined for a namespace uri, the prefix of xml element/attribute name in the xml data file will be used. Example: \"{\"http://www.example.com/xml\":\"prefix\"}\" Type: object (or Expression with resultType object)."] + #[serde(rename = "namespacePrefixes", default, skip_serializing_if = "Option::is_none")] + pub namespace_prefixes: Option, +} +impl XmlReadSettings { + pub fn new(format_read_settings: FormatReadSettings) -> Self { + Self { + format_read_settings, + compression_properties: None, + validation_mode: None, + detect_data_type: None, + namespaces: None, + namespace_prefixes: None, + } + } +} +#[doc = "A copy activity Xml source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct XmlSource { + #[serde(flatten)] + pub copy_source: CopySource, + #[doc = "Connector read setting."] + #[serde(rename = "storeSettings", default, skip_serializing_if = "Option::is_none")] + pub store_settings: Option, + #[doc = "Xml read settings."] + #[serde(rename = "formatSettings", default, skip_serializing_if = "Option::is_none")] + pub format_settings: Option, + #[doc = "Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects)."] + #[serde(rename = "additionalColumns", default, skip_serializing_if = "Option::is_none")] + pub additional_columns: Option, +} +impl XmlSource { + pub fn new(copy_source: CopySource) -> Self { + Self { + copy_source, + store_settings: None, + format_settings: None, + additional_columns: None, + } + } +} +#[doc = "Linked service for Zendesk."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZendeskLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Zendesk linked service type properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ZendeskLinkedServiceTypeProperties, +} +impl ZendeskLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ZendeskLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Zendesk linked service type properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZendeskLinkedServiceTypeProperties { + #[doc = "The authentication type to use."] + #[serde(rename = "authenticationType")] + pub authentication_type: zendesk_linked_service_type_properties::AuthenticationType, + #[doc = "The url to connect Zendesk source. Type: string (or Expression with resultType string)."] + pub url: serde_json::Value, + #[doc = "The username of the Zendesk source. Type: string (or Expression with resultType string)."] + #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")] + pub user_name: Option, + #[doc = "The base definition of a secret type."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub password: Option, + #[doc = "The base definition of a secret type."] + #[serde(rename = "apiToken", default, skip_serializing_if = "Option::is_none")] + pub api_token: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ZendeskLinkedServiceTypeProperties { + pub fn new(authentication_type: zendesk_linked_service_type_properties::AuthenticationType, url: serde_json::Value) -> Self { + Self { + authentication_type, + url, + user_name: None, + password: None, + api_token: None, + encrypted_credential: None, + } + } +} +pub mod zendesk_linked_service_type_properties { + use super::*; + #[doc = "The authentication type to use."] + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum AuthenticationType { + Basic, + Token, + } +} +#[doc = "The ZipDeflate compression read settings."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZipDeflateReadSettings { + #[serde(flatten)] + pub compression_read_settings: CompressionReadSettings, + #[doc = "Preserve the zip file name as folder path. Type: boolean (or Expression with resultType boolean)."] + #[serde(rename = "preserveZipFileNameAsFolder", default, skip_serializing_if = "Option::is_none")] + pub preserve_zip_file_name_as_folder: Option, +} +impl ZipDeflateReadSettings { + pub fn new(compression_read_settings: CompressionReadSettings) -> Self { + Self { + compression_read_settings, + preserve_zip_file_name_as_folder: None, + } + } +} +#[doc = "Zoho server linked service."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZohoLinkedService { + #[serde(flatten)] + pub linked_service: LinkedService, + #[doc = "Zoho server linked service properties."] + #[serde(rename = "typeProperties")] + pub type_properties: ZohoLinkedServiceTypeProperties, +} +impl ZohoLinkedService { + pub fn new(linked_service: LinkedService, type_properties: ZohoLinkedServiceTypeProperties) -> Self { + Self { + linked_service, + type_properties, + } + } +} +#[doc = "Zoho server linked service properties."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZohoLinkedServiceTypeProperties { + #[doc = "Properties used to connect to Zoho. It is mutually exclusive with any other properties in the linked service. Type: object."] + #[serde(rename = "connectionProperties", default, skip_serializing_if = "Option::is_none")] + pub connection_properties: Option, + #[doc = "The endpoint of the Zoho server. (i.e. crm.zoho.com/crm/private)"] + pub endpoint: serde_json::Value, + #[doc = "The base definition of a secret type."] + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[doc = "Specifies whether the data source endpoints are encrypted using HTTPS. The default value is true."] + #[serde(rename = "useEncryptedEndpoints", default, skip_serializing_if = "Option::is_none")] + pub use_encrypted_endpoints: Option, + #[doc = "Specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true."] + #[serde(rename = "useHostVerification", default, skip_serializing_if = "Option::is_none")] + pub use_host_verification: Option, + #[doc = "Specifies whether to verify the identity of the server when connecting over SSL. The default value is true."] + #[serde(rename = "usePeerVerification", default, skip_serializing_if = "Option::is_none")] + pub use_peer_verification: Option, + #[doc = "The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string)."] + #[serde(rename = "encryptedCredential", default, skip_serializing_if = "Option::is_none")] + pub encrypted_credential: Option, +} +impl ZohoLinkedServiceTypeProperties { + pub fn new(endpoint: serde_json::Value) -> Self { + Self { + connection_properties: None, + endpoint, + access_token: None, + use_encrypted_endpoints: None, + use_host_verification: None, + use_peer_verification: None, + encrypted_credential: None, + } + } +} +#[doc = "Zoho server dataset."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZohoObjectDataset { + #[serde(flatten)] + pub dataset: Dataset, + #[doc = "Properties specific to this dataset type."] + #[serde(rename = "typeProperties", default, skip_serializing_if = "Option::is_none")] + pub type_properties: Option, +} +impl ZohoObjectDataset { + pub fn new(dataset: Dataset) -> Self { + Self { + dataset, + type_properties: None, + } + } +} +#[doc = "A copy activity Zoho server source."] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ZohoSource { + #[serde(flatten)] + pub tabular_source: TabularSource, + #[doc = "A query to retrieve data from source. Type: string (or Expression with resultType string)."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, +} +impl ZohoSource { + pub fn new(tabular_source: TabularSource) -> Self { + Self { + tabular_source, + query: None, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetastoreRegisterObject { + #[doc = "The input folder containing CDM files."] + #[serde(rename = "inputFolder")] + pub input_folder: String, +} +impl MetastoreRegisterObject { + pub fn new(input_folder: String) -> Self { + Self { input_folder } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetastoreRegistrationResponse { + #[doc = "Enumerates possible request statuses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl MetastoreRegistrationResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetastoreRequestSuccessResponse { + #[doc = "Enumerates possible Status of the resource."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl MetastoreRequestSuccessResponse { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetastoreUpdateObject { + #[doc = "The input folder containing CDM files."] + #[serde(rename = "inputFolder")] + pub input_folder: String, +} +impl MetastoreUpdateObject { + pub fn new(input_folder: String) -> Self { + Self { input_folder } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)] +pub struct MetastoreUpdationResponse { + #[doc = "Enumerates possible request statuses."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +impl MetastoreUpdationResponse { + pub fn new() -> Self { + Self::default() + } +} diff --git a/services/svc/synapse/src/package_artifacts_composite_v4/operations.rs b/services/svc/synapse/src/package_artifacts_composite_v4/operations.rs new file mode 100644 index 0000000000..ab554c2383 --- /dev/null +++ b/services/svc/synapse/src/package_artifacts_composite_v4/operations.rs @@ -0,0 +1,8687 @@ +#![doc = "generated by AutoRust"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use super::models; +#[derive(Clone)] +pub struct Client { + endpoint: String, + credential: std::sync::Arc, + scopes: Vec, + pipeline: azure_core::Pipeline, +} +#[derive(Clone)] +pub struct ClientBuilder { + credential: std::sync::Arc, + endpoint: Option, + scopes: Option>, +} +pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD; +impl ClientBuilder { + pub fn new(credential: std::sync::Arc) -> Self { + Self { + credential, + endpoint: None, + scopes: None, + } + } + pub fn endpoint(mut self, endpoint: impl Into) -> Self { + self.endpoint = Some(endpoint.into()); + self + } + pub fn scopes(mut self, scopes: &[&str]) -> Self { + self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); + self + } + pub fn build(self) -> Client { + let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); + let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]); + Client::new(endpoint, self.credential, scopes) + } +} +impl Client { + pub(crate) fn endpoint(&self) -> &str { + self.endpoint.as_str() + } + pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { + self.credential.as_ref() + } + pub(crate) fn scopes(&self) -> Vec<&str> { + self.scopes.iter().map(String::as_str).collect() + } + pub(crate) async fn send(&self, request: impl Into) -> azure_core::error::Result { + let mut context = azure_core::Context::default(); + let mut request = request.into(); + self.pipeline.send(&mut context, &mut request).await + } + pub fn new( + endpoint: impl Into, + credential: std::sync::Arc, + scopes: Vec, + ) -> Self { + let endpoint = endpoint.into(); + let pipeline = azure_core::Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + azure_core::ClientOptions::default(), + Vec::new(), + Vec::new(), + ); + Self { + endpoint, + credential, + scopes, + pipeline, + } + } + pub fn big_data_pools(&self) -> big_data_pools::Client { + big_data_pools::Client(self.clone()) + } + pub fn data_flow(&self) -> data_flow::Client { + data_flow::Client(self.clone()) + } + pub fn data_flow_debug_session(&self) -> data_flow_debug_session::Client { + data_flow_debug_session::Client(self.clone()) + } + pub fn dataset(&self) -> dataset::Client { + dataset::Client(self.clone()) + } + pub fn integration_runtimes(&self) -> integration_runtimes::Client { + integration_runtimes::Client(self.clone()) + } + pub fn kql_script(&self) -> kql_script::Client { + kql_script::Client(self.clone()) + } + pub fn kql_scripts(&self) -> kql_scripts::Client { + kql_scripts::Client(self.clone()) + } + pub fn library(&self) -> library::Client { + library::Client(self.clone()) + } + pub fn link_connection(&self) -> link_connection::Client { + link_connection::Client(self.clone()) + } + pub fn linked_service(&self) -> linked_service::Client { + linked_service::Client(self.clone()) + } + pub fn metastore(&self) -> metastore::Client { + metastore::Client(self.clone()) + } + pub fn notebook(&self) -> notebook::Client { + notebook::Client(self.clone()) + } + pub fn notebook_operation_result(&self) -> notebook_operation_result::Client { + notebook_operation_result::Client(self.clone()) + } + pub fn pipeline(&self) -> pipeline::Client { + pipeline::Client(self.clone()) + } + pub fn pipeline_run(&self) -> pipeline_run::Client { + pipeline_run::Client(self.clone()) + } + pub fn spark_configuration(&self) -> spark_configuration::Client { + spark_configuration::Client(self.clone()) + } + pub fn spark_job_definition(&self) -> spark_job_definition::Client { + spark_job_definition::Client(self.clone()) + } + pub fn sql_pools(&self) -> sql_pools::Client { + sql_pools::Client(self.clone()) + } + pub fn sql_script(&self) -> sql_script::Client { + sql_script::Client(self.clone()) + } + pub fn trigger(&self) -> trigger::Client { + trigger::Client(self.clone()) + } + pub fn trigger_run(&self) -> trigger_run::Client { + trigger_run::Client(self.clone()) + } + pub fn workspace(&self) -> workspace::Client { + workspace::Client(self.clone()) + } + pub fn workspace_git_repo_management(&self) -> workspace_git_repo_management::Client { + workspace_git_repo_management::Client(self.clone()) + } +} +#[non_exhaustive] +#[derive(Debug, thiserror :: Error)] +#[allow(non_camel_case_types)] +pub enum Error { + #[error(transparent)] + LinkConnection_ListLinkConnectionsByWorkspace(#[from] link_connection::list_link_connections_by_workspace::Error), + #[error(transparent)] + LinkConnection_GetLinkConnection(#[from] link_connection::get_link_connection::Error), + #[error(transparent)] + LinkConnection_CreateOrUpdateLinkConnection(#[from] link_connection::create_or_update_link_connection::Error), + #[error(transparent)] + LinkConnection_DeleteLinkConnection(#[from] link_connection::delete_link_connection::Error), + #[error(transparent)] + LinkConnection_EditTables(#[from] link_connection::edit_tables::Error), + #[error(transparent)] + LinkConnection_Start(#[from] link_connection::start::Error), + #[error(transparent)] + LinkConnection_Stop(#[from] link_connection::stop::Error), + #[error(transparent)] + LinkConnection_GetDetailedStatus(#[from] link_connection::get_detailed_status::Error), + #[error(transparent)] + LinkConnection_ListLinkTables(#[from] link_connection::list_link_tables::Error), + #[error(transparent)] + LinkConnection_QueryTableStatus(#[from] link_connection::query_table_status::Error), + #[error(transparent)] + LinkConnection_UpdateLandingZoneCredential(#[from] link_connection::update_landing_zone_credential::Error), + #[error(transparent)] + KqlScripts_GetAll(#[from] kql_scripts::get_all::Error), + #[error(transparent)] + KqlScript_GetByName(#[from] kql_script::get_by_name::Error), + #[error(transparent)] + KqlScript_CreateOrUpdate(#[from] kql_script::create_or_update::Error), + #[error(transparent)] + KqlScript_DeleteByName(#[from] kql_script::delete_by_name::Error), + #[error(transparent)] + KqlScript_Rename(#[from] kql_script::rename::Error), + #[error(transparent)] + Metastore_GetDatabaseOperations(#[from] metastore::get_database_operations::Error), + #[error(transparent)] + Metastore_Register(#[from] metastore::register::Error), + #[error(transparent)] + Metastore_Update(#[from] metastore::update::Error), + #[error(transparent)] + Metastore_Delete(#[from] metastore::delete::Error), + #[error(transparent)] + SparkConfiguration_GetSparkConfigurationsByWorkspace(#[from] spark_configuration::get_spark_configurations_by_workspace::Error), + #[error(transparent)] + SparkConfiguration_GetSparkConfiguration(#[from] spark_configuration::get_spark_configuration::Error), + #[error(transparent)] + SparkConfiguration_CreateOrUpdateSparkConfiguration(#[from] spark_configuration::create_or_update_spark_configuration::Error), + #[error(transparent)] + SparkConfiguration_DeleteSparkConfiguration(#[from] spark_configuration::delete_spark_configuration::Error), + #[error(transparent)] + SparkConfiguration_RenameSparkConfiguration(#[from] spark_configuration::rename_spark_configuration::Error), + #[error(transparent)] + BigDataPools_List(#[from] big_data_pools::list::Error), + #[error(transparent)] + BigDataPools_Get(#[from] big_data_pools::get::Error), + #[error(transparent)] + DataFlow_GetDataFlow(#[from] data_flow::get_data_flow::Error), + #[error(transparent)] + DataFlow_CreateOrUpdateDataFlow(#[from] data_flow::create_or_update_data_flow::Error), + #[error(transparent)] + DataFlow_DeleteDataFlow(#[from] data_flow::delete_data_flow::Error), + #[error(transparent)] + DataFlow_RenameDataFlow(#[from] data_flow::rename_data_flow::Error), + #[error(transparent)] + DataFlow_GetDataFlowsByWorkspace(#[from] data_flow::get_data_flows_by_workspace::Error), + #[error(transparent)] + DataFlowDebugSession_CreateDataFlowDebugSession(#[from] data_flow_debug_session::create_data_flow_debug_session::Error), + #[error(transparent)] + DataFlowDebugSession_QueryDataFlowDebugSessionsByWorkspace( + #[from] data_flow_debug_session::query_data_flow_debug_sessions_by_workspace::Error, + ), + #[error(transparent)] + DataFlowDebugSession_AddDataFlow(#[from] data_flow_debug_session::add_data_flow::Error), + #[error(transparent)] + DataFlowDebugSession_DeleteDataFlowDebugSession(#[from] data_flow_debug_session::delete_data_flow_debug_session::Error), + #[error(transparent)] + DataFlowDebugSession_ExecuteCommand(#[from] data_flow_debug_session::execute_command::Error), + #[error(transparent)] + Dataset_GetDatasetsByWorkspace(#[from] dataset::get_datasets_by_workspace::Error), + #[error(transparent)] + Dataset_GetDataset(#[from] dataset::get_dataset::Error), + #[error(transparent)] + Dataset_CreateOrUpdateDataset(#[from] dataset::create_or_update_dataset::Error), + #[error(transparent)] + Dataset_DeleteDataset(#[from] dataset::delete_dataset::Error), + #[error(transparent)] + Dataset_RenameDataset(#[from] dataset::rename_dataset::Error), + #[error(transparent)] + LinkedService_GetLinkedServicesByWorkspace(#[from] linked_service::get_linked_services_by_workspace::Error), + #[error(transparent)] + LinkedService_GetLinkedService(#[from] linked_service::get_linked_service::Error), + #[error(transparent)] + LinkedService_CreateOrUpdateLinkedService(#[from] linked_service::create_or_update_linked_service::Error), + #[error(transparent)] + LinkedService_DeleteLinkedService(#[from] linked_service::delete_linked_service::Error), + #[error(transparent)] + LinkedService_RenameLinkedService(#[from] linked_service::rename_linked_service::Error), + #[error(transparent)] + WorkspaceGitRepoManagement_GetGitHubAccessToken(#[from] workspace_git_repo_management::get_git_hub_access_token::Error), + #[error(transparent)] + IntegrationRuntimes_List(#[from] integration_runtimes::list::Error), + #[error(transparent)] + IntegrationRuntimes_Get(#[from] integration_runtimes::get::Error), + #[error(transparent)] + Library_Append(#[from] library::append::Error), + #[error(transparent)] + Library_List(#[from] library::list::Error), + #[error(transparent)] + Library_Flush(#[from] library::flush::Error), + #[error(transparent)] + Library_GetOperationResult(#[from] library::get_operation_result::Error), + #[error(transparent)] + Library_Get(#[from] library::get::Error), + #[error(transparent)] + Library_Create(#[from] library::create::Error), + #[error(transparent)] + Library_Delete(#[from] library::delete::Error), + #[error(transparent)] + Notebook_GetNotebooksByWorkspace(#[from] notebook::get_notebooks_by_workspace::Error), + #[error(transparent)] + Notebook_GetNotebookSummaryByWorkSpace(#[from] notebook::get_notebook_summary_by_work_space::Error), + #[error(transparent)] + Notebook_GetNotebook(#[from] notebook::get_notebook::Error), + #[error(transparent)] + Notebook_CreateOrUpdateNotebook(#[from] notebook::create_or_update_notebook::Error), + #[error(transparent)] + Notebook_DeleteNotebook(#[from] notebook::delete_notebook::Error), + #[error(transparent)] + Notebook_RenameNotebook(#[from] notebook::rename_notebook::Error), + #[error(transparent)] + NotebookOperationResult_Get(#[from] notebook_operation_result::get::Error), + #[error(transparent)] + Pipeline_GetPipelinesByWorkspace(#[from] pipeline::get_pipelines_by_workspace::Error), + #[error(transparent)] + Pipeline_GetPipeline(#[from] pipeline::get_pipeline::Error), + #[error(transparent)] + Pipeline_CreateOrUpdatePipeline(#[from] pipeline::create_or_update_pipeline::Error), + #[error(transparent)] + Pipeline_DeletePipeline(#[from] pipeline::delete_pipeline::Error), + #[error(transparent)] + Pipeline_RenamePipeline(#[from] pipeline::rename_pipeline::Error), + #[error(transparent)] + Pipeline_CreatePipelineRun(#[from] pipeline::create_pipeline_run::Error), + #[error(transparent)] + PipelineRun_QueryPipelineRunsByWorkspace(#[from] pipeline_run::query_pipeline_runs_by_workspace::Error), + #[error(transparent)] + PipelineRun_GetPipelineRun(#[from] pipeline_run::get_pipeline_run::Error), + #[error(transparent)] + PipelineRun_QueryActivityRuns(#[from] pipeline_run::query_activity_runs::Error), + #[error(transparent)] + PipelineRun_CancelPipelineRun(#[from] pipeline_run::cancel_pipeline_run::Error), + #[error(transparent)] + SparkJobDefinition_GetSparkJobDefinitionsByWorkspace(#[from] spark_job_definition::get_spark_job_definitions_by_workspace::Error), + #[error(transparent)] + SparkJobDefinition_GetSparkJobDefinition(#[from] spark_job_definition::get_spark_job_definition::Error), + #[error(transparent)] + SparkJobDefinition_CreateOrUpdateSparkJobDefinition(#[from] spark_job_definition::create_or_update_spark_job_definition::Error), + #[error(transparent)] + SparkJobDefinition_DeleteSparkJobDefinition(#[from] spark_job_definition::delete_spark_job_definition::Error), + #[error(transparent)] + SparkJobDefinition_ExecuteSparkJobDefinition(#[from] spark_job_definition::execute_spark_job_definition::Error), + #[error(transparent)] + SparkJobDefinition_RenameSparkJobDefinition(#[from] spark_job_definition::rename_spark_job_definition::Error), + #[error(transparent)] + SparkJobDefinition_DebugSparkJobDefinition(#[from] spark_job_definition::debug_spark_job_definition::Error), + #[error(transparent)] + SqlPools_List(#[from] sql_pools::list::Error), + #[error(transparent)] + SqlPools_Get(#[from] sql_pools::get::Error), + #[error(transparent)] + SqlScript_GetSqlScriptsByWorkspace(#[from] sql_script::get_sql_scripts_by_workspace::Error), + #[error(transparent)] + SqlScript_GetSqlScript(#[from] sql_script::get_sql_script::Error), + #[error(transparent)] + SqlScript_CreateOrUpdateSqlScript(#[from] sql_script::create_or_update_sql_script::Error), + #[error(transparent)] + SqlScript_DeleteSqlScript(#[from] sql_script::delete_sql_script::Error), + #[error(transparent)] + SqlScript_RenameSqlScript(#[from] sql_script::rename_sql_script::Error), + #[error(transparent)] + Trigger_GetTriggersByWorkspace(#[from] trigger::get_triggers_by_workspace::Error), + #[error(transparent)] + Trigger_GetTrigger(#[from] trigger::get_trigger::Error), + #[error(transparent)] + Trigger_CreateOrUpdateTrigger(#[from] trigger::create_or_update_trigger::Error), + #[error(transparent)] + Trigger_DeleteTrigger(#[from] trigger::delete_trigger::Error), + #[error(transparent)] + Trigger_SubscribeTriggerToEvents(#[from] trigger::subscribe_trigger_to_events::Error), + #[error(transparent)] + Trigger_GetEventSubscriptionStatus(#[from] trigger::get_event_subscription_status::Error), + #[error(transparent)] + Trigger_UnsubscribeTriggerFromEvents(#[from] trigger::unsubscribe_trigger_from_events::Error), + #[error(transparent)] + Trigger_StartTrigger(#[from] trigger::start_trigger::Error), + #[error(transparent)] + Trigger_StopTrigger(#[from] trigger::stop_trigger::Error), + #[error(transparent)] + TriggerRun_RerunTriggerInstance(#[from] trigger_run::rerun_trigger_instance::Error), + #[error(transparent)] + TriggerRun_CancelTriggerInstance(#[from] trigger_run::cancel_trigger_instance::Error), + #[error(transparent)] + TriggerRun_QueryTriggerRunsByWorkspace(#[from] trigger_run::query_trigger_runs_by_workspace::Error), + #[error(transparent)] + Workspace_Get(#[from] workspace::get::Error), +} +pub mod link_connection { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list_link_connections_by_workspace(&self) -> list_link_connections_by_workspace::Builder { + list_link_connections_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_link_connection(&self, link_connection_name: impl Into) -> get_link_connection::Builder { + get_link_connection::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn create_or_update_link_connection( + &self, + link_connection_name: impl Into, + link_connection: impl Into, + ) -> create_or_update_link_connection::Builder { + create_or_update_link_connection::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + link_connection: link_connection.into(), + } + } + pub fn delete_link_connection(&self, link_connection_name: impl Into) -> delete_link_connection::Builder { + delete_link_connection::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn edit_tables( + &self, + link_connection_name: impl Into, + edit_tables_request: impl Into, + ) -> edit_tables::Builder { + edit_tables::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + edit_tables_request: edit_tables_request.into(), + } + } + pub fn start(&self, link_connection_name: impl Into) -> start::Builder { + start::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn stop(&self, link_connection_name: impl Into) -> stop::Builder { + stop::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn get_detailed_status(&self, link_connection_name: impl Into) -> get_detailed_status::Builder { + get_detailed_status::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn list_link_tables(&self, link_connection_name: impl Into) -> list_link_tables::Builder { + list_link_tables::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + } + } + pub fn query_table_status( + &self, + link_connection_name: impl Into, + query_table_status_request: impl Into, + ) -> query_table_status::Builder { + query_table_status::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + query_table_status_request: query_table_status_request.into(), + } + } + pub fn update_landing_zone_credential( + &self, + link_connection_name: impl Into, + update_landing_zone_credential_request: impl Into, + ) -> update_landing_zone_credential::Builder { + update_landing_zone_credential::Builder { + client: self.0.clone(), + link_connection_name: link_connection_name.into(), + update_landing_zone_credential_request: update_landing_zone_credential_request.into(), + } + } + } + pub mod list_link_connections_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkConnectionListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_link_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections/{}", self.client.endpoint(), &self.link_connection_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_link_connection { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + pub(crate) link_connection: models::LinkConnectionResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections/{}", self.client.endpoint(), &self.link_connection_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.link_connection).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkConnectionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_link_connection { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections/{}", self.client.endpoint(), &self.link_connection_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod edit_tables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + pub(crate) edit_tables_request: models::EditTablesRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/linkconnections/{}/edittables", + self.client.endpoint(), + &self.link_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.edit_tables_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections/{}/start", self.client.endpoint(), &self.link_connection_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/linkconnections/{}/stop", self.client.endpoint(), &self.link_connection_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_detailed_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/linkconnections/{}/detailedstatus", + self.client.endpoint(), + &self.link_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkConnectionDetailedStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list_link_tables { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/linkconnections/{}/linktables", + self.client.endpoint(), + &self.link_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkTableListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_table_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + pub(crate) query_table_status_request: models::QueryTableStatusRequest, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/linkconnections/{}/querytablestatus", + self.client.endpoint(), + &self.link_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.query_table_status_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkConnectionQueryTableStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update_landing_zone_credential { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) link_connection_name: String, + pub(crate) update_landing_zone_credential_request: models::UpdateLandingZoneCredential, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/linkconnections/{}/updateLandingZoneCredential", + self.client.endpoint(), + &self.link_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-12-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_landing_zone_credential_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod kql_scripts { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_all(&self) -> get_all::Builder { + get_all::Builder { client: self.0.clone() } + } + } + pub mod get_all { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/kqlScripts", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::KqlScriptsResourceCollectionResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod kql_script { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_by_name(&self, kql_script_name: impl Into) -> get_by_name::Builder { + get_by_name::Builder { + client: self.0.clone(), + kql_script_name: kql_script_name.into(), + } + } + pub fn create_or_update( + &self, + kql_script_name: impl Into, + kql_script: impl Into, + ) -> create_or_update::Builder { + create_or_update::Builder { + client: self.0.clone(), + kql_script_name: kql_script_name.into(), + kql_script: kql_script.into(), + } + } + pub fn delete_by_name(&self, kql_script_name: impl Into) -> delete_by_name::Builder { + delete_by_name::Builder { + client: self.0.clone(), + kql_script_name: kql_script_name.into(), + } + } + pub fn rename( + &self, + kql_script_name: impl Into, + rename_request: impl Into, + ) -> rename::Builder { + rename::Builder { + client: self.0.clone(), + kql_script_name: kql_script_name.into(), + rename_request: rename_request.into(), + } + } + } + pub mod get_by_name { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) kql_script_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/kqlScripts/{}", self.client.endpoint(), &self.kql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::KqlScriptResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::KqlScriptResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) kql_script_name: String, + pub(crate) kql_script: models::KqlScriptResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/kqlScripts/{}", self.client.endpoint(), &self.kql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.kql_script).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::KqlScriptResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_by_name { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) kql_script_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/kqlScripts/{}", self.client.endpoint(), &self.kql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) kql_script_name: String, + pub(crate) rename_request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/kqlScripts/{}/rename", self.client.endpoint(), &self.kql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-11-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.rename_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod metastore { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_database_operations(&self, id: impl Into) -> get_database_operations::Builder { + get_database_operations::Builder { + client: self.0.clone(), + id: id.into(), + } + } + pub fn register(&self, id: impl Into, register_body: impl Into) -> register::Builder { + register::Builder { + client: self.0.clone(), + id: id.into(), + register_body: register_body.into(), + } + } + pub fn update(&self, id: impl Into, update_body: impl Into) -> update::Builder { + update::Builder { + client: self.0.clone(), + id: id.into(), + update_body: update_body.into(), + } + } + pub fn delete(&self, id: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + id: id.into(), + } + } + } + pub mod get_database_operations { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) id: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/metastore/create-database-operations/{}", self.client.endpoint(), &self.id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-07-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetastoreRequestSuccessResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod register { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) id: String, + pub(crate) register_body: models::MetastoreRegisterObject, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/metastore/create-database-operations/{}", self.client.endpoint(), &self.id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-07-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.register_body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetastoreRegistrationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod update { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) id: String, + pub(crate) update_body: models::MetastoreUpdateObject, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/metastore/update-database-operations/{}", self.client.endpoint(), &self.id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-07-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.update_body).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::MetastoreUpdationResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/metastore/databases/{}", self.client.endpoint(), &self.id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-07-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::NO_CONTENT => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod spark_configuration { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_spark_configurations_by_workspace(&self) -> get_spark_configurations_by_workspace::Builder { + get_spark_configurations_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_spark_configuration(&self, spark_configuration_name: impl Into) -> get_spark_configuration::Builder { + get_spark_configuration::Builder { + client: self.0.clone(), + spark_configuration_name: spark_configuration_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_spark_configuration( + &self, + spark_configuration_name: impl Into, + spark_configuration: impl Into, + ) -> create_or_update_spark_configuration::Builder { + create_or_update_spark_configuration::Builder { + client: self.0.clone(), + spark_configuration_name: spark_configuration_name.into(), + spark_configuration: spark_configuration.into(), + if_match: None, + } + } + pub fn delete_spark_configuration(&self, spark_configuration_name: impl Into) -> delete_spark_configuration::Builder { + delete_spark_configuration::Builder { + client: self.0.clone(), + spark_configuration_name: spark_configuration_name.into(), + } + } + pub fn rename_spark_configuration( + &self, + spark_configuration_name: impl Into, + request: impl Into, + ) -> rename_spark_configuration::Builder { + rename_spark_configuration::Builder { + client: self.0.clone(), + spark_configuration_name: spark_configuration_name.into(), + request: request.into(), + } + } + } + pub mod get_spark_configurations_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkconfigurations", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkConfigurationListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_spark_configuration { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_configuration_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkconfigurations/{}", self.client.endpoint(), &self.spark_configuration_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkConfigurationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_spark_configuration { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SparkConfigurationResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_configuration_name: String, + pub(crate) spark_configuration: models::SparkConfigurationResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkconfigurations/{}", self.client.endpoint(), &self.spark_configuration_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.spark_configuration).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkConfigurationResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_spark_configuration { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_configuration_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkconfigurations/{}", self.client.endpoint(), &self.spark_configuration_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_spark_configuration { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_configuration_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/sparkconfigurations/{}/rename", + self.client.endpoint(), + &self.spark_configuration_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2021-06-01-preview"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod big_data_pools { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn get(&self, big_data_pool_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + big_data_pool_name: big_data_pool_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/bigDataPools", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BigDataPoolResourceInfoListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) big_data_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/bigDataPools/{}", self.client.endpoint(), &self.big_data_pool_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::BigDataPoolResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_flow { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_data_flow(&self, data_flow_name: impl Into) -> get_data_flow::Builder { + get_data_flow::Builder { + client: self.0.clone(), + data_flow_name: data_flow_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_data_flow( + &self, + data_flow_name: impl Into, + data_flow: impl Into, + ) -> create_or_update_data_flow::Builder { + create_or_update_data_flow::Builder { + client: self.0.clone(), + data_flow_name: data_flow_name.into(), + data_flow: data_flow.into(), + if_match: None, + } + } + pub fn delete_data_flow(&self, data_flow_name: impl Into) -> delete_data_flow::Builder { + delete_data_flow::Builder { + client: self.0.clone(), + data_flow_name: data_flow_name.into(), + } + } + pub fn rename_data_flow( + &self, + data_flow_name: impl Into, + request: impl Into, + ) -> rename_data_flow::Builder { + rename_data_flow::Builder { + client: self.0.clone(), + data_flow_name: data_flow_name.into(), + request: request.into(), + } + } + pub fn get_data_flows_by_workspace(&self) -> get_data_flows_by_workspace::Builder { + get_data_flows_by_workspace::Builder { client: self.0.clone() } + } + } + pub mod get_data_flow { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_flow_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataflows/{}", self.client.endpoint(), &self.data_flow_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataFlowResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_data_flow { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DataFlowResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_flow_name: String, + pub(crate) data_flow: models::DataFlowResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataflows/{}", self.client.endpoint(), &self.data_flow_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.data_flow).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataFlowResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_data_flow { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_flow_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataflows/{}", self.client.endpoint(), &self.data_flow_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_data_flow { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) data_flow_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataflows/{}/rename", self.client.endpoint(), &self.data_flow_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_data_flows_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/dataflows", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataFlowListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod data_flow_debug_session { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn create_data_flow_debug_session( + &self, + request: impl Into, + ) -> create_data_flow_debug_session::Builder { + create_data_flow_debug_session::Builder { + client: self.0.clone(), + request: request.into(), + } + } + pub fn query_data_flow_debug_sessions_by_workspace(&self) -> query_data_flow_debug_sessions_by_workspace::Builder { + query_data_flow_debug_sessions_by_workspace::Builder { client: self.0.clone() } + } + pub fn add_data_flow(&self, request: impl Into) -> add_data_flow::Builder { + add_data_flow::Builder { + client: self.0.clone(), + request: request.into(), + } + } + pub fn delete_data_flow_debug_session( + &self, + request: impl Into, + ) -> delete_data_flow_debug_session::Builder { + delete_data_flow_debug_session::Builder { + client: self.0.clone(), + request: request.into(), + } + } + pub fn execute_command(&self, request: impl Into) -> execute_command::Builder { + execute_command::Builder { + client: self.0.clone(), + request: request.into(), + } + } + } + pub mod create_data_flow_debug_session { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::CreateDataFlowDebugSessionResponse), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::CreateDataFlowDebugSessionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/createDataFlowDebugSession", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CreateDataFlowDebugSessionResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_data_flow_debug_sessions_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/queryDataFlowDebugSessions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::QueryDataFlowDebugSessionsResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod add_data_flow { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::DataFlowDebugPackage, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/addDataFlowToDebugSession", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::AddDataFlowToDebugSessionResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_data_flow_debug_session { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::DeleteDataFlowDebugSessionRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/deleteDataFlowDebugSession", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod execute_command { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(models::DataFlowDebugCommandResponse), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) request: models::DataFlowDebugCommandRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/executeDataFlowDebugCommand", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DataFlowDebugCommandResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod dataset { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_datasets_by_workspace(&self) -> get_datasets_by_workspace::Builder { + get_datasets_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_dataset(&self, dataset_name: impl Into) -> get_dataset::Builder { + get_dataset::Builder { + client: self.0.clone(), + dataset_name: dataset_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_dataset( + &self, + dataset_name: impl Into, + dataset: impl Into, + ) -> create_or_update_dataset::Builder { + create_or_update_dataset::Builder { + client: self.0.clone(), + dataset_name: dataset_name.into(), + dataset: dataset.into(), + if_match: None, + } + } + pub fn delete_dataset(&self, dataset_name: impl Into) -> delete_dataset::Builder { + delete_dataset::Builder { + client: self.0.clone(), + dataset_name: dataset_name.into(), + } + } + pub fn rename_dataset( + &self, + dataset_name: impl Into, + request: impl Into, + ) -> rename_dataset::Builder { + rename_dataset::Builder { + client: self.0.clone(), + dataset_name: dataset_name.into(), + request: request.into(), + } + } + } + pub mod get_datasets_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasets", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatasetListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_dataset { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) dataset_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasets/{}", self.client.endpoint(), &self.dataset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatasetResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_dataset { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::DatasetResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) dataset_name: String, + pub(crate) dataset: models::DatasetResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasets/{}", self.client.endpoint(), &self.dataset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.dataset).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::DatasetResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_dataset { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) dataset_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasets/{}", self.client.endpoint(), &self.dataset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_dataset { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) dataset_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/datasets/{}/rename", self.client.endpoint(), &self.dataset_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod linked_service { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_linked_services_by_workspace(&self) -> get_linked_services_by_workspace::Builder { + get_linked_services_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_linked_service(&self, linked_service_name: impl Into) -> get_linked_service::Builder { + get_linked_service::Builder { + client: self.0.clone(), + linked_service_name: linked_service_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_linked_service( + &self, + linked_service_name: impl Into, + linked_service: impl Into, + ) -> create_or_update_linked_service::Builder { + create_or_update_linked_service::Builder { + client: self.0.clone(), + linked_service_name: linked_service_name.into(), + linked_service: linked_service.into(), + if_match: None, + } + } + pub fn delete_linked_service(&self, linked_service_name: impl Into) -> delete_linked_service::Builder { + delete_linked_service::Builder { + client: self.0.clone(), + linked_service_name: linked_service_name.into(), + } + } + pub fn rename_linked_service( + &self, + linked_service_name: impl Into, + request: impl Into, + ) -> rename_linked_service::Builder { + rename_linked_service::Builder { + client: self.0.clone(), + linked_service_name: linked_service_name.into(), + request: request.into(), + } + } + } + pub mod get_linked_services_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkedservices", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkedServiceListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_linked_service { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) linked_service_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkedservices/{}", self.client.endpoint(), &self.linked_service_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkedServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_linked_service { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LinkedServiceResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) linked_service_name: String, + pub(crate) linked_service: models::LinkedServiceResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkedservices/{}", self.client.endpoint(), &self.linked_service_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.linked_service).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LinkedServiceResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_linked_service { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) linked_service_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkedservices/{}", self.client.endpoint(), &self.linked_service_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_linked_service { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) linked_service_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/linkedservices/{}/rename", self.client.endpoint(), &self.linked_service_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspace_git_repo_management { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_git_hub_access_token( + &self, + git_hub_access_token_request: impl Into, + ) -> get_git_hub_access_token::Builder { + get_git_hub_access_token::Builder { + client: self.0.clone(), + git_hub_access_token_request: git_hub_access_token_request.into(), + x_ms_client_request_id: None, + } + } + } + pub mod get_git_hub_access_token { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) git_hub_access_token_request: models::GitHubAccessTokenRequest, + pub(crate) x_ms_client_request_id: Option, + } + impl Builder { + pub fn x_ms_client_request_id(mut self, x_ms_client_request_id: impl Into) -> Self { + self.x_ms_client_request_id = Some(x_ms_client_request_id.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/getGitHubAccessToken", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(x_ms_client_request_id) = &self.x_ms_client_request_id { + req_builder = req_builder.header("x-ms-client-request-id", x_ms_client_request_id); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.git_hub_access_token_request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::GitHubAccessTokenResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + Err(Error::UnexpectedResponse { + status_code, + body: rsp_body, + }) + } + } + }) + } + } + } +} +pub mod integration_runtimes { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn get(&self, integration_runtime_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + integration_runtime_name: integration_runtime_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/integrationRuntimes", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IntegrationRuntimeListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) integration_runtime_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/integrationRuntimes/{}", self.client.endpoint(), &self.integration_runtime_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::IntegrationRuntimeResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod library { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn append(&self, comp: impl Into, library_name: impl Into, content: impl Into) -> append::Builder { + append::Builder { + client: self.0.clone(), + comp: comp.into(), + library_name: library_name.into(), + content: content.into(), + x_ms_blob_condition_appendpos: None, + } + } + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn flush(&self, library_name: impl Into) -> flush::Builder { + flush::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn get_operation_result(&self, operation_id: impl Into) -> get_operation_result::Builder { + get_operation_result::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + pub fn get(&self, library_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn create(&self, library_name: impl Into) -> create::Builder { + create::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + pub fn delete(&self, library_name: impl Into) -> delete::Builder { + delete::Builder { + client: self.0.clone(), + library_name: library_name.into(), + } + } + } + pub mod append { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) comp: String, + pub(crate) library_name: String, + pub(crate) content: String, + pub(crate) x_ms_blob_condition_appendpos: Option, + } + impl Builder { + pub fn x_ms_blob_condition_appendpos(mut self, x_ms_blob_condition_appendpos: i64) -> Self { + self.x_ms_blob_condition_appendpos = Some(x_ms_blob_condition_appendpos); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}?comp=appendblock", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let comp = &self.comp; + url.query_pairs_mut().append_pair("comp", comp); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.content).map_err(Error::Serialize)?; + if let Some(x_ms_blob_condition_appendpos) = &self.x_ms_blob_condition_appendpos { + req_builder = req_builder.header("x-ms-blob-condition-appendpos", &x_ms_blob_condition_appendpos.to_string()); + } + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::CREATED => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod flush { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}/flush", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_operation_result { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::LibraryResource), + Accepted202(models::OperationResult), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraryOperationResults/{}", self.client.endpoint(), &self.operation_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::OperationResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202(models::LibraryResourceInfo), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + Conflict409 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) library_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/libraries/{}", self.client.endpoint(), &self.library_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::LibraryResourceInfo = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::CONFLICT => Err(Error::Conflict409 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notebook { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_notebooks_by_workspace(&self) -> get_notebooks_by_workspace::Builder { + get_notebooks_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_notebook_summary_by_work_space(&self) -> get_notebook_summary_by_work_space::Builder { + get_notebook_summary_by_work_space::Builder { client: self.0.clone() } + } + pub fn get_notebook(&self, notebook_name: impl Into) -> get_notebook::Builder { + get_notebook::Builder { + client: self.0.clone(), + notebook_name: notebook_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_notebook( + &self, + notebook_name: impl Into, + notebook: impl Into, + ) -> create_or_update_notebook::Builder { + create_or_update_notebook::Builder { + client: self.0.clone(), + notebook_name: notebook_name.into(), + notebook: notebook.into(), + if_match: None, + } + } + pub fn delete_notebook(&self, notebook_name: impl Into) -> delete_notebook::Builder { + delete_notebook::Builder { + client: self.0.clone(), + notebook_name: notebook_name.into(), + } + } + pub fn rename_notebook( + &self, + notebook_name: impl Into, + request: impl Into, + ) -> rename_notebook::Builder { + rename_notebook::Builder { + client: self.0.clone(), + notebook_name: notebook_name.into(), + request: request.into(), + } + } + } + pub mod get_notebooks_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooks", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_notebook_summary_by_work_space { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooksSummary", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_notebook { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) notebook_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooks/{}", self.client.endpoint(), &self.notebook_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_notebook { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::NotebookResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) notebook_name: String, + pub(crate) notebook: models::NotebookResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooks/{}", self.client.endpoint(), &self.notebook_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.notebook).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::NotebookResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_notebook { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) notebook_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooks/{}", self.client.endpoint(), &self.notebook_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_notebook { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) notebook_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebooks/{}/rename", self.client.endpoint(), &self.notebook_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod notebook_operation_result { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self, operation_id: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + operation_id: operation_id.into(), + } + } + } + pub mod get { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Created201, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) operation_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/notebookOperationResults/{}", self.client.endpoint(), &self.operation_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::CREATED => Ok(Response::Created201), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod pipeline { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_pipelines_by_workspace(&self) -> get_pipelines_by_workspace::Builder { + get_pipelines_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_pipeline(&self, pipeline_name: impl Into) -> get_pipeline::Builder { + get_pipeline::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_pipeline( + &self, + pipeline_name: impl Into, + pipeline: impl Into, + ) -> create_or_update_pipeline::Builder { + create_or_update_pipeline::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + pipeline: pipeline.into(), + if_match: None, + } + } + pub fn delete_pipeline(&self, pipeline_name: impl Into) -> delete_pipeline::Builder { + delete_pipeline::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + } + } + pub fn rename_pipeline( + &self, + pipeline_name: impl Into, + request: impl Into, + ) -> rename_pipeline::Builder { + rename_pipeline::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + request: request.into(), + } + } + pub fn create_pipeline_run(&self, pipeline_name: impl Into) -> create_pipeline_run::Builder { + create_pipeline_run::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + reference_pipeline_run_id: None, + is_recovery: None, + start_activity_name: None, + parameters: None, + } + } + } + pub mod get_pipelines_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PipelineListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_pipeline { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines/{}", self.client.endpoint(), &self.pipeline_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PipelineResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_pipeline { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::PipelineResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + pub(crate) pipeline: models::PipelineResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines/{}", self.client.endpoint(), &self.pipeline_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.pipeline).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PipelineResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_pipeline { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines/{}", self.client.endpoint(), &self.pipeline_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_pipeline { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines/{}/rename", self.client.endpoint(), &self.pipeline_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_pipeline_run { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + pub(crate) reference_pipeline_run_id: Option, + pub(crate) is_recovery: Option, + pub(crate) start_activity_name: Option, + pub(crate) parameters: Option, + } + impl Builder { + pub fn reference_pipeline_run_id(mut self, reference_pipeline_run_id: impl Into) -> Self { + self.reference_pipeline_run_id = Some(reference_pipeline_run_id.into()); + self + } + pub fn is_recovery(mut self, is_recovery: bool) -> Self { + self.is_recovery = Some(is_recovery); + self + } + pub fn start_activity_name(mut self, start_activity_name: impl Into) -> Self { + self.start_activity_name = Some(start_activity_name.into()); + self + } + pub fn parameters(mut self, parameters: impl Into) -> Self { + self.parameters = Some(parameters.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelines/{}/createRun", self.client.endpoint(), &self.pipeline_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(reference_pipeline_run_id) = &self.reference_pipeline_run_id { + url.query_pairs_mut() + .append_pair("referencePipelineRunId", reference_pipeline_run_id); + } + if let Some(is_recovery) = &self.is_recovery { + url.query_pairs_mut().append_pair("isRecovery", &is_recovery.to_string()); + } + if let Some(start_activity_name) = &self.start_activity_name { + url.query_pairs_mut().append_pair("startActivityName", start_activity_name); + } + let req_body = if let Some(parameters) = &self.parameters { + req_builder = req_builder.header("content-type", "application/json"); + azure_core::to_json(parameters).map_err(Error::Serialize)? + } else { + azure_core::EMPTY_BODY + }; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CreateRunResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod pipeline_run { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn query_pipeline_runs_by_workspace( + &self, + filter_parameters: impl Into, + ) -> query_pipeline_runs_by_workspace::Builder { + query_pipeline_runs_by_workspace::Builder { + client: self.0.clone(), + filter_parameters: filter_parameters.into(), + } + } + pub fn get_pipeline_run(&self, run_id: impl Into) -> get_pipeline_run::Builder { + get_pipeline_run::Builder { + client: self.0.clone(), + run_id: run_id.into(), + } + } + pub fn query_activity_runs( + &self, + pipeline_name: impl Into, + run_id: impl Into, + filter_parameters: impl Into, + ) -> query_activity_runs::Builder { + query_activity_runs::Builder { + client: self.0.clone(), + pipeline_name: pipeline_name.into(), + run_id: run_id.into(), + filter_parameters: filter_parameters.into(), + } + } + pub fn cancel_pipeline_run(&self, run_id: impl Into) -> cancel_pipeline_run::Builder { + cancel_pipeline_run::Builder { + client: self.0.clone(), + run_id: run_id.into(), + is_recursive: None, + } + } + } + pub mod query_pipeline_runs_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter_parameters: models::RunFilterParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/queryPipelineRuns", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.filter_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PipelineRunsQueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_pipeline_run { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/pipelineruns/{}", self.client.endpoint(), &self.run_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::PipelineRun = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_activity_runs { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) pipeline_name: String, + pub(crate) run_id: String, + pub(crate) filter_parameters: models::RunFilterParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/pipelines/{}/pipelineruns/{}/queryActivityruns", + self.client.endpoint(), + &self.pipeline_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.filter_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ActivityRunsQueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel_pipeline_run { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) run_id: String, + pub(crate) is_recursive: Option, + } + impl Builder { + pub fn is_recursive(mut self, is_recursive: bool) -> Self { + self.is_recursive = Some(is_recursive); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/pipelineruns/{}/cancel", self.client.endpoint(), &self.run_id); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(is_recursive) = &self.is_recursive { + url.query_pairs_mut().append_pair("isRecursive", &is_recursive.to_string()); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod spark_job_definition { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_spark_job_definitions_by_workspace(&self) -> get_spark_job_definitions_by_workspace::Builder { + get_spark_job_definitions_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_spark_job_definition(&self, spark_job_definition_name: impl Into) -> get_spark_job_definition::Builder { + get_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_name: spark_job_definition_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_spark_job_definition( + &self, + spark_job_definition_name: impl Into, + spark_job_definition: impl Into, + ) -> create_or_update_spark_job_definition::Builder { + create_or_update_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_name: spark_job_definition_name.into(), + spark_job_definition: spark_job_definition.into(), + if_match: None, + } + } + pub fn delete_spark_job_definition(&self, spark_job_definition_name: impl Into) -> delete_spark_job_definition::Builder { + delete_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_name: spark_job_definition_name.into(), + } + } + pub fn execute_spark_job_definition(&self, spark_job_definition_name: impl Into) -> execute_spark_job_definition::Builder { + execute_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_name: spark_job_definition_name.into(), + } + } + pub fn rename_spark_job_definition( + &self, + spark_job_definition_name: impl Into, + request: impl Into, + ) -> rename_spark_job_definition::Builder { + rename_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_name: spark_job_definition_name.into(), + request: request.into(), + } + } + pub fn debug_spark_job_definition( + &self, + spark_job_definition_azure_resource: impl Into, + ) -> debug_spark_job_definition::Builder { + debug_spark_job_definition::Builder { + client: self.0.clone(), + spark_job_definition_azure_resource: spark_job_definition_azure_resource.into(), + } + } + } + pub mod get_spark_job_definitions_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkJobDefinitions", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkJobDefinitionsListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_spark_job_definition { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkJobDefinitions/{}", self.client.endpoint(), &self.spark_job_definition_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkJobDefinitionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_spark_job_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SparkJobDefinitionResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_name: String, + pub(crate) spark_job_definition: models::SparkJobDefinitionResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkJobDefinitions/{}", self.client.endpoint(), &self.spark_job_definition_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.spark_job_definition).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkJobDefinitionResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_spark_job_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sparkJobDefinitions/{}", self.client.endpoint(), &self.spark_job_definition_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod execute_spark_job_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202(models::SparkBatchJob), + Ok200(models::SparkBatchJob), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/sparkJobDefinitions/{}/execute", + self.client.endpoint(), + &self.spark_job_definition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkBatchJob = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkBatchJob = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_spark_job_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/sparkJobDefinitions/{}/rename", + self.client.endpoint(), + &self.spark_job_definition_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod debug_spark_job_definition { + use super::models; + #[derive(Debug)] + pub enum Response { + Accepted202(models::SparkBatchJob), + Ok200(models::SparkBatchJob), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) spark_job_definition_azure_resource: models::SparkJobDefinitionResource, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/debugSparkJobDefinition", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.spark_job_definition_azure_resource).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::ACCEPTED => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkBatchJob = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Accepted202(rsp_value)) + } + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SparkBatchJob = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod sql_pools { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn list(&self) -> list::Builder { + list::Builder { client: self.0.clone() } + } + pub fn get(&self, sql_pool_name: impl Into) -> get::Builder { + get::Builder { + client: self.0.clone(), + sql_pool_name: sql_pool_name.into(), + } + } + } + pub mod list { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlPools", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlPoolInfoListResult = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) sql_pool_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlPools/{}", self.client.endpoint(), &self.sql_pool_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlPool = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod sql_script { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_sql_scripts_by_workspace(&self) -> get_sql_scripts_by_workspace::Builder { + get_sql_scripts_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_sql_script(&self, sql_script_name: impl Into) -> get_sql_script::Builder { + get_sql_script::Builder { + client: self.0.clone(), + sql_script_name: sql_script_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_sql_script( + &self, + sql_script_name: impl Into, + sql_script: impl Into, + ) -> create_or_update_sql_script::Builder { + create_or_update_sql_script::Builder { + client: self.0.clone(), + sql_script_name: sql_script_name.into(), + sql_script: sql_script.into(), + if_match: None, + } + } + pub fn delete_sql_script(&self, sql_script_name: impl Into) -> delete_sql_script::Builder { + delete_sql_script::Builder { + client: self.0.clone(), + sql_script_name: sql_script_name.into(), + } + } + pub fn rename_sql_script( + &self, + sql_script_name: impl Into, + request: impl Into, + ) -> rename_sql_script::Builder { + rename_sql_script::Builder { + client: self.0.clone(), + sql_script_name: sql_script_name.into(), + request: request.into(), + } + } + } + pub mod get_sql_scripts_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlScripts", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlScriptsListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_sql_script { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) sql_script_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlScripts/{}", self.client.endpoint(), &self.sql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlScriptResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_sql_script { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::SqlScriptResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) sql_script_name: String, + pub(crate) sql_script: models::SqlScriptResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlScripts/{}", self.client.endpoint(), &self.sql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.sql_script).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::SqlScriptResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_sql_script { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) sql_script_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlScripts/{}", self.client.endpoint(), &self.sql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod rename_sql_script { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) sql_script_name: String, + pub(crate) request: models::ArtifactRenameRequest, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/sqlScripts/{}/rename", self.client.endpoint(), &self.sql_script_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.request).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod trigger { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get_triggers_by_workspace(&self) -> get_triggers_by_workspace::Builder { + get_triggers_by_workspace::Builder { client: self.0.clone() } + } + pub fn get_trigger(&self, trigger_name: impl Into) -> get_trigger::Builder { + get_trigger::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + if_none_match: None, + } + } + pub fn create_or_update_trigger( + &self, + trigger_name: impl Into, + trigger: impl Into, + ) -> create_or_update_trigger::Builder { + create_or_update_trigger::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + trigger: trigger.into(), + if_match: None, + } + } + pub fn delete_trigger(&self, trigger_name: impl Into) -> delete_trigger::Builder { + delete_trigger::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + pub fn subscribe_trigger_to_events(&self, trigger_name: impl Into) -> subscribe_trigger_to_events::Builder { + subscribe_trigger_to_events::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + pub fn get_event_subscription_status(&self, trigger_name: impl Into) -> get_event_subscription_status::Builder { + get_event_subscription_status::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + pub fn unsubscribe_trigger_from_events(&self, trigger_name: impl Into) -> unsubscribe_trigger_from_events::Builder { + unsubscribe_trigger_from_events::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + pub fn start_trigger(&self, trigger_name: impl Into) -> start_trigger::Builder { + start_trigger::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + pub fn stop_trigger(&self, trigger_name: impl Into) -> stop_trigger::Builder { + stop_trigger::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + } + } + } + pub mod get_triggers_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerListResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotModified304 {}, + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + pub(crate) if_none_match: Option, + } + impl Builder { + pub fn if_none_match(mut self, if_none_match: impl Into) -> Self { + self.if_none_match = Some(if_none_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_none_match) = &self.if_none_match { + req_builder = req_builder.header("If-None-Match", if_none_match); + } + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + http::StatusCode::NOT_MODIFIED => Err(Error::NotModified304 {}), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod create_or_update_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TriggerResource), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + pub(crate) trigger: models::TriggerResource, + pub(crate) if_match: Option, + } + impl Builder { + pub fn if_match(mut self, if_match: impl Into) -> Self { + self.if_match = Some(if_match.into()); + self + } + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + if let Some(if_match) = &self.if_match { + req_builder = req_builder.header("If-Match", if_match); + } + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.trigger).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerResource = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod delete_trigger { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(Response::Ok200), + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(Response::NoContent204), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod subscribe_trigger_to_events { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TriggerSubscriptionOperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}/subscribeToEvents", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerSubscriptionOperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod get_event_subscription_status { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future( + self, + ) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!( + "{}/triggers/{}/getEventSubscriptionStatus", + self.client.endpoint(), + &self.trigger_name + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerSubscriptionOperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod unsubscribe_trigger_from_events { + use super::models; + #[derive(Debug)] + pub enum Response { + Ok200(models::TriggerSubscriptionOperationStatus), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}/unsubscribeFromEvents", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerSubscriptionOperationStatus = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(Response::Accepted202), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod start_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}/start", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod stop_trigger { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!("{}/triggers/{}/stop", self.client.endpoint(), &self.trigger_name); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod trigger_run { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn rerun_trigger_instance( + &self, + trigger_name: impl Into, + run_id: impl Into, + ) -> rerun_trigger_instance::Builder { + rerun_trigger_instance::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + run_id: run_id.into(), + } + } + pub fn cancel_trigger_instance( + &self, + trigger_name: impl Into, + run_id: impl Into, + ) -> cancel_trigger_instance::Builder { + cancel_trigger_instance::Builder { + client: self.0.clone(), + trigger_name: trigger_name.into(), + run_id: run_id.into(), + } + } + pub fn query_trigger_runs_by_workspace( + &self, + filter_parameters: impl Into, + ) -> query_trigger_runs_by_workspace::Builder { + query_trigger_runs_by_workspace::Builder { + client: self.0.clone(), + filter_parameters: filter_parameters.into(), + } + } + } + pub mod rerun_trigger_instance { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/triggers/{}/triggerRuns/{}/rerun", + self.client.endpoint(), + &self.trigger_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod cancel_trigger_instance { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) trigger_name: String, + pub(crate) run_id: String, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result<(), Error>> { + Box::pin(async move { + let url_str = &format!( + "{}/triggers/{}/triggerRuns/{}/cancel", + self.client.endpoint(), + &self.trigger_name, + &self.run_id + ); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => Ok(()), + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } + pub mod query_trigger_runs_by_workspace { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + pub(crate) filter_parameters: models::RunFilterParameters, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/queryTriggerRuns", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + req_builder = req_builder.header("content-type", "application/json"); + let req_body = azure_core::to_json(&self.filter_parameters).map_err(Error::Serialize)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::TriggerRunsQueryResponse = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::CloudError = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} +pub mod workspace { + use super::models; + pub struct Client(pub(crate) super::Client); + impl Client { + pub fn get(&self) -> get::Builder { + get::Builder { client: self.0.clone() } + } + } + pub mod get { + use super::models; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorContract, + }, + #[error("Failed to parse request URL")] + ParseUrl(#[source] url::ParseError), + #[error("Failed to build request")] + BuildRequest(#[source] http::Error), + #[error("Failed to serialize request body")] + Serialize(#[source] serde_json::Error), + #[error("Failed to get access token")] + GetToken(#[source] azure_core::Error), + #[error("Failed to execute request")] + SendRequest(#[source] azure_core::error::Error), + #[error("Failed to get response bytes")] + ResponseBytes(#[source] azure_core::error::Error), + #[error("Failed to deserialize response, body: {1:?}")] + Deserialize(#[source] serde_json::Error, bytes::Bytes), + } + #[derive(Clone)] + pub struct Builder { + pub(crate) client: super::super::Client, + } + impl Builder { + pub fn into_future(self) -> futures::future::BoxFuture<'static, std::result::Result> { + Box::pin(async move { + let url_str = &format!("{}/workspace", self.client.endpoint(),); + let mut url = url::Url::parse(url_str).map_err(Error::ParseUrl)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + let credential = self.client.token_credential(); + let token_response = credential + .get_token(&self.client.scopes().join(" ")) + .await + .map_err(Error::GetToken)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + url.query_pairs_mut().append_pair("api-version", "2020-12-01"); + let req_body = azure_core::EMPTY_BODY; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(Error::BuildRequest)?; + let rsp = self.client.send(req).await.map_err(Error::SendRequest)?; + let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct(); + match rsp_status { + http::StatusCode::OK => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::Workspace = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = azure_core::collect_pinned_stream(rsp_stream).await.map_err(Error::ResponseBytes)?; + let rsp_value: models::ErrorContract = + serde_json::from_slice(&rsp_body).map_err(|source| Error::Deserialize(source, rsp_body.clone()))?; + Err(Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + }) + } + } + } +} diff --git a/services/svc/timeseriesinsights/Cargo.toml b/services/svc/timeseriesinsights/Cargo.toml index 2f8a9e560d..351892bc5a 100644 --- a/services/svc/timeseriesinsights/Cargo.toml +++ b/services/svc/timeseriesinsights/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_timeseriesinsights" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings" diff --git a/services/svc/webpubsub/Cargo.toml b/services/svc/webpubsub/Cargo.toml index bdc1a96dff..c9abf2ba2f 100644 --- a/services/svc/webpubsub/Cargo.toml +++ b/services/svc/webpubsub/Cargo.toml @@ -1,7 +1,7 @@ # generated by AutoRust [package] name = "azure_svc_webpubsub" -version = "0.2.0" +version = "0.3.0" edition = "2021" license = "MIT" description = "generated REST API bindings"